@atlaskit/editor-json-transformer 8.31.4 → 8.31.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 +7 -0
- package/afm-cc/tsconfig.json +9 -2
- package/afm-jira/tsconfig.json +9 -2
- package/afm-products/tsconfig.json +9 -2
- package/dist/cjs/index.js +30 -2
- package/dist/es2019/index.js +27 -0
- package/dist/esm/index.js +28 -1
- package/dist/types/index.d.ts +7 -0
- package/dist/types-ts4.5/index.d.ts +7 -0
- package/package.json +5 -4
- package/tsconfig.json +0 -1
- package/build/tsconfig.json +0 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-json-transformer
|
|
2
2
|
|
|
3
|
+
## 8.31.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1004093d5acc2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1004093d5acc2) -
|
|
8
|
+
EDITOR-5371 add util validator function
|
|
9
|
+
|
|
3
10
|
## 8.31.4
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../../../tsconfig.
|
|
2
|
+
"extends": "../../../../tsconfig.local-consumption.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"declaration": true,
|
|
5
5
|
"target": "es5",
|
|
6
6
|
"outDir": "../../../../../confluence/tsDist/@atlaskit__editor-json-transformer",
|
|
7
7
|
"rootDir": "../",
|
|
8
|
-
"composite": true
|
|
8
|
+
"composite": true,
|
|
9
|
+
"noCheck": true
|
|
9
10
|
},
|
|
10
11
|
"include": [
|
|
11
12
|
"../src/**/*.ts",
|
|
@@ -23,8 +24,14 @@
|
|
|
23
24
|
"../src/**/stories/**/*"
|
|
24
25
|
],
|
|
25
26
|
"references": [
|
|
27
|
+
{
|
|
28
|
+
"path": "../../adf-schema/afm-cc/tsconfig.json"
|
|
29
|
+
},
|
|
26
30
|
{
|
|
27
31
|
"path": "../../adf-utils/afm-cc/tsconfig.json"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"path": "../../editor-prosemirror/afm-cc/tsconfig.json"
|
|
28
35
|
}
|
|
29
36
|
]
|
|
30
37
|
}
|
package/afm-jira/tsconfig.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../../../tsconfig.
|
|
2
|
+
"extends": "../../../../tsconfig.local-consumption.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"declaration": true,
|
|
5
5
|
"target": "es5",
|
|
6
6
|
"outDir": "../../../../../jira/tsDist/@atlaskit__editor-json-transformer/app",
|
|
7
7
|
"rootDir": "../",
|
|
8
|
-
"composite": true
|
|
8
|
+
"composite": true,
|
|
9
|
+
"noCheck": true
|
|
9
10
|
},
|
|
10
11
|
"include": [
|
|
11
12
|
"../src/**/*.ts",
|
|
@@ -23,8 +24,14 @@
|
|
|
23
24
|
"../src/**/stories/**/*"
|
|
24
25
|
],
|
|
25
26
|
"references": [
|
|
27
|
+
{
|
|
28
|
+
"path": "../../adf-schema/afm-jira/tsconfig.json"
|
|
29
|
+
},
|
|
26
30
|
{
|
|
27
31
|
"path": "../../adf-utils/afm-jira/tsconfig.json"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"path": "../../editor-prosemirror/afm-jira/tsconfig.json"
|
|
28
35
|
}
|
|
29
36
|
]
|
|
30
37
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../../../tsconfig.
|
|
2
|
+
"extends": "../../../../tsconfig.local-consumption.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"declaration": true,
|
|
5
5
|
"target": "es5",
|
|
6
6
|
"outDir": "../../../../../tsDist/@atlaskit__editor-json-transformer/app",
|
|
7
7
|
"rootDir": "../",
|
|
8
|
-
"composite": true
|
|
8
|
+
"composite": true,
|
|
9
|
+
"noCheck": true
|
|
9
10
|
},
|
|
10
11
|
"include": [
|
|
11
12
|
"../src/**/*.ts",
|
|
@@ -23,8 +24,14 @@
|
|
|
23
24
|
"../src/**/stories/**/*"
|
|
24
25
|
],
|
|
25
26
|
"references": [
|
|
27
|
+
{
|
|
28
|
+
"path": "../../adf-schema/afm-products/tsconfig.json"
|
|
29
|
+
},
|
|
26
30
|
{
|
|
27
31
|
"path": "../../adf-utils/afm-products/tsconfig.json"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"path": "../../editor-prosemirror/afm-products/tsconfig.json"
|
|
28
35
|
}
|
|
29
36
|
]
|
|
30
37
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -5,7 +5,9 @@ var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.SchemaStage = exports.JSONTransformer = void 0;
|
|
9
|
+
exports.isJSONDocNode = isJSONDocNode;
|
|
10
|
+
exports.nodeToJSON = void 0;
|
|
9
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
13
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
@@ -265,4 +267,30 @@ var JSONTransformer = exports.JSONTransformer = /*#__PURE__*/function () {
|
|
|
265
267
|
return (0, _sanitizeNode.sanitizeNode)(_toJSON(node, this.mentionMap));
|
|
266
268
|
}
|
|
267
269
|
}]);
|
|
268
|
-
}();
|
|
270
|
+
}();
|
|
271
|
+
/**
|
|
272
|
+
* Quick type guard to check if a value is a valid JSONDocNode
|
|
273
|
+
* This is only a basic structural check, does not validate the entire object nor the schema.
|
|
274
|
+
* @param value - The value to check
|
|
275
|
+
* @returns true if the value is a valid JSONDocNode structure
|
|
276
|
+
*/
|
|
277
|
+
function isJSONDocNode(value) {
|
|
278
|
+
if (!value || (0, _typeof2.default)(value) !== 'object') {
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
var doc = value;
|
|
282
|
+
|
|
283
|
+
// Check required properties
|
|
284
|
+
if (doc.type !== 'doc') {
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
287
|
+
if (!Array.isArray(doc.content)) {
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// Version is optional but if present should be a number
|
|
292
|
+
if (doc.version !== undefined && typeof doc.version !== 'number') {
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
return true;
|
|
296
|
+
}
|
package/dist/es2019/index.js
CHANGED
|
@@ -239,4 +239,31 @@ export class JSONTransformer {
|
|
|
239
239
|
encodeNode(node) {
|
|
240
240
|
return sanitizeNode(toJSON(node, this.mentionMap));
|
|
241
241
|
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Quick type guard to check if a value is a valid JSONDocNode
|
|
246
|
+
* This is only a basic structural check, does not validate the entire object nor the schema.
|
|
247
|
+
* @param value - The value to check
|
|
248
|
+
* @returns true if the value is a valid JSONDocNode structure
|
|
249
|
+
*/
|
|
250
|
+
export function isJSONDocNode(value) {
|
|
251
|
+
if (!value || typeof value !== 'object') {
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
const doc = value;
|
|
255
|
+
|
|
256
|
+
// Check required properties
|
|
257
|
+
if (doc.type !== 'doc') {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
if (!Array.isArray(doc.content)) {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Version is optional but if present should be a number
|
|
265
|
+
if (doc.version !== undefined && typeof doc.version !== 'number') {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
return true;
|
|
242
269
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -260,4 +260,31 @@ export var JSONTransformer = /*#__PURE__*/function () {
|
|
|
260
260
|
return sanitizeNode(_toJSON(node, this.mentionMap));
|
|
261
261
|
}
|
|
262
262
|
}]);
|
|
263
|
-
}();
|
|
263
|
+
}();
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Quick type guard to check if a value is a valid JSONDocNode
|
|
267
|
+
* This is only a basic structural check, does not validate the entire object nor the schema.
|
|
268
|
+
* @param value - The value to check
|
|
269
|
+
* @returns true if the value is a valid JSONDocNode structure
|
|
270
|
+
*/
|
|
271
|
+
export function isJSONDocNode(value) {
|
|
272
|
+
if (!value || _typeof(value) !== 'object') {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
var doc = value;
|
|
276
|
+
|
|
277
|
+
// Check required properties
|
|
278
|
+
if (doc.type !== 'doc') {
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
if (!Array.isArray(doc.content)) {
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Version is optional but if present should be a number
|
|
286
|
+
if (doc.version !== undefined && typeof doc.version !== 'number') {
|
|
287
|
+
return false;
|
|
288
|
+
}
|
|
289
|
+
return true;
|
|
290
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -37,3 +37,10 @@ export declare class JSONTransformer implements Transformer<JSONDocNode> {
|
|
|
37
37
|
*/
|
|
38
38
|
encodeNode(node: PMNode): JSONNode;
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Quick type guard to check if a value is a valid JSONDocNode
|
|
42
|
+
* This is only a basic structural check, does not validate the entire object nor the schema.
|
|
43
|
+
* @param value - The value to check
|
|
44
|
+
* @returns true if the value is a valid JSONDocNode structure
|
|
45
|
+
*/
|
|
46
|
+
export declare function isJSONDocNode(value: unknown): value is JSONDocNode;
|
|
@@ -37,3 +37,10 @@ export declare class JSONTransformer implements Transformer<JSONDocNode> {
|
|
|
37
37
|
*/
|
|
38
38
|
encodeNode(node: PMNode): JSONNode;
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Quick type guard to check if a value is a valid JSONDocNode
|
|
42
|
+
* This is only a basic structural check, does not validate the entire object nor the schema.
|
|
43
|
+
* @param value - The value to check
|
|
44
|
+
* @returns true if the value is a valid JSONDocNode structure
|
|
45
|
+
*/
|
|
46
|
+
export declare function isJSONDocNode(value: unknown): value is JSONDocNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-json-transformer",
|
|
3
|
-
"version": "8.31.
|
|
3
|
+
"version": "8.31.5",
|
|
4
4
|
"description": "JSON transformer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -29,13 +29,14 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@atlaskit/adf-schema": "^51.5.
|
|
33
|
-
"@atlaskit/adf-utils": "^19.
|
|
34
|
-
"@atlaskit/editor-prosemirror": "7.
|
|
32
|
+
"@atlaskit/adf-schema": "^51.5.0",
|
|
33
|
+
"@atlaskit/adf-utils": "^19.27.0",
|
|
34
|
+
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
35
35
|
"@babel/runtime": "^7.0.0",
|
|
36
36
|
"lodash": "^4.17.21"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
+
"@atlassian/a11y-jest-testing": "^0.10.0",
|
|
39
40
|
"react": "^18.2.0"
|
|
40
41
|
},
|
|
41
42
|
"techstack": {
|
package/tsconfig.json
CHANGED
package/build/tsconfig.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../tsconfig",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"declaration": true,
|
|
5
|
-
"target": "es5",
|
|
6
|
-
"paths": {}
|
|
7
|
-
},
|
|
8
|
-
"include": [
|
|
9
|
-
"../src/**/*.ts",
|
|
10
|
-
"../src/**/*.tsx"
|
|
11
|
-
],
|
|
12
|
-
"exclude": [
|
|
13
|
-
"../src/**/__tests__/*",
|
|
14
|
-
"../src/**/*.test.*",
|
|
15
|
-
"../src/**/test.*",
|
|
16
|
-
"../src/**/examples.*",
|
|
17
|
-
"../src/**/examples/*",
|
|
18
|
-
"../src/**/examples/**/*",
|
|
19
|
-
"../src/**/*.stories.*",
|
|
20
|
-
"../src/**/stories/*",
|
|
21
|
-
"../src/**/stories/**/*"
|
|
22
|
-
]
|
|
23
|
-
}
|