@atlaskit/adf-utils 19.14.1 → 19.15.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/builders/utils/create-text-nodes.js +5 -0
  3. package/dist/cjs/builders/utils/is-duplicate-mark.js +5 -0
  4. package/dist/cjs/scrub/default-node-replacements.js +2 -0
  5. package/dist/cjs/scrub/scrub-adf.js +3 -0
  6. package/dist/cjs/scrub/scrub-content.js +7 -0
  7. package/dist/cjs/transforms/nested-table-transform.js +2 -2
  8. package/dist/cjs/transforms/nodes-missing-content-transform.js +2 -0
  9. package/dist/cjs/transforms.js +6 -0
  10. package/dist/cjs/traverse/map.js +2 -0
  11. package/dist/cjs/traverse/reduce.js +2 -0
  12. package/dist/cjs/traverse/traverse.js +3 -0
  13. package/dist/cjs/validator/utils.js +5 -0
  14. package/dist/cjs/validator/validator.js +129 -15
  15. package/dist/es2019/builders/utils/create-text-nodes.js +6 -0
  16. package/dist/es2019/builders/utils/is-duplicate-mark.js +5 -0
  17. package/dist/es2019/scrub/default-node-replacements.js +4 -0
  18. package/dist/es2019/scrub/scrub-adf.js +3 -0
  19. package/dist/es2019/scrub/scrub-content.js +7 -0
  20. package/dist/es2019/transforms/dedupe-marks-transform.js +2 -2
  21. package/dist/es2019/transforms/invalid-media-content-transform.js +1 -1
  22. package/dist/es2019/transforms/nested-table-transform.js +1 -1
  23. package/dist/es2019/transforms/nodes-missing-content-transform.js +2 -0
  24. package/dist/es2019/transforms.js +1 -1
  25. package/dist/es2019/traverse/map.js +3 -0
  26. package/dist/es2019/traverse/reduce.js +3 -0
  27. package/dist/es2019/traverse/traverse.js +3 -0
  28. package/dist/es2019/validator/utils.js +5 -0
  29. package/dist/es2019/validator/validator.js +138 -19
  30. package/dist/esm/builders/utils/create-text-nodes.js +6 -0
  31. package/dist/esm/builders/utils/is-duplicate-mark.js +5 -0
  32. package/dist/esm/scrub/default-node-replacements.js +2 -0
  33. package/dist/esm/scrub/scrub-adf.js +3 -0
  34. package/dist/esm/scrub/scrub-content.js +7 -0
  35. package/dist/esm/transforms/nested-table-transform.js +1 -1
  36. package/dist/esm/transforms/nodes-missing-content-transform.js +2 -0
  37. package/dist/esm/transforms.js +1 -1
  38. package/dist/esm/traverse/map.js +3 -0
  39. package/dist/esm/traverse/reduce.js +3 -0
  40. package/dist/esm/traverse/traverse.js +3 -0
  41. package/dist/esm/validator/utils.js +5 -0
  42. package/dist/esm/validator/validator.js +130 -14
  43. package/dist/types/transforms/nested-table-transform.d.ts +1 -0
  44. package/dist/types/transforms.d.ts +1 -1
  45. package/dist/types-ts4.5/transforms/nested-table-transform.d.ts +1 -0
  46. package/dist/types-ts4.5/transforms.d.ts +1 -1
  47. package/package.json +1 -1
  48. package/tsconfig.json +0 -1
@@ -30,7 +30,7 @@ const maybeRemoveDisallowedDuplicateMarks = node => {
30
30
  discardedMarks
31
31
  };
32
32
  }
33
- let dedupedMarks = node.marks.filter(mark => {
33
+ const dedupedMarks = node.marks.filter(mark => {
34
34
  const markType = mark.type;
35
35
  if (markType === 'annotation') {
36
36
  var _mark$attrs;
@@ -64,7 +64,7 @@ const maybeRemoveDisallowedDuplicateMarks = node => {
64
64
  };
65
65
  export const transformDedupeMarks = adf => {
66
66
  let isTransformed = false;
67
- let discardedMarks = [];
67
+ const discardedMarks = [];
68
68
  const transformedAdf = traverse(adf, {
69
69
  text: node => {
70
70
  if (maybeHasDisallowedDuplicateMarks(node)) {
@@ -1,7 +1,7 @@
1
1
  import { traverse } from '../traverse/traverse';
2
2
  import { isEmpty } from './helpers';
3
3
  const getChildrenTypeCounts = (nodeContent, allowedTypes) => {
4
- let childrenTypes = {};
4
+ const childrenTypes = {};
5
5
  nodeContent.forEach((childNode, index) => {
6
6
  if (!(childNode !== null && childNode !== void 0 && childNode.type) || !allowedTypes.includes(childNode.type)) {
7
7
  return;
@@ -3,7 +3,7 @@ import { extension } from '../builders';
3
3
  import { NodeNestingTransformError } from './errors';
4
4
  const NESTED_TABLE_EXTENSION_TYPE = 'com.atlassian.confluence.migration',
5
5
  NESTED_TABLE_EXTENSION_KEY = 'nested-table';
6
- const isNestedTableExtension = extensionNode => {
6
+ export const isNestedTableExtension = extensionNode => {
7
7
  var _extensionNode$attrs, _extensionNode$attrs2;
8
8
  return ((_extensionNode$attrs = extensionNode.attrs) === null || _extensionNode$attrs === void 0 ? void 0 : _extensionNode$attrs.extensionType) === NESTED_TABLE_EXTENSION_TYPE && ((_extensionNode$attrs2 = extensionNode.attrs) === null || _extensionNode$attrs2 === void 0 ? void 0 : _extensionNode$attrs2.extensionKey) === NESTED_TABLE_EXTENSION_KEY;
9
9
  };
@@ -56,6 +56,8 @@ const tryCreateValidListItemWrappedChildren = parentListNode => {
56
56
  case 'text':
57
57
  return listItem([paragraph(childNode)]);
58
58
  default:
59
+ // Ignored via go/ees005
60
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
61
  return listItem([childNode]);
60
62
  }
61
63
  }
@@ -7,6 +7,6 @@ export { transformDedupeMarks } from './transforms/dedupe-marks-transform';
7
7
  export { transformNodesMissingContent } from './transforms/nodes-missing-content-transform';
8
8
  export { transformIndentationMarks } from './transforms/indentation-marks-transform';
9
9
  export { transformInvalidMediaContent } from './transforms/invalid-media-content-transform';
10
- export { transformNestedTablesIncomingDocument } from './transforms/nested-table-transform';
10
+ export { transformNestedTablesIncomingDocument, isNestedTableExtension } from './transforms/nested-table-transform';
11
11
  export { transformNestedTableNodeOutgoingDocument } from './transforms/nested-table-transform';
12
12
  export { NodeNestingTransformError } from './transforms/errors';
@@ -1,4 +1,7 @@
1
1
  import { traverse } from './traverse';
2
+
3
+ // Ignored via go/ees005
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
5
  export function map(adf, callback) {
3
6
  const result = [];
4
7
  traverse(adf, {
@@ -1,4 +1,7 @@
1
1
  import { traverse } from './traverse';
2
+
3
+ // Ignored via go/ees005
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
5
  export function reduce(adf, callback, initial) {
3
6
  let result = initial;
4
7
  traverse(adf, {
@@ -19,6 +19,9 @@ export function traverse(adf, visitors) {
19
19
  node: undefined
20
20
  }, visitors, 0, 0);
21
21
  }
22
+
23
+ // Ignored via go/ees005
24
+ // eslint-disable-next-line @typescript-eslint/max-params
22
25
  function traverseNode(adfNode, parent, visitors, index, depth) {
23
26
  const visitor = visitors[adfNode.type] || visitors['any'];
24
27
  let newNode = {
@@ -6,7 +6,12 @@ export const isBoolean = x => x === true || x === false || toString.call(x) ===
6
6
  // This is a kludge, might replace with something like _.isString in future
7
7
  export const isString = s => typeof s === 'string' || s instanceof String;
8
8
  export const isPlainObject = x => typeof x === 'object' && x !== null && !Array.isArray(x);
9
+
10
+ // Ignored via go/ees005
11
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
12
  export const copy = (source, dest, key) => {
13
+ // Ignored via go/ees005
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
15
  dest[key] = source[key];
11
16
  return dest;
12
17
  };
@@ -1,8 +1,15 @@
1
+ // Ignored via go/ees005
2
+ // eslint-disable-next-line import/no-namespace
1
3
  import * as specs from './specs';
2
4
  import { copy, isBoolean, isDefined, isInteger, isNumber, isPlainObject, isString, makeArray } from './utils';
3
5
  import { validatorFnMap } from './rules';
6
+
7
+ // Ignored via go/ees005
8
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
9
  function mapMarksItems(spec, fn = x => x) {
5
10
  if (spec.props && spec.props.marks) {
11
+ // Ignored via go/ees005
12
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
6
13
  const {
7
14
  items,
8
15
  ...rest
@@ -25,6 +32,9 @@ function mapMarksItems(spec, fn = x => x) {
25
32
  return spec;
26
33
  }
27
34
  }
35
+
36
+ // Ignored via go/ees005
37
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
38
  const partitionObject = (obj, predicate) => Object.keys(obj).reduce((acc, key) => {
29
39
  const result = predicate(key, obj[key], obj);
30
40
  acc[result ? 0 : 1].push(key);
@@ -36,7 +46,11 @@ const partitionObject = (obj, predicate) => Object.keys(obj).reduce((acc, key) =
36
46
  * We denormalised the spec to save bundle size.
37
47
  */
38
48
  function createSpec(nodes, marks) {
49
+ // Ignored via go/ees005
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
51
  return Object.keys(specs).reduce((newSpecs, k) => {
52
+ // Ignored via go/ees005
53
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
40
54
  const spec = {
41
55
  ...specs[k]
42
56
  };
@@ -47,6 +61,8 @@ function createSpec(nodes, marks) {
47
61
  if (spec.props.content) {
48
62
  // 'tableCell_content' => { type: 'array', items: [ ... ] }
49
63
  if (isString(spec.props.content)) {
64
+ // Ignored via go/ees005
65
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
66
  spec.props.content = specs[spec.props.content];
51
67
  }
52
68
 
@@ -73,9 +89,21 @@ function createSpec(nodes, marks) {
73
89
  spec.props.content.items = spec.props.content.items
74
90
  // ['inline'] => [['emoji', 'hr', ...]]
75
91
  // ['media'] => [['media']]
76
- .map(item => isString(item) ? Array.isArray(specs[item]) ? specs[item] : [item] : item)
92
+ .map(item => isString(item) ?
93
+ // Ignored via go/ees005
94
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
95
+ Array.isArray(specs[item]) ?
96
+ // Ignored via go/ees005
97
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
98
+ specs[item] : [item] : item)
77
99
  // [['emoji', 'hr', 'inline_code']] => [['emoji', 'hr', ['text', { marks: {} }]]]
78
- .map(item => item.map(subItem => Array.isArray(specs[subItem]) ? specs[subItem] : isString(subItem) ? subItem :
100
+ .map(item => item.map(subItem =>
101
+ // Ignored via go/ees005
102
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
103
+ Array.isArray(specs[subItem]) ?
104
+ // Ignored via go/ees005
105
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
106
+ specs[subItem] : isString(subItem) ? subItem :
79
107
  // Now `NoMark` produces `items: []`, should be fixed in generator
80
108
  ['text', subItem])
81
109
  // Remove unsupported nodes & marks
@@ -109,6 +137,9 @@ function createSpec(nodes, marks) {
109
137
  return newSpecs;
110
138
  }, {});
111
139
  }
140
+
141
+ // Ignored via go/ees005
142
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
112
143
  function getOptionsForType(type, list) {
113
144
  if (!list) {
114
145
  return {};
@@ -135,7 +166,10 @@ export function validateAttrs(spec, value) {
135
166
  }
136
167
  if (isValidatorSpecAttrs(spec)) {
137
168
  // If spec has ".props" it is ValidatorSpecAttrs and need to pipe back in recursively
138
- const [_, invalidKeys] = partitionObject(spec.props, (key, subSpec) => validateAttrs(subSpec, value[key]));
169
+ const [_, invalidKeys] = partitionObject(spec.props, (key, subSpec) =>
170
+ // Ignored via go/ees005
171
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
172
+ validateAttrs(subSpec, value[key]));
139
173
  return invalidKeys.length === 0;
140
174
  }
141
175
  // extension_node parameters has no type
@@ -151,7 +185,13 @@ export function validateAttrs(spec, value) {
151
185
  return isInteger(value) && (isDefined(spec.minimum) ? spec.minimum <= value : true) && (isDefined(spec.maximum) ? spec.maximum >= value : true);
152
186
  case 'string':
153
187
  const validatorFnPassed = rule => typeof value === 'string' && isDefined(validatorFnMap[rule]) && validatorFnMap[rule](value);
154
- return isString(value) && (isDefined(spec.minLength) ? spec.minLength <= value.length : true) && (isDefined(spec.validatorFn) ? validatorFnPassed(spec.validatorFn) : true) && (spec.pattern ? new RegExp(spec.pattern).test(value) : true);
188
+ return isString(value) && (
189
+ // Ignored via go/ees005
190
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
191
+ isDefined(spec.minLength) ? spec.minLength <= value.length : true) && (isDefined(spec.validatorFn) ? validatorFnPassed(spec.validatorFn) : true) && (
192
+ // Ignored via go/ees005
193
+ // eslint-disable-next-line require-unicode-regexp
194
+ spec.pattern ? new RegExp(spec.pattern).test(value) : true);
155
195
  case 'object':
156
196
  return isPlainObject(value);
157
197
  case 'array':
@@ -206,7 +246,10 @@ const invalidChildContent = (child, errorCallback, parentSpec) => {
206
246
  }, getUnsupportedOptions(parentSpec));
207
247
  }
208
248
  };
209
- const unsupportedMarkContent = (errorCode, mark, errorCallback, errorMessage) => {
249
+ const unsupportedMarkContent = (errorCode, mark, errorCallback, errorMessage
250
+ // Ignored via go/ees005
251
+ // eslint-disable-next-line @typescript-eslint/max-params
252
+ ) => {
210
253
  const message = errorMessage || errorMessageFor(mark.type, 'unsupported mark');
211
254
  if (!errorCallback) {
212
255
  throw new Error(message);
@@ -224,7 +267,10 @@ const unsupportedMarkContent = (errorCode, mark, errorCallback, errorMessage) =>
224
267
  });
225
268
  }
226
269
  };
227
- const unsupportedNodeAttributesContent = (entity, errorCode, invalidAttributes, message, errorCallback) => {
270
+ const unsupportedNodeAttributesContent = (entity, errorCode, invalidAttributes, message, errorCallback
271
+ // Ignored via go/ees005
272
+ // eslint-disable-next-line @typescript-eslint/max-params
273
+ ) => {
228
274
  if (!errorCallback) {
229
275
  throw new Error(message);
230
276
  } else {
@@ -248,6 +294,8 @@ export function validator(nodes, marks, options) {
248
294
  mode = 'strict',
249
295
  allowPrivateAttributes = false
250
296
  } = options || {};
297
+ // Ignored via go/ees005
298
+ // eslint-disable-next-line @typescript-eslint/max-params
251
299
  const validate = (entity, errorCallback, allowed, parentSpec) => {
252
300
  const validationResult = validateNode(entity, errorCallback, allowed, parentSpec);
253
301
  return {
@@ -255,11 +303,14 @@ export function validator(nodes, marks, options) {
255
303
  valid: validationResult.valid
256
304
  };
257
305
  };
258
- const validateNode = (entity, errorCallback, allowed, parentSpec, isMark = false) => {
306
+ const validateNode = (entity, errorCallback, allowed, parentSpec, isMark = false
307
+ // Ignored via go/ees005
308
+ // eslint-disable-next-line @typescript-eslint/max-params
309
+ ) => {
259
310
  const {
260
311
  type
261
312
  } = entity;
262
- let newEntity = {
313
+ const newEntity = {
263
314
  ...entity
264
315
  };
265
316
  const err = (code, msg, meta) => {
@@ -301,6 +352,9 @@ export function validator(nodes, marks, options) {
301
352
  };
302
353
  };
303
354
  return validate;
355
+
356
+ // Ignored via go/ees005
357
+ // eslint-disable-next-line @typescript-eslint/max-params
304
358
  function marksValidationFor(validator, entity, errorCallback, newEntity, err) {
305
359
  let validationResult;
306
360
  if (validator.props && validator.props.marks) {
@@ -316,6 +370,8 @@ export function validator(nodes, marks, options) {
316
370
  }
317
371
  return validationResult;
318
372
  }
373
+ // Ignored via go/ees005
374
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
319
375
  function validatorFor(spec, typeOptions) {
320
376
  return {
321
377
  ...spec,
@@ -329,6 +385,9 @@ export function validator(nodes, marks, options) {
329
385
  } : {})
330
386
  };
331
387
  }
388
+
389
+ // Ignored via go/ees005
390
+ // eslint-disable-next-line @typescript-eslint/max-params
332
391
  function marksAfterValidation(entity, errorCallback, marksSet, validator) {
333
392
  return entity.marks ? entity.marks.map(mark => {
334
393
  const isAKnownMark = marks ? marks.indexOf(mark.type) > -1 : true;
@@ -368,12 +427,17 @@ export function validator(nodes, marks, options) {
368
427
  }) : [];
369
428
  }
370
429
  function allowedMarksFor(validator) {
430
+ // Ignored via go/ees005
431
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
371
432
  const {
372
433
  items
373
434
  } = validator.props.marks;
374
435
  const marksSet = items.length ? Array.isArray(items[0]) ? items[0] : items : [];
375
436
  return marksSet;
376
437
  }
438
+
439
+ // Ignored via go/ees005
440
+ // eslint-disable-next-line @typescript-eslint/max-params
377
441
  function marksForEntitySpecNotSupportingMarks(prevEntity, newEntity, errorCallback, err) {
378
442
  const errorCode = 'REDUNDANT_MARKS';
379
443
  const currentMarks = prevEntity.marks || [];
@@ -413,8 +477,13 @@ export function validator(nodes, marks, options) {
413
477
  valid: true,
414
478
  entity: prevEntity
415
479
  };
480
+ // Ignored via go/ees005
481
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
416
482
  if (validatorSpec.props.text) {
417
- if (isDefined(prevEntity.text) && !validateAttrs(validatorSpec.props.text, prevEntity.text)) {
483
+ if (isDefined(prevEntity.text) &&
484
+ // Ignored via go/ees005
485
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
486
+ !validateAttrs(validatorSpec.props.text, prevEntity.text)) {
418
487
  result = err('INVALID_TEXT', `'text' validation failed`);
419
488
  }
420
489
  }
@@ -425,7 +494,11 @@ export function validator(nodes, marks, options) {
425
494
  valid: true,
426
495
  entity: prevEntity
427
496
  };
497
+ // Ignored via go/ees005
498
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
428
499
  if (validatorSpec.props.content && prevEntity.content) {
500
+ // Ignored via go/ees005
501
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
429
502
  const {
430
503
  minItems,
431
504
  maxItems
@@ -449,6 +522,8 @@ export function validator(nodes, marks, options) {
449
522
  }
450
523
  function invalidAttributesFor(validatorSpec, prevEntity) {
451
524
  let invalidAttrs = [];
525
+ // Ignored via go/ees005
526
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
452
527
  let validatorAttrs = {};
453
528
  if (validatorSpec.props && validatorSpec.props.attrs) {
454
529
  const attrOptions = makeArray(validatorSpec.props.attrs);
@@ -461,10 +536,14 @@ export function validator(nodes, marks, options) {
461
536
  const attrOption = attrOptions[i];
462
537
  if (attrOption && attrOption.props) {
463
538
  [, invalidAttrs] = partitionObject(attrOption.props, (key, spec) => {
539
+ // Ignored via go/ees005
540
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
464
541
  const valueToValidate = prevEntity.attrs[key];
465
542
  return validateAttrs(spec, valueToValidate);
466
543
  });
467
544
  }
545
+ // Ignored via go/ees005
546
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
468
547
  validatorAttrs = attrOption;
469
548
  if (!invalidAttrs.length) {
470
549
  break;
@@ -476,6 +555,9 @@ export function validator(nodes, marks, options) {
476
555
  validatorAttrs
477
556
  };
478
557
  }
558
+
559
+ // Ignored via go/ees005
560
+ // eslint-disable-next-line @typescript-eslint/max-params
479
561
  function attributesValidationFor(validatorSpec, prevEntity, newEntity, isMark, errorCallback) {
480
562
  const validatorSpecAllowsAttributes = validatorSpec.props && validatorSpec.props.attrs;
481
563
  if (prevEntity.attrs) {
@@ -503,13 +585,19 @@ export function validator(nodes, marks, options) {
503
585
  entity: prevEntity
504
586
  };
505
587
  }
506
- function validateAttributes(validatorSpec, prevEntity, attributes) {
588
+ function validateAttributes(validatorSpec, prevEntity,
589
+ // Ignored via go/ees005
590
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
591
+ attributes) {
507
592
  const invalidAttributesResult = invalidAttributesFor(validatorSpec, prevEntity);
508
593
  const {
509
594
  invalidAttrs
510
595
  } = invalidAttributesResult;
511
596
  const validatorAttrs = invalidAttributesResult.validatorAttrs;
512
597
  const attrs = Object.keys(attributes).filter(k => !(allowPrivateAttributes && k.startsWith('__')));
598
+
599
+ // Ignored via go/ees005
600
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
513
601
  const redundantAttrs = attrs.filter(a => !validatorAttrs.props[a]);
514
602
  const hasRedundantAttrs = redundantAttrs.length > 0;
515
603
  const hasUnsupportedAttrs = invalidAttrs.length || hasRedundantAttrs;
@@ -519,6 +607,9 @@ export function validator(nodes, marks, options) {
519
607
  redundantAttrs
520
608
  };
521
609
  }
610
+
611
+ // Ignored via go/ees005
612
+ // eslint-disable-next-line @typescript-eslint/max-params
522
613
  function handleUnsupportedNodeAttributes(prevEntity, newEntity, invalidAttrs, redundantAttrs, errorCallback) {
523
614
  const attr = invalidAttrs.concat(redundantAttrs);
524
615
  let result = {
@@ -554,7 +645,10 @@ export function validator(nodes, marks, options) {
554
645
  marksValidationOutput: [markValidationResult]
555
646
  };
556
647
  }
557
- function handleNoAttibutesAllowedInSpecForMark(prevEntity, attributes) {
648
+ function handleNoAttibutesAllowedInSpecForMark(prevEntity,
649
+ // Ignored via go/ees005
650
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
651
+ attributes) {
558
652
  const message = errorMessageFor('redundant attributes found', Object.keys(attributes).join(', '));
559
653
  const errorCode = 'REDUNDANT_ATTRIBUTES';
560
654
  const markValidationResult = {
@@ -568,10 +662,13 @@ export function validator(nodes, marks, options) {
568
662
  marksValidationOutput: [markValidationResult]
569
663
  };
570
664
  }
665
+
666
+ // Ignored via go/ees005
667
+ // eslint-disable-next-line @typescript-eslint/max-params
571
668
  function wrapUnSupportedNodeAttributes(prevEntity, newEntity, invalidAttrs, errorCode, message, errorCallback) {
572
- let invalidValues = {};
669
+ const invalidValues = {};
573
670
  // eslint-disable-next-line guard-for-in
574
- for (let invalidAttr in invalidAttrs) {
671
+ for (const invalidAttr in invalidAttrs) {
575
672
  invalidValues[invalidAttrs[invalidAttr]] = prevEntity.attrs && prevEntity.attrs[invalidAttrs[invalidAttr]];
576
673
  if (newEntity.attrs) {
577
674
  delete newEntity.attrs[invalidAttrs[invalidAttr]];
@@ -598,12 +695,18 @@ export function validator(nodes, marks, options) {
598
695
  return [unsupportedNodeAttributeValues];
599
696
  }
600
697
  }
698
+
699
+ // Ignored via go/ees005
700
+ // eslint-disable-next-line @typescript-eslint/max-params
601
701
  function extraPropsValidationFor(validatorSpec, prevEntity, err, newEntity, type) {
602
- let result = {
702
+ const result = {
603
703
  valid: true,
604
704
  entity: prevEntity
605
705
  };
606
- const [requiredProps, redundantProps] = partitionObject(prevEntity, k => isDefined(validatorSpec.props[k]));
706
+ const [requiredProps, redundantProps] = partitionObject(prevEntity, k =>
707
+ // Ignored via go/ees005
708
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
709
+ isDefined(validatorSpec.props[k]));
607
710
  if (redundantProps.length) {
608
711
  if (mode === 'loose') {
609
712
  newEntity = {
@@ -620,8 +723,14 @@ export function validator(nodes, marks, options) {
620
723
  }
621
724
  return result;
622
725
  }
623
- function specBasedValidationFor(spec, typeOptions, prevEntity, err, newEntity, type, errorCallback, isMark) {
624
- let specBasedValidationResult = {
726
+
727
+ // Ignored via go/ees005
728
+ // eslint-disable-next-line @typescript-eslint/max-params
729
+ function specBasedValidationFor(spec,
730
+ // Ignored via go/ees005
731
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
732
+ typeOptions, prevEntity, err, newEntity, type, errorCallback, isMark) {
733
+ const specBasedValidationResult = {
625
734
  hasValidated: false
626
735
  };
627
736
  const validatorSpec = validatorFor(spec, typeOptions);
@@ -711,20 +820,30 @@ export function validator(nodes, marks, options) {
711
820
  if (validatorSpec.props.content) {
712
821
  const contentValidatorSpec = validatorSpec.props.content;
713
822
  if (prevEntity.content) {
823
+ // Ignored via go/ees005
824
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
714
825
  const validateChildNode = (child, index) => {
715
826
  if (child === undefined) {
716
827
  return child;
717
828
  }
718
- const validateChildMarks = (childEntity, marksValidationOutput, errorCallback, isLastValidationSpec, isParentTupleLike = false) => {
829
+ const validateChildMarks = (childEntity, marksValidationOutput, errorCallback, isLastValidationSpec, isParentTupleLike = false
830
+ // Ignored via go/ees005
831
+ // eslint-disable-next-line @typescript-eslint/max-params
832
+ ) => {
719
833
  let marksAreValid = true;
720
834
  if (childEntity && childEntity.marks && marksValidationOutput) {
721
835
  const validMarks = marksValidationOutput.filter(mark => mark.valid);
836
+ // Ignored via go/ees005
837
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
722
838
  const finalMarks = marksValidationOutput.map(mr => {
723
839
  if (mr.valid) {
724
840
  return mr.newMark;
725
841
  } else {
726
842
  if (validMarks.length || isLastValidationSpec || isParentTupleLike || mr.errorCode === 'INVALID_TYPE' || mr.errorCode === 'INVALID_CONTENT' || mr.errorCode === 'REDUNDANT_ATTRIBUTES' || mr.errorCode === 'INVALID_ATTRIBUTES') {
727
- return unsupportedMarkContent(mr.errorCode, mr.originalMark, errorCallback, mr.message);
843
+ return unsupportedMarkContent(
844
+ // Ignored via go/ees005
845
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
846
+ mr.errorCode, mr.originalMark, errorCallback, mr.message);
728
847
  }
729
848
  return;
730
849
  }
@@ -1,7 +1,13 @@
1
1
  import { text } from '../nodes/text';
2
+
3
+ // Ignored via go/ees005
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
5
  export function createTextNodes(nodes) {
3
6
  return nodes.map(createTextFromString);
4
7
  }
8
+
9
+ // Ignored via go/ees005
10
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
11
  export function createTextFromString(str) {
6
12
  return typeof str === 'string' ? text(str) : str;
7
13
  }
@@ -1,3 +1,5 @@
1
+ // Ignored via go/ees005
2
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1
3
  export function isDuplicateMark(node, type) {
2
4
  if (node.marks && node.marks.some(function (mark) {
3
5
  return mark.type === type;
@@ -6,6 +8,9 @@ export function isDuplicateMark(node, type) {
6
8
  }
7
9
  return false;
8
10
  }
11
+
12
+ // Ignored via go/ees005
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
14
  export function duplicateMarkError(node, type) {
10
15
  return "Mark with the same name '".concat(type, "' already exists on a node: ").concat(JSON.stringify(node));
11
16
  }
@@ -16,6 +16,8 @@ var mediaParent = function mediaParent(node) {
16
16
  var _node$content;
17
17
  return {
18
18
  type: node.type,
19
+ // Ignored via go/ees005
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
21
  attrs: node.attrs ? scrubAttrs(node.type, node.attrs) : undefined,
20
22
  content: (_node$content = node.content) === null || _node$content === void 0 ? void 0 : _node$content.filter(function (c) {
21
23
  return (c === null || c === void 0 ? void 0 : c.type) === 'media';
@@ -22,6 +22,9 @@ export default (function (adf) {
22
22
  return result;
23
23
  }
24
24
  }
25
+
26
+ // Ignored via go/ees005
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
28
  var updatedNode = {};
26
29
  Object.entries(node).forEach(function (_ref) {
27
30
  var _ref2 = _slicedToArray(_ref, 2),
@@ -26,6 +26,8 @@ var BYPASS_ATTR_LIST = {
26
26
  tableRow: ['defaultMarks'],
27
27
  taskItem: ['state']
28
28
  };
29
+ // Ignored via go/ees005
30
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
31
  var fromEntries = function fromEntries(iterable) {
30
32
  return _toConsumableArray(iterable).reduce(function (obj, _ref) {
31
33
  var _ref2 = _slicedToArray(_ref, 2),
@@ -91,6 +93,8 @@ export var scrubLink = function scrubLink(marks, _ref3) {
91
93
  });
92
94
  };
93
95
  var scrubObj = function scrubObj(nodeType, attrsObj) {
96
+ // Ignored via go/ees005
97
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
94
98
  var entries = Object.entries(attrsObj).map(function (_ref4) {
95
99
  var _BYPASS_ATTR_LIST$nod;
96
100
  var _ref5 = _slicedToArray(_ref4, 2),
@@ -100,6 +104,9 @@ var scrubObj = function scrubObj(nodeType, attrsObj) {
100
104
  });
101
105
  return fromEntries(entries);
102
106
  };
107
+
108
+ // Ignored via go/ees005
109
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
103
110
  export var scrubAttrs = function scrubAttrs(nodeType, attrs) {
104
111
  var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
105
112
  if (typeof attrs === 'number') {
@@ -6,7 +6,7 @@ import { extension } from '../builders';
6
6
  import { NodeNestingTransformError } from './errors';
7
7
  var NESTED_TABLE_EXTENSION_TYPE = 'com.atlassian.confluence.migration',
8
8
  NESTED_TABLE_EXTENSION_KEY = 'nested-table';
9
- var isNestedTableExtension = function isNestedTableExtension(extensionNode) {
9
+ export var isNestedTableExtension = function isNestedTableExtension(extensionNode) {
10
10
  var _extensionNode$attrs, _extensionNode$attrs2;
11
11
  return ((_extensionNode$attrs = extensionNode.attrs) === null || _extensionNode$attrs === void 0 ? void 0 : _extensionNode$attrs.extensionType) === NESTED_TABLE_EXTENSION_TYPE && ((_extensionNode$attrs2 = extensionNode.attrs) === null || _extensionNode$attrs2 === void 0 ? void 0 : _extensionNode$attrs2.extensionKey) === NESTED_TABLE_EXTENSION_KEY;
12
12
  };
@@ -63,6 +63,8 @@ var tryCreateValidListItemWrappedChildren = function tryCreateValidListItemWrapp
63
63
  case 'text':
64
64
  return listItem([paragraph(childNode)]);
65
65
  default:
66
+ // Ignored via go/ees005
67
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
66
68
  return listItem([childNode]);
67
69
  }
68
70
  }
@@ -7,6 +7,6 @@ export { transformDedupeMarks } from './transforms/dedupe-marks-transform';
7
7
  export { transformNodesMissingContent } from './transforms/nodes-missing-content-transform';
8
8
  export { transformIndentationMarks } from './transforms/indentation-marks-transform';
9
9
  export { transformInvalidMediaContent } from './transforms/invalid-media-content-transform';
10
- export { transformNestedTablesIncomingDocument } from './transforms/nested-table-transform';
10
+ export { transformNestedTablesIncomingDocument, isNestedTableExtension } from './transforms/nested-table-transform';
11
11
  export { transformNestedTableNodeOutgoingDocument } from './transforms/nested-table-transform';
12
12
  export { NodeNestingTransformError } from './transforms/errors';
@@ -1,4 +1,7 @@
1
1
  import { traverse } from './traverse';
2
+
3
+ // Ignored via go/ees005
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
5
  export function map(adf, callback) {
3
6
  var result = [];
4
7
  traverse(adf, {
@@ -1,4 +1,7 @@
1
1
  import { traverse } from './traverse';
2
+
3
+ // Ignored via go/ees005
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
5
  export function reduce(adf, callback, initial) {
3
6
  var result = initial;
4
7
  traverse(adf, {
@@ -22,6 +22,9 @@ export function traverse(adf, visitors) {
22
22
  node: undefined
23
23
  }, visitors, 0, 0);
24
24
  }
25
+
26
+ // Ignored via go/ees005
27
+ // eslint-disable-next-line @typescript-eslint/max-params
25
28
  function traverseNode(adfNode, parent, visitors, index, depth) {
26
29
  var visitor = visitors[adfNode.type] || visitors['any'];
27
30
  var newNode = _objectSpread({}, adfNode);
@@ -19,7 +19,12 @@ export var isString = function isString(s) {
19
19
  export var isPlainObject = function isPlainObject(x) {
20
20
  return _typeof(x) === 'object' && x !== null && !Array.isArray(x);
21
21
  };
22
+
23
+ // Ignored via go/ees005
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
25
  export var copy = function copy(source, dest, key) {
26
+ // Ignored via go/ees005
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
28
  dest[key] = source[key];
24
29
  return dest;
25
30
  };