@atlaskit/adf-schema 52.7.1 → 52.8.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 +11 -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 +48 -1
- 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/nodes/codeBlock.js +65 -0
- package/dist/cjs/schema/createPMSpecFactory.js +4 -0
- package/dist/cjs/schema/default-schema.js +2 -1
- 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 +868 -805
- 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 +47 -0
- 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/nodes/codeBlock.js +65 -0
- package/dist/es2019/schema/createPMSpecFactory.js +4 -0
- package/dist/es2019/schema/default-schema.js +3 -2
- 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 +867 -804
- 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 +47 -0
- 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/nodes/codeBlock.js +65 -0
- package/dist/esm/schema/createPMSpecFactory.js +4 -0
- package/dist/esm/schema/default-schema.js +3 -2
- 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 +867 -804
- package/dist/json-schema/v1/stage-0.json +99 -0
- 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 +120 -92
- package/dist/types/next-schema/nodes/codeBlock.d.ts +3 -1
- 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 +701 -638
- 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 +120 -92
- package/dist/types-ts4.5/next-schema/nodes/codeBlock.d.ts +3 -1
- 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 +701 -638
- package/json-schema/v1/stage-0.json +99 -0
- package/package.json +2 -2
- package/schema-generators/validator-full-schema.ts +59 -1
|
@@ -96,6 +96,9 @@
|
|
|
96
96
|
{
|
|
97
97
|
"$ref": "#/definitions/codeBlock_node"
|
|
98
98
|
},
|
|
99
|
+
{
|
|
100
|
+
"$ref": "#/definitions/codeBlock_with_extended_attributes_node"
|
|
101
|
+
},
|
|
99
102
|
{
|
|
100
103
|
"$ref": "#/definitions/taskList_node"
|
|
101
104
|
},
|
|
@@ -778,6 +781,90 @@
|
|
|
778
781
|
"additionalProperties": false,
|
|
779
782
|
"required": ["type"]
|
|
780
783
|
},
|
|
784
|
+
"codeBlock_root_only_with_extended_attributes_node": {
|
|
785
|
+
"type": "object",
|
|
786
|
+
"properties": {
|
|
787
|
+
"type": {
|
|
788
|
+
"enum": ["codeBlock"]
|
|
789
|
+
},
|
|
790
|
+
"marks": {
|
|
791
|
+
"type": "array",
|
|
792
|
+
"items": {
|
|
793
|
+
"$ref": "#/definitions/breakout_mark"
|
|
794
|
+
}
|
|
795
|
+
},
|
|
796
|
+
"attrs": {
|
|
797
|
+
"type": "object",
|
|
798
|
+
"properties": {
|
|
799
|
+
"language": {
|
|
800
|
+
"type": "string"
|
|
801
|
+
},
|
|
802
|
+
"uniqueId": {
|
|
803
|
+
"type": "string"
|
|
804
|
+
},
|
|
805
|
+
"localId": {
|
|
806
|
+
"type": "string"
|
|
807
|
+
},
|
|
808
|
+
"wrap": {
|
|
809
|
+
"type": "boolean"
|
|
810
|
+
},
|
|
811
|
+
"hideLineNumbers": {
|
|
812
|
+
"type": "boolean"
|
|
813
|
+
}
|
|
814
|
+
},
|
|
815
|
+
"additionalProperties": false
|
|
816
|
+
},
|
|
817
|
+
"content": {
|
|
818
|
+
"type": "array",
|
|
819
|
+
"items": {
|
|
820
|
+
"$ref": "#/definitions/text_with_no_marks_node"
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
},
|
|
824
|
+
"additionalProperties": false,
|
|
825
|
+
"required": ["type"]
|
|
826
|
+
},
|
|
827
|
+
"codeBlock_with_extended_attributes_node": {
|
|
828
|
+
"type": "object",
|
|
829
|
+
"properties": {
|
|
830
|
+
"type": {
|
|
831
|
+
"enum": ["codeBlock"]
|
|
832
|
+
},
|
|
833
|
+
"marks": {
|
|
834
|
+
"type": "array",
|
|
835
|
+
"maxItems": 0
|
|
836
|
+
},
|
|
837
|
+
"attrs": {
|
|
838
|
+
"type": "object",
|
|
839
|
+
"properties": {
|
|
840
|
+
"language": {
|
|
841
|
+
"type": "string"
|
|
842
|
+
},
|
|
843
|
+
"uniqueId": {
|
|
844
|
+
"type": "string"
|
|
845
|
+
},
|
|
846
|
+
"localId": {
|
|
847
|
+
"type": "string"
|
|
848
|
+
},
|
|
849
|
+
"wrap": {
|
|
850
|
+
"type": "boolean"
|
|
851
|
+
},
|
|
852
|
+
"hideLineNumbers": {
|
|
853
|
+
"type": "boolean"
|
|
854
|
+
}
|
|
855
|
+
},
|
|
856
|
+
"additionalProperties": false
|
|
857
|
+
},
|
|
858
|
+
"content": {
|
|
859
|
+
"type": "array",
|
|
860
|
+
"items": {
|
|
861
|
+
"$ref": "#/definitions/text_with_no_marks_node"
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
},
|
|
865
|
+
"additionalProperties": false,
|
|
866
|
+
"required": ["type"]
|
|
867
|
+
},
|
|
781
868
|
"dataConsumer_mark": {
|
|
782
869
|
"type": "object",
|
|
783
870
|
"properties": {
|
|
@@ -904,6 +991,9 @@
|
|
|
904
991
|
{
|
|
905
992
|
"$ref": "#/definitions/codeBlock_node"
|
|
906
993
|
},
|
|
994
|
+
{
|
|
995
|
+
"$ref": "#/definitions/codeBlock_with_extended_attributes_node"
|
|
996
|
+
},
|
|
907
997
|
{
|
|
908
998
|
"$ref": "#/definitions/mediaSingle_caption_node"
|
|
909
999
|
},
|
|
@@ -976,6 +1066,9 @@
|
|
|
976
1066
|
{
|
|
977
1067
|
"$ref": "#/definitions/codeBlock_root_only_node"
|
|
978
1068
|
},
|
|
1069
|
+
{
|
|
1070
|
+
"$ref": "#/definitions/codeBlock_root_only_with_extended_attributes_node"
|
|
1071
|
+
},
|
|
979
1072
|
{
|
|
980
1073
|
"$ref": "#/definitions/layoutSection_with_single_column_node"
|
|
981
1074
|
},
|
|
@@ -2414,6 +2507,9 @@
|
|
|
2414
2507
|
{
|
|
2415
2508
|
"$ref": "#/definitions/codeBlock_node"
|
|
2416
2509
|
},
|
|
2510
|
+
{
|
|
2511
|
+
"$ref": "#/definitions/codeBlock_with_extended_attributes_node"
|
|
2512
|
+
},
|
|
2417
2513
|
{
|
|
2418
2514
|
"$ref": "#/definitions/mediaGroup_node"
|
|
2419
2515
|
},
|
|
@@ -2907,6 +3003,9 @@
|
|
|
2907
3003
|
{
|
|
2908
3004
|
"$ref": "#/definitions/codeBlock_node"
|
|
2909
3005
|
},
|
|
3006
|
+
{
|
|
3007
|
+
"$ref": "#/definitions/codeBlock_with_extended_attributes_node"
|
|
3008
|
+
},
|
|
2910
3009
|
{
|
|
2911
3010
|
"$ref": "#/definitions/mediaSingle_caption_node"
|
|
2912
3011
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/adf-schema",
|
|
3
|
-
"version": "52.
|
|
3
|
+
"version": "52.8.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
|
|