@atlaskit/adf-schema 52.7.1 → 52.9.0
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 +18 -0
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/next-schema/full-schema.adf.js +1 -1
- package/dist/cjs/next-schema/generated/nodeTypes.js +56 -27
- package/dist/cjs/next-schema/groups/blockContentGroup.js +1 -1
- package/dist/cjs/next-schema/groups/blockGroup.js +1 -1
- package/dist/cjs/next-schema/groups/nonNestableBlockContentGroup.js +1 -1
- package/dist/cjs/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
- package/dist/cjs/next-schema/marks/fontSize.js +1 -2
- package/dist/cjs/next-schema/nodes/bodiedSyncBlock.js +1 -1
- package/dist/cjs/next-schema/nodes/codeBlock.js +65 -0
- package/dist/cjs/next-schema/nodes/paragraph.js +3 -14
- package/dist/cjs/schema/createPMSpecFactory.js +4 -0
- package/dist/cjs/schema/default-schema.js +3 -6
- package/dist/cjs/schema/index.js +6 -0
- package/dist/cjs/schema/nodes/code-block.js +110 -2
- package/dist/cjs/schema/nodes/index.js +6 -0
- package/dist/cjs/validator-schema/generated/validatorSpec.js +867 -822
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/next-schema/full-schema.adf.js +1 -1
- package/dist/es2019/next-schema/generated/nodeTypes.js +55 -26
- package/dist/es2019/next-schema/groups/blockContentGroup.js +1 -1
- package/dist/es2019/next-schema/groups/blockGroup.js +1 -1
- package/dist/es2019/next-schema/groups/nonNestableBlockContentGroup.js +1 -1
- package/dist/es2019/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
- package/dist/es2019/next-schema/marks/fontSize.js +1 -2
- package/dist/es2019/next-schema/nodes/bodiedSyncBlock.js +1 -1
- package/dist/es2019/next-schema/nodes/codeBlock.js +65 -0
- package/dist/es2019/next-schema/nodes/paragraph.js +3 -14
- package/dist/es2019/schema/createPMSpecFactory.js +4 -0
- package/dist/es2019/schema/default-schema.js +4 -7
- package/dist/es2019/schema/index.js +1 -1
- package/dist/es2019/schema/nodes/code-block.js +107 -3
- package/dist/es2019/schema/nodes/index.js +1 -1
- package/dist/es2019/validator-schema/generated/validatorSpec.js +866 -821
- package/dist/esm/index.js +1 -1
- package/dist/esm/next-schema/full-schema.adf.js +1 -1
- package/dist/esm/next-schema/generated/nodeTypes.js +55 -26
- package/dist/esm/next-schema/groups/blockContentGroup.js +1 -1
- package/dist/esm/next-schema/groups/blockGroup.js +1 -1
- package/dist/esm/next-schema/groups/nonNestableBlockContentGroup.js +1 -1
- package/dist/esm/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
- package/dist/esm/next-schema/marks/fontSize.js +1 -2
- package/dist/esm/next-schema/nodes/bodiedSyncBlock.js +1 -1
- package/dist/esm/next-schema/nodes/codeBlock.js +65 -0
- package/dist/esm/next-schema/nodes/paragraph.js +3 -14
- package/dist/esm/schema/createPMSpecFactory.js +4 -0
- package/dist/esm/schema/default-schema.js +4 -7
- package/dist/esm/schema/index.js +1 -1
- package/dist/esm/schema/nodes/code-block.js +109 -2
- package/dist/esm/schema/nodes/index.js +1 -1
- package/dist/esm/validator-schema/generated/validatorSpec.js +866 -821
- package/dist/json-schema/v1/full.json +73 -2
- package/dist/json-schema/v1/stage-0.json +107 -67
- package/dist/types/index.d.ts +1 -1
- package/dist/types/next-schema/generated/markTypes.d.ts +22 -21
- package/dist/types/next-schema/generated/nodeGroupTypes.d.ts +3 -3
- package/dist/types/next-schema/generated/nodeTypes.d.ts +128 -118
- package/dist/types/next-schema/nodes/codeBlock.d.ts +3 -1
- package/dist/types/next-schema/nodes/paragraph.d.ts +1 -14
- package/dist/types/schema/createPMSpecFactory.d.ts +4 -0
- package/dist/types/schema/index.d.ts +1 -1
- package/dist/types/schema/nodes/code-block.d.ts +10 -0
- package/dist/types/schema/nodes/index.d.ts +1 -1
- package/dist/types/validator-schema/generated/validatorSpec.d.ts +697 -652
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/next-schema/generated/markTypes.d.ts +22 -21
- package/dist/types-ts4.5/next-schema/generated/nodeGroupTypes.d.ts +3 -3
- package/dist/types-ts4.5/next-schema/generated/nodeTypes.d.ts +128 -118
- package/dist/types-ts4.5/next-schema/nodes/codeBlock.d.ts +3 -1
- package/dist/types-ts4.5/next-schema/nodes/paragraph.d.ts +1 -14
- package/dist/types-ts4.5/schema/createPMSpecFactory.d.ts +4 -0
- package/dist/types-ts4.5/schema/index.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/code-block.d.ts +10 -0
- package/dist/types-ts4.5/schema/nodes/index.d.ts +1 -1
- package/dist/types-ts4.5/validator-schema/generated/validatorSpec.d.ts +697 -652
- package/json-schema/v1/full.json +73 -2
- package/json-schema/v1/stage-0.json +107 -67
- package/package.json +2 -2
- package/schema-generators/validator-full-schema.ts +59 -1
package/json-schema/v1/full.json
CHANGED
|
@@ -309,6 +309,9 @@
|
|
|
309
309
|
{
|
|
310
310
|
"$ref": "#/definitions/paragraph_with_no_marks_node"
|
|
311
311
|
},
|
|
312
|
+
{
|
|
313
|
+
"$ref": "#/definitions/paragraph_with_font_size_node"
|
|
314
|
+
},
|
|
312
315
|
{
|
|
313
316
|
"$ref": "#/definitions/extension_with_marks_node"
|
|
314
317
|
}
|
|
@@ -319,6 +322,9 @@
|
|
|
319
322
|
{
|
|
320
323
|
"$ref": "#/definitions/paragraph_with_no_marks_node"
|
|
321
324
|
},
|
|
325
|
+
{
|
|
326
|
+
"$ref": "#/definitions/paragraph_with_font_size_node"
|
|
327
|
+
},
|
|
322
328
|
{
|
|
323
329
|
"$ref": "#/definitions/extension_with_marks_node"
|
|
324
330
|
}
|
|
@@ -1196,6 +1202,26 @@
|
|
|
1196
1202
|
}
|
|
1197
1203
|
]
|
|
1198
1204
|
},
|
|
1205
|
+
"fontSize_mark": {
|
|
1206
|
+
"type": "object",
|
|
1207
|
+
"properties": {
|
|
1208
|
+
"type": {
|
|
1209
|
+
"enum": ["fontSize"]
|
|
1210
|
+
},
|
|
1211
|
+
"attrs": {
|
|
1212
|
+
"type": "object",
|
|
1213
|
+
"properties": {
|
|
1214
|
+
"fontSize": {
|
|
1215
|
+
"enum": ["small"]
|
|
1216
|
+
}
|
|
1217
|
+
},
|
|
1218
|
+
"required": ["fontSize"],
|
|
1219
|
+
"additionalProperties": false
|
|
1220
|
+
}
|
|
1221
|
+
},
|
|
1222
|
+
"required": ["type", "attrs"],
|
|
1223
|
+
"additionalProperties": false
|
|
1224
|
+
},
|
|
1199
1225
|
"formatted_text_inline_node": {
|
|
1200
1226
|
"allOf": [
|
|
1201
1227
|
{
|
|
@@ -1679,6 +1705,9 @@
|
|
|
1679
1705
|
"type": "array",
|
|
1680
1706
|
"items": {
|
|
1681
1707
|
"anyOf": [
|
|
1708
|
+
{
|
|
1709
|
+
"$ref": "#/definitions/paragraph_with_font_size_node"
|
|
1710
|
+
},
|
|
1682
1711
|
{
|
|
1683
1712
|
"$ref": "#/definitions/paragraph_with_no_marks_node"
|
|
1684
1713
|
},
|
|
@@ -2047,6 +2076,9 @@
|
|
|
2047
2076
|
{
|
|
2048
2077
|
"$ref": "#/definitions/paragraph_with_no_marks_node"
|
|
2049
2078
|
},
|
|
2079
|
+
{
|
|
2080
|
+
"$ref": "#/definitions/paragraph_with_font_size_node"
|
|
2081
|
+
},
|
|
2050
2082
|
{
|
|
2051
2083
|
"$ref": "#/definitions/heading_with_no_marks_node"
|
|
2052
2084
|
},
|
|
@@ -2137,6 +2169,9 @@
|
|
|
2137
2169
|
{
|
|
2138
2170
|
"$ref": "#/definitions/paragraph_with_no_marks_node"
|
|
2139
2171
|
},
|
|
2172
|
+
{
|
|
2173
|
+
"$ref": "#/definitions/paragraph_with_font_size_node"
|
|
2174
|
+
},
|
|
2140
2175
|
{
|
|
2141
2176
|
"$ref": "#/definitions/panel_node"
|
|
2142
2177
|
},
|
|
@@ -2263,6 +2298,9 @@
|
|
|
2263
2298
|
{
|
|
2264
2299
|
"$ref": "#/definitions/paragraph_with_no_marks_node"
|
|
2265
2300
|
},
|
|
2301
|
+
{
|
|
2302
|
+
"$ref": "#/definitions/paragraph_with_font_size_node"
|
|
2303
|
+
},
|
|
2266
2304
|
{
|
|
2267
2305
|
"$ref": "#/definitions/heading_with_no_marks_node"
|
|
2268
2306
|
},
|
|
@@ -2346,7 +2384,33 @@
|
|
|
2346
2384
|
"marks": {
|
|
2347
2385
|
"type": "array",
|
|
2348
2386
|
"items": {
|
|
2349
|
-
"
|
|
2387
|
+
"anyOf": [
|
|
2388
|
+
{
|
|
2389
|
+
"$ref": "#/definitions/fontSize_mark"
|
|
2390
|
+
},
|
|
2391
|
+
{
|
|
2392
|
+
"$ref": "#/definitions/alignment_mark"
|
|
2393
|
+
}
|
|
2394
|
+
]
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
},
|
|
2398
|
+
"additionalProperties": true
|
|
2399
|
+
}
|
|
2400
|
+
]
|
|
2401
|
+
},
|
|
2402
|
+
"paragraph_with_font_size_node": {
|
|
2403
|
+
"allOf": [
|
|
2404
|
+
{
|
|
2405
|
+
"$ref": "#/definitions/paragraph_node"
|
|
2406
|
+
},
|
|
2407
|
+
{
|
|
2408
|
+
"type": "object",
|
|
2409
|
+
"properties": {
|
|
2410
|
+
"marks": {
|
|
2411
|
+
"type": "array",
|
|
2412
|
+
"items": {
|
|
2413
|
+
"$ref": "#/definitions/fontSize_mark"
|
|
2350
2414
|
}
|
|
2351
2415
|
}
|
|
2352
2416
|
},
|
|
@@ -2365,7 +2429,14 @@
|
|
|
2365
2429
|
"marks": {
|
|
2366
2430
|
"type": "array",
|
|
2367
2431
|
"items": {
|
|
2368
|
-
"
|
|
2432
|
+
"anyOf": [
|
|
2433
|
+
{
|
|
2434
|
+
"$ref": "#/definitions/fontSize_mark"
|
|
2435
|
+
},
|
|
2436
|
+
{
|
|
2437
|
+
"$ref": "#/definitions/indentation_mark"
|
|
2438
|
+
}
|
|
2439
|
+
]
|
|
2369
2440
|
}
|
|
2370
2441
|
}
|
|
2371
2442
|
},
|
|
@@ -81,12 +81,6 @@
|
|
|
81
81
|
{
|
|
82
82
|
"$ref": "#/definitions/paragraph_with_indentation_node"
|
|
83
83
|
},
|
|
84
|
-
{
|
|
85
|
-
"$ref": "#/definitions/paragraph_with_font_size_and_alignment_node"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"$ref": "#/definitions/paragraph_with_font_size_and_indentation_node"
|
|
89
|
-
},
|
|
90
84
|
{
|
|
91
85
|
"$ref": "#/definitions/mediaSingle_caption_node"
|
|
92
86
|
},
|
|
@@ -96,6 +90,9 @@
|
|
|
96
90
|
{
|
|
97
91
|
"$ref": "#/definitions/codeBlock_node"
|
|
98
92
|
},
|
|
93
|
+
{
|
|
94
|
+
"$ref": "#/definitions/codeBlock_with_extended_attributes_node"
|
|
95
|
+
},
|
|
99
96
|
{
|
|
100
97
|
"$ref": "#/definitions/taskList_node"
|
|
101
98
|
},
|
|
@@ -453,12 +450,6 @@
|
|
|
453
450
|
{
|
|
454
451
|
"$ref": "#/definitions/paragraph_with_indentation_node"
|
|
455
452
|
},
|
|
456
|
-
{
|
|
457
|
-
"$ref": "#/definitions/paragraph_with_font_size_and_alignment_node"
|
|
458
|
-
},
|
|
459
|
-
{
|
|
460
|
-
"$ref": "#/definitions/paragraph_with_font_size_and_indentation_node"
|
|
461
|
-
},
|
|
462
453
|
{
|
|
463
454
|
"$ref": "#/definitions/paragraph_with_no_marks_node"
|
|
464
455
|
},
|
|
@@ -778,6 +769,90 @@
|
|
|
778
769
|
"additionalProperties": false,
|
|
779
770
|
"required": ["type"]
|
|
780
771
|
},
|
|
772
|
+
"codeBlock_root_only_with_extended_attributes_node": {
|
|
773
|
+
"type": "object",
|
|
774
|
+
"properties": {
|
|
775
|
+
"type": {
|
|
776
|
+
"enum": ["codeBlock"]
|
|
777
|
+
},
|
|
778
|
+
"marks": {
|
|
779
|
+
"type": "array",
|
|
780
|
+
"items": {
|
|
781
|
+
"$ref": "#/definitions/breakout_mark"
|
|
782
|
+
}
|
|
783
|
+
},
|
|
784
|
+
"attrs": {
|
|
785
|
+
"type": "object",
|
|
786
|
+
"properties": {
|
|
787
|
+
"language": {
|
|
788
|
+
"type": "string"
|
|
789
|
+
},
|
|
790
|
+
"uniqueId": {
|
|
791
|
+
"type": "string"
|
|
792
|
+
},
|
|
793
|
+
"localId": {
|
|
794
|
+
"type": "string"
|
|
795
|
+
},
|
|
796
|
+
"wrap": {
|
|
797
|
+
"type": "boolean"
|
|
798
|
+
},
|
|
799
|
+
"hideLineNumbers": {
|
|
800
|
+
"type": "boolean"
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
"additionalProperties": false
|
|
804
|
+
},
|
|
805
|
+
"content": {
|
|
806
|
+
"type": "array",
|
|
807
|
+
"items": {
|
|
808
|
+
"$ref": "#/definitions/text_with_no_marks_node"
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
},
|
|
812
|
+
"additionalProperties": false,
|
|
813
|
+
"required": ["type"]
|
|
814
|
+
},
|
|
815
|
+
"codeBlock_with_extended_attributes_node": {
|
|
816
|
+
"type": "object",
|
|
817
|
+
"properties": {
|
|
818
|
+
"type": {
|
|
819
|
+
"enum": ["codeBlock"]
|
|
820
|
+
},
|
|
821
|
+
"marks": {
|
|
822
|
+
"type": "array",
|
|
823
|
+
"maxItems": 0
|
|
824
|
+
},
|
|
825
|
+
"attrs": {
|
|
826
|
+
"type": "object",
|
|
827
|
+
"properties": {
|
|
828
|
+
"language": {
|
|
829
|
+
"type": "string"
|
|
830
|
+
},
|
|
831
|
+
"uniqueId": {
|
|
832
|
+
"type": "string"
|
|
833
|
+
},
|
|
834
|
+
"localId": {
|
|
835
|
+
"type": "string"
|
|
836
|
+
},
|
|
837
|
+
"wrap": {
|
|
838
|
+
"type": "boolean"
|
|
839
|
+
},
|
|
840
|
+
"hideLineNumbers": {
|
|
841
|
+
"type": "boolean"
|
|
842
|
+
}
|
|
843
|
+
},
|
|
844
|
+
"additionalProperties": false
|
|
845
|
+
},
|
|
846
|
+
"content": {
|
|
847
|
+
"type": "array",
|
|
848
|
+
"items": {
|
|
849
|
+
"$ref": "#/definitions/text_with_no_marks_node"
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
},
|
|
853
|
+
"additionalProperties": false,
|
|
854
|
+
"required": ["type"]
|
|
855
|
+
},
|
|
781
856
|
"dataConsumer_mark": {
|
|
782
857
|
"type": "object",
|
|
783
858
|
"properties": {
|
|
@@ -904,6 +979,9 @@
|
|
|
904
979
|
{
|
|
905
980
|
"$ref": "#/definitions/codeBlock_node"
|
|
906
981
|
},
|
|
982
|
+
{
|
|
983
|
+
"$ref": "#/definitions/codeBlock_with_extended_attributes_node"
|
|
984
|
+
},
|
|
907
985
|
{
|
|
908
986
|
"$ref": "#/definitions/mediaSingle_caption_node"
|
|
909
987
|
},
|
|
@@ -916,12 +994,6 @@
|
|
|
916
994
|
{
|
|
917
995
|
"$ref": "#/definitions/paragraph_with_indentation_node"
|
|
918
996
|
},
|
|
919
|
-
{
|
|
920
|
-
"$ref": "#/definitions/paragraph_with_font_size_and_alignment_node"
|
|
921
|
-
},
|
|
922
|
-
{
|
|
923
|
-
"$ref": "#/definitions/paragraph_with_font_size_and_indentation_node"
|
|
924
|
-
},
|
|
925
997
|
{
|
|
926
998
|
"$ref": "#/definitions/paragraph_with_no_marks_node"
|
|
927
999
|
},
|
|
@@ -976,6 +1048,9 @@
|
|
|
976
1048
|
{
|
|
977
1049
|
"$ref": "#/definitions/codeBlock_root_only_node"
|
|
978
1050
|
},
|
|
1051
|
+
{
|
|
1052
|
+
"$ref": "#/definitions/codeBlock_root_only_with_extended_attributes_node"
|
|
1053
|
+
},
|
|
979
1054
|
{
|
|
980
1055
|
"$ref": "#/definitions/layoutSection_with_single_column_node"
|
|
981
1056
|
},
|
|
@@ -2414,6 +2489,9 @@
|
|
|
2414
2489
|
{
|
|
2415
2490
|
"$ref": "#/definitions/codeBlock_node"
|
|
2416
2491
|
},
|
|
2492
|
+
{
|
|
2493
|
+
"$ref": "#/definitions/codeBlock_with_extended_attributes_node"
|
|
2494
|
+
},
|
|
2417
2495
|
{
|
|
2418
2496
|
"$ref": "#/definitions/mediaGroup_node"
|
|
2419
2497
|
},
|
|
@@ -2595,25 +2673,6 @@
|
|
|
2595
2673
|
"required": ["type"]
|
|
2596
2674
|
},
|
|
2597
2675
|
"paragraph_with_alignment_node": {
|
|
2598
|
-
"allOf": [
|
|
2599
|
-
{
|
|
2600
|
-
"$ref": "#/definitions/paragraph_node"
|
|
2601
|
-
},
|
|
2602
|
-
{
|
|
2603
|
-
"type": "object",
|
|
2604
|
-
"properties": {
|
|
2605
|
-
"marks": {
|
|
2606
|
-
"type": "array",
|
|
2607
|
-
"items": {
|
|
2608
|
-
"$ref": "#/definitions/alignment_mark"
|
|
2609
|
-
}
|
|
2610
|
-
}
|
|
2611
|
-
},
|
|
2612
|
-
"additionalProperties": true
|
|
2613
|
-
}
|
|
2614
|
-
]
|
|
2615
|
-
},
|
|
2616
|
-
"paragraph_with_font_size_and_alignment_node": {
|
|
2617
2676
|
"allOf": [
|
|
2618
2677
|
{
|
|
2619
2678
|
"$ref": "#/definitions/paragraph_node"
|
|
@@ -2639,32 +2698,6 @@
|
|
|
2639
2698
|
}
|
|
2640
2699
|
]
|
|
2641
2700
|
},
|
|
2642
|
-
"paragraph_with_font_size_and_indentation_node": {
|
|
2643
|
-
"allOf": [
|
|
2644
|
-
{
|
|
2645
|
-
"$ref": "#/definitions/paragraph_node"
|
|
2646
|
-
},
|
|
2647
|
-
{
|
|
2648
|
-
"type": "object",
|
|
2649
|
-
"properties": {
|
|
2650
|
-
"marks": {
|
|
2651
|
-
"type": "array",
|
|
2652
|
-
"items": {
|
|
2653
|
-
"anyOf": [
|
|
2654
|
-
{
|
|
2655
|
-
"$ref": "#/definitions/fontSize_mark"
|
|
2656
|
-
},
|
|
2657
|
-
{
|
|
2658
|
-
"$ref": "#/definitions/indentation_mark"
|
|
2659
|
-
}
|
|
2660
|
-
]
|
|
2661
|
-
}
|
|
2662
|
-
}
|
|
2663
|
-
},
|
|
2664
|
-
"additionalProperties": true
|
|
2665
|
-
}
|
|
2666
|
-
]
|
|
2667
|
-
},
|
|
2668
2701
|
"paragraph_with_font_size_node": {
|
|
2669
2702
|
"allOf": [
|
|
2670
2703
|
{
|
|
@@ -2695,7 +2728,14 @@
|
|
|
2695
2728
|
"marks": {
|
|
2696
2729
|
"type": "array",
|
|
2697
2730
|
"items": {
|
|
2698
|
-
"
|
|
2731
|
+
"anyOf": [
|
|
2732
|
+
{
|
|
2733
|
+
"$ref": "#/definitions/fontSize_mark"
|
|
2734
|
+
},
|
|
2735
|
+
{
|
|
2736
|
+
"$ref": "#/definitions/indentation_mark"
|
|
2737
|
+
}
|
|
2738
|
+
]
|
|
2699
2739
|
}
|
|
2700
2740
|
}
|
|
2701
2741
|
},
|
|
@@ -2877,9 +2917,6 @@
|
|
|
2877
2917
|
{
|
|
2878
2918
|
"$ref": "#/definitions/paragraph_with_alignment_node"
|
|
2879
2919
|
},
|
|
2880
|
-
{
|
|
2881
|
-
"$ref": "#/definitions/paragraph_with_font_size_and_alignment_node"
|
|
2882
|
-
},
|
|
2883
2920
|
{
|
|
2884
2921
|
"$ref": "#/definitions/panel_node"
|
|
2885
2922
|
},
|
|
@@ -2907,6 +2944,9 @@
|
|
|
2907
2944
|
{
|
|
2908
2945
|
"$ref": "#/definitions/codeBlock_node"
|
|
2909
2946
|
},
|
|
2947
|
+
{
|
|
2948
|
+
"$ref": "#/definitions/codeBlock_with_extended_attributes_node"
|
|
2949
|
+
},
|
|
2910
2950
|
{
|
|
2911
2951
|
"$ref": "#/definitions/mediaSingle_caption_node"
|
|
2912
2952
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/adf-schema",
|
|
3
|
-
"version": "52.
|
|
3
|
+
"version": "52.9.0",
|
|
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/"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@atlaskit/adf-schema-generator": "^2.2.0",
|
|
44
44
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
46
|
-
"@atlaskit/tmp-editor-statsig": "^74.
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^74.7.0",
|
|
47
47
|
"@babel/runtime": "^7.0.0",
|
|
48
48
|
"css-color-names": "0.0.4",
|
|
49
49
|
"linkify-it": "^3.0.3",
|
|
@@ -5,10 +5,68 @@ import { writeToFile } from './helpers/writeToFile';
|
|
|
5
5
|
|
|
6
6
|
const outputPath = path.join('src', 'validator-schema', 'generated');
|
|
7
7
|
|
|
8
|
+
const indent = (level: number) => '\n' + ' '.repeat(level);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Emit TypeScript object/array literals.
|
|
12
|
+
*
|
|
13
|
+
* Arrays are intentionally NOT marked `as const`. With `as const`, TypeScript
|
|
14
|
+
* infers `readonly` tuple types for every array, which then fail to satisfy
|
|
15
|
+
* the `Array<string>` (mutable) shape used in the consumer's `ValidatorSpec`
|
|
16
|
+
* type — this surfaced as a TS2352 on `as Record<string, ValidatorSpec>` in
|
|
17
|
+
* `ai-model-io/.../specs/index.ts`.
|
|
18
|
+
*
|
|
19
|
+
* Plain object/array literals (without `as const`) are also fully derivable
|
|
20
|
+
* by `--isolatedDeclarations`, so dropping `as const` is safe for both the
|
|
21
|
+
* adf-schema build and any downstream consumer.
|
|
22
|
+
*/
|
|
23
|
+
function serializeValidatorJson(value: unknown, depth = 0): string {
|
|
24
|
+
if (value === null) {
|
|
25
|
+
return 'null';
|
|
26
|
+
}
|
|
27
|
+
if (value === undefined) {
|
|
28
|
+
return 'undefined';
|
|
29
|
+
}
|
|
30
|
+
if (typeof value === 'string') {
|
|
31
|
+
return JSON.stringify(value);
|
|
32
|
+
}
|
|
33
|
+
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
34
|
+
return String(value);
|
|
35
|
+
}
|
|
36
|
+
if (Array.isArray(value)) {
|
|
37
|
+
if (value.length === 0) {
|
|
38
|
+
return '[]';
|
|
39
|
+
}
|
|
40
|
+
const inner = value
|
|
41
|
+
.map((item) => serializeValidatorJson(item, depth + 1))
|
|
42
|
+
.join(`,${indent(depth + 1)}`);
|
|
43
|
+
return `[${indent(depth + 1)}${inner}${indent(depth)}]`;
|
|
44
|
+
}
|
|
45
|
+
if (typeof value === 'object') {
|
|
46
|
+
const entries = Object.entries(value as Record<string, unknown>).sort(([a], [b]) =>
|
|
47
|
+
a.localeCompare(b),
|
|
48
|
+
);
|
|
49
|
+
if (entries.length === 0) {
|
|
50
|
+
return '{}';
|
|
51
|
+
}
|
|
52
|
+
const inner = entries
|
|
53
|
+
.map(([k, v]) => {
|
|
54
|
+
const keyName = /^[a-zA-Z_$][\w$]*$/u.test(k) ? k : JSON.stringify(k);
|
|
55
|
+
return `${keyName}: ${serializeValidatorJson(v, depth + 1)}`;
|
|
56
|
+
})
|
|
57
|
+
.join(`,${indent(depth + 1)}`);
|
|
58
|
+
return `{${indent(depth + 1)}${inner}${indent(depth)}}`;
|
|
59
|
+
}
|
|
60
|
+
throw new Error(`Unsupported value in validator spec: ${typeof value}`);
|
|
61
|
+
}
|
|
62
|
+
|
|
8
63
|
function generateValidatorSpec() {
|
|
9
64
|
const output = adfToValidatorSpec(adfNode);
|
|
10
65
|
return Object.entries(output)
|
|
11
|
-
.map(([key,
|
|
66
|
+
.map(([key, entry]) => {
|
|
67
|
+
const { json } = entry as { json: unknown };
|
|
68
|
+
return `export const ${key} = ${serializeValidatorJson(json)};`;
|
|
69
|
+
})
|
|
12
70
|
.join('\n\n');
|
|
13
71
|
}
|
|
14
72
|
|