@atlaskit/adf-utils 18.2.0 → 18.2.2

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 (194) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/builders/package.json +2 -2
  3. package/dist/cjs/version.json +1 -1
  4. package/dist/es2019/version.json +1 -1
  5. package/dist/esm/version.json +1 -1
  6. package/dist/types/builders/nodes/code-block.d.ts +1 -1
  7. package/dist/types/builders/nodes/table-cell.d.ts +1 -1
  8. package/dist/types/builders/nodes/table-header.d.ts +1 -1
  9. package/dist/types/builders/types.d.ts +2 -2
  10. package/dist/types/scrub/default-node-replacements.d.ts +2 -2
  11. package/dist/types/scrub/default-value-replacements.d.ts +3 -3
  12. package/dist/types/scrub/scrub-content.d.ts +1 -1
  13. package/dist/types/types/index.d.ts +3 -3
  14. package/dist/types/types/validatorTypes.d.ts +8 -8
  15. package/dist/types-ts4.5/builders/marks/alignment.d.ts +3 -0
  16. package/dist/types-ts4.5/builders/marks/annotation.d.ts +3 -0
  17. package/dist/types-ts4.5/builders/marks/border.d.ts +3 -0
  18. package/dist/types-ts4.5/builders/marks/breakout.d.ts +3 -0
  19. package/dist/types-ts4.5/builders/marks/code.d.ts +2 -0
  20. package/dist/types-ts4.5/builders/marks/data-consumer.d.ts +3 -0
  21. package/dist/types-ts4.5/builders/marks/em.d.ts +2 -0
  22. package/dist/types-ts4.5/builders/marks/fragment.d.ts +3 -0
  23. package/dist/types-ts4.5/builders/marks/indentation.d.ts +3 -0
  24. package/dist/types-ts4.5/builders/marks/link.d.ts +3 -0
  25. package/dist/types-ts4.5/builders/marks/strike.d.ts +2 -0
  26. package/dist/types-ts4.5/builders/marks/strong.d.ts +2 -0
  27. package/dist/types-ts4.5/builders/marks/subsup.d.ts +3 -0
  28. package/dist/types-ts4.5/builders/marks/text-color.d.ts +3 -0
  29. package/dist/types-ts4.5/builders/marks/underline.d.ts +2 -0
  30. package/dist/types-ts4.5/builders/nodes/block-card.d.ts +2 -0
  31. package/dist/types-ts4.5/builders/nodes/blockquote.d.ts +2 -0
  32. package/dist/types-ts4.5/builders/nodes/bodied-extension.d.ts +2 -0
  33. package/dist/types-ts4.5/builders/nodes/bullet-list.d.ts +2 -0
  34. package/dist/types-ts4.5/builders/nodes/caption.d.ts +2 -0
  35. package/dist/types-ts4.5/builders/nodes/code-block.d.ts +3 -0
  36. package/dist/types-ts4.5/builders/nodes/date.d.ts +2 -0
  37. package/dist/types-ts4.5/builders/nodes/decision-item.d.ts +2 -0
  38. package/dist/types-ts4.5/builders/nodes/decision-list.d.ts +2 -0
  39. package/dist/types-ts4.5/builders/nodes/doc.d.ts +2 -0
  40. package/dist/types-ts4.5/builders/nodes/embed-card.d.ts +2 -0
  41. package/dist/types-ts4.5/builders/nodes/emoji.d.ts +2 -0
  42. package/dist/types-ts4.5/builders/nodes/expand.d.ts +2 -0
  43. package/dist/types-ts4.5/builders/nodes/extension.d.ts +2 -0
  44. package/dist/types-ts4.5/builders/nodes/hard-break.d.ts +2 -0
  45. package/dist/types-ts4.5/builders/nodes/heading.d.ts +2 -0
  46. package/dist/types-ts4.5/builders/nodes/inline-card.d.ts +2 -0
  47. package/dist/types-ts4.5/builders/nodes/inline-extension.d.ts +2 -0
  48. package/dist/types-ts4.5/builders/nodes/layout-column.d.ts +4 -0
  49. package/dist/types-ts4.5/builders/nodes/layout-section.d.ts +2 -0
  50. package/dist/types-ts4.5/builders/nodes/list-item.d.ts +2 -0
  51. package/dist/types-ts4.5/builders/nodes/media-group.d.ts +2 -0
  52. package/dist/types-ts4.5/builders/nodes/media-inline.d.ts +2 -0
  53. package/dist/types-ts4.5/builders/nodes/media-single.d.ts +7 -0
  54. package/dist/types-ts4.5/builders/nodes/media.d.ts +2 -0
  55. package/dist/types-ts4.5/builders/nodes/mention.d.ts +2 -0
  56. package/dist/types-ts4.5/builders/nodes/nested-expand.d.ts +2 -0
  57. package/dist/types-ts4.5/builders/nodes/ordered-list.d.ts +2 -0
  58. package/dist/types-ts4.5/builders/nodes/panel.d.ts +2 -0
  59. package/dist/types-ts4.5/builders/nodes/paragraph.d.ts +2 -0
  60. package/dist/types-ts4.5/builders/nodes/placeholder.d.ts +2 -0
  61. package/dist/types-ts4.5/builders/nodes/rule.d.ts +2 -0
  62. package/dist/types-ts4.5/builders/nodes/status.d.ts +2 -0
  63. package/dist/types-ts4.5/builders/nodes/table-cell.d.ts +2 -0
  64. package/dist/types-ts4.5/builders/nodes/table-header.d.ts +2 -0
  65. package/dist/types-ts4.5/builders/nodes/table-row.d.ts +2 -0
  66. package/dist/types-ts4.5/builders/nodes/table.d.ts +2 -0
  67. package/dist/types-ts4.5/builders/nodes/task-item.d.ts +2 -0
  68. package/dist/types-ts4.5/builders/nodes/task-list.d.ts +2 -0
  69. package/dist/types-ts4.5/builders/nodes/text.d.ts +2 -0
  70. package/dist/types-ts4.5/builders/types.d.ts +8 -0
  71. package/dist/types-ts4.5/builders/utils/apply-mark.d.ts +4 -0
  72. package/dist/types-ts4.5/builders/utils/create-text-nodes.d.ts +3 -0
  73. package/dist/types-ts4.5/builders/utils/is-duplicate-mark.d.ts +6 -0
  74. package/dist/types-ts4.5/builders.d.ts +64 -0
  75. package/dist/types-ts4.5/empty-adf.d.ts +2 -0
  76. package/dist/types-ts4.5/index.d.ts +1 -0
  77. package/dist/types-ts4.5/scrub/default-node-replacements.d.ts +10 -0
  78. package/dist/types-ts4.5/scrub/default-value-replacements.d.ts +6 -0
  79. package/dist/types-ts4.5/scrub/hash.d.ts +1 -0
  80. package/dist/types-ts4.5/scrub/scrub-adf.d.ts +9 -0
  81. package/dist/types-ts4.5/scrub/scrub-content.d.ts +11 -0
  82. package/dist/types-ts4.5/scrub.d.ts +1 -0
  83. package/dist/types-ts4.5/transforms/dedupe-marks-transform.d.ts +8 -0
  84. package/dist/types-ts4.5/transforms/helpers.d.ts +2 -0
  85. package/dist/types-ts4.5/transforms/indentation-marks-transform.d.ts +7 -0
  86. package/dist/types-ts4.5/transforms/invalid-media-content-transform.d.ts +5 -0
  87. package/dist/types-ts4.5/transforms/media-link-transform.d.ts +5 -0
  88. package/dist/types-ts4.5/transforms/nodes-missing-content-transform.d.ts +7 -0
  89. package/dist/types-ts4.5/transforms/text-link-code-transform.d.ts +5 -0
  90. package/dist/types-ts4.5/transforms.d.ts +6 -0
  91. package/dist/types-ts4.5/traverse/filter.d.ts +2 -0
  92. package/dist/types-ts4.5/traverse/map.d.ts +2 -0
  93. package/dist/types-ts4.5/traverse/reduce.d.ts +2 -0
  94. package/dist/types-ts4.5/traverse/traverse.d.ts +12 -0
  95. package/dist/types-ts4.5/traverse.d.ts +4 -0
  96. package/dist/types-ts4.5/types/index.d.ts +24 -0
  97. package/dist/types-ts4.5/types/validatorTypes.d.ts +137 -0
  98. package/dist/types-ts4.5/validator/entry.d.ts +1 -0
  99. package/dist/types-ts4.5/validator/rules.d.ts +3 -0
  100. package/dist/types-ts4.5/validator/specs/alignment.d.ts +17 -0
  101. package/dist/types-ts4.5/validator/specs/annotation.d.ts +20 -0
  102. package/dist/types-ts4.5/validator/specs/atomic_inline.d.ts +2 -0
  103. package/dist/types-ts4.5/validator/specs/blockCard.d.ts +26 -0
  104. package/dist/types-ts4.5/validator/specs/block_content.d.ts +2 -0
  105. package/dist/types-ts4.5/validator/specs/blockquote.d.ts +15 -0
  106. package/dist/types-ts4.5/validator/specs/bodiedExtension.d.ts +50 -0
  107. package/dist/types-ts4.5/validator/specs/bodiedExtension_with_marks.d.ts +10 -0
  108. package/dist/types-ts4.5/validator/specs/border.d.ts +22 -0
  109. package/dist/types-ts4.5/validator/specs/breakout.d.ts +17 -0
  110. package/dist/types-ts4.5/validator/specs/bulletList.d.ts +14 -0
  111. package/dist/types-ts4.5/validator/specs/caption.d.ts +14 -0
  112. package/dist/types-ts4.5/validator/specs/code.d.ts +9 -0
  113. package/dist/types-ts4.5/validator/specs/codeBlock.d.ts +38 -0
  114. package/dist/types-ts4.5/validator/specs/codeBlock_with_marks.d.ts +10 -0
  115. package/dist/types-ts4.5/validator/specs/codeBlock_with_no_marks.d.ts +11 -0
  116. package/dist/types-ts4.5/validator/specs/code_inline.d.ts +10 -0
  117. package/dist/types-ts4.5/validator/specs/dataConsumer.d.ts +20 -0
  118. package/dist/types-ts4.5/validator/specs/date.d.ts +17 -0
  119. package/dist/types-ts4.5/validator/specs/decisionItem.d.ts +25 -0
  120. package/dist/types-ts4.5/validator/specs/decisionList.d.ts +22 -0
  121. package/dist/types-ts4.5/validator/specs/doc.d.ts +18 -0
  122. package/dist/types-ts4.5/validator/specs/em.d.ts +9 -0
  123. package/dist/types-ts4.5/validator/specs/embedCard.d.ts +35 -0
  124. package/dist/types-ts4.5/validator/specs/emoji.d.ts +24 -0
  125. package/dist/types-ts4.5/validator/specs/expand.d.ts +28 -0
  126. package/dist/types-ts4.5/validator/specs/expand_with_breakout_mark.d.ts +10 -0
  127. package/dist/types-ts4.5/validator/specs/expand_with_no_mark.d.ts +11 -0
  128. package/dist/types-ts4.5/validator/specs/extension.d.ts +44 -0
  129. package/dist/types-ts4.5/validator/specs/extension_with_marks.d.ts +10 -0
  130. package/dist/types-ts4.5/validator/specs/formatted_text_inline.d.ts +10 -0
  131. package/dist/types-ts4.5/validator/specs/fragment.d.ts +21 -0
  132. package/dist/types-ts4.5/validator/specs/hardBreak.d.ts +19 -0
  133. package/dist/types-ts4.5/validator/specs/heading.d.ts +29 -0
  134. package/dist/types-ts4.5/validator/specs/heading_with_alignment.d.ts +10 -0
  135. package/dist/types-ts4.5/validator/specs/heading_with_indentation.d.ts +10 -0
  136. package/dist/types-ts4.5/validator/specs/heading_with_no_marks.d.ts +11 -0
  137. package/dist/types-ts4.5/validator/specs/indentation.d.ts +18 -0
  138. package/dist/types-ts4.5/validator/specs/index.d.ts +83 -0
  139. package/dist/types-ts4.5/validator/specs/inline.d.ts +2 -0
  140. package/dist/types-ts4.5/validator/specs/inlineCard.d.ts +26 -0
  141. package/dist/types-ts4.5/validator/specs/inlineExtension.d.ts +39 -0
  142. package/dist/types-ts4.5/validator/specs/inlineExtension_with_marks.d.ts +10 -0
  143. package/dist/types-ts4.5/validator/specs/inline_comment_marker.d.ts +16 -0
  144. package/dist/types-ts4.5/validator/specs/layoutColumn.d.ts +24 -0
  145. package/dist/types-ts4.5/validator/specs/layoutSection.d.ts +18 -0
  146. package/dist/types-ts4.5/validator/specs/layoutSection_full.d.ts +21 -0
  147. package/dist/types-ts4.5/validator/specs/layoutSection_with_single_column.d.ts +21 -0
  148. package/dist/types-ts4.5/validator/specs/link.d.ts +33 -0
  149. package/dist/types-ts4.5/validator/specs/link_text_inline.d.ts +10 -0
  150. package/dist/types-ts4.5/validator/specs/listItem.d.ts +15 -0
  151. package/dist/types-ts4.5/validator/specs/media.d.ts +73 -0
  152. package/dist/types-ts4.5/validator/specs/mediaGroup.d.ts +15 -0
  153. package/dist/types-ts4.5/validator/specs/mediaInline.d.ts +51 -0
  154. package/dist/types-ts4.5/validator/specs/mediaSingle.d.ts +29 -0
  155. package/dist/types-ts4.5/validator/specs/mediaSingle_caption.d.ts +13 -0
  156. package/dist/types-ts4.5/validator/specs/mediaSingle_full.d.ts +12 -0
  157. package/dist/types-ts4.5/validator/specs/mention.d.ts +29 -0
  158. package/dist/types-ts4.5/validator/specs/nestedExpand.d.ts +19 -0
  159. package/dist/types-ts4.5/validator/specs/nestedExpand_content.d.ts +7 -0
  160. package/dist/types-ts4.5/validator/specs/nestedExpand_with_no_marks.d.ts +11 -0
  161. package/dist/types-ts4.5/validator/specs/non_nestable_block_content.d.ts +2 -0
  162. package/dist/types-ts4.5/validator/specs/orderedList.d.ts +24 -0
  163. package/dist/types-ts4.5/validator/specs/panel.d.ts +39 -0
  164. package/dist/types-ts4.5/validator/specs/paragraph.d.ts +20 -0
  165. package/dist/types-ts4.5/validator/specs/paragraph_with_alignment.d.ts +10 -0
  166. package/dist/types-ts4.5/validator/specs/paragraph_with_indentation.d.ts +10 -0
  167. package/dist/types-ts4.5/validator/specs/paragraph_with_no_marks.d.ts +11 -0
  168. package/dist/types-ts4.5/validator/specs/placeholder.d.ts +16 -0
  169. package/dist/types-ts4.5/validator/specs/rule.d.ts +9 -0
  170. package/dist/types-ts4.5/validator/specs/status.d.ts +29 -0
  171. package/dist/types-ts4.5/validator/specs/strike.d.ts +9 -0
  172. package/dist/types-ts4.5/validator/specs/strong.d.ts +9 -0
  173. package/dist/types-ts4.5/validator/specs/subsup.d.ts +17 -0
  174. package/dist/types-ts4.5/validator/specs/table.d.ts +38 -0
  175. package/dist/types-ts4.5/validator/specs/tableCell.d.ts +35 -0
  176. package/dist/types-ts4.5/validator/specs/tableCell_content.d.ts +7 -0
  177. package/dist/types-ts4.5/validator/specs/tableHeader.d.ts +35 -0
  178. package/dist/types-ts4.5/validator/specs/tableRow.d.ts +13 -0
  179. package/dist/types-ts4.5/validator/specs/taskItem.d.ts +26 -0
  180. package/dist/types-ts4.5/validator/specs/taskList.d.ts +23 -0
  181. package/dist/types-ts4.5/validator/specs/text.d.ts +18 -0
  182. package/dist/types-ts4.5/validator/specs/textColor.d.ts +17 -0
  183. package/dist/types-ts4.5/validator/specs/underline.d.ts +9 -0
  184. package/dist/types-ts4.5/validator/utils.d.ts +8 -0
  185. package/dist/types-ts4.5/validator/validator.d.ts +3 -0
  186. package/dist/types-ts4.5/validator.d.ts +1 -0
  187. package/empty-adf/package.json +2 -2
  188. package/package.json +10 -2
  189. package/scrub/package.json +2 -2
  190. package/transforms/package.json +2 -2
  191. package/traverse/package.json +2 -2
  192. package/types/package.json +2 -2
  193. package/validator/package.json +2 -2
  194. package/validatorTypes/package.json +2 -2
@@ -0,0 +1,2 @@
1
+ import { ADFEntity } from '../types';
2
+ export declare const isEmpty: (node: ADFEntity) => boolean;
@@ -0,0 +1,7 @@
1
+ import { ADFEntity } from '../types';
2
+ interface TransformIndentationMarksResult {
3
+ transformedAdf: ADFEntity;
4
+ isTransformed: boolean;
5
+ }
6
+ export declare const transformIndentationMarks: (adf: ADFEntity) => TransformIndentationMarksResult;
7
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ADFEntity } from '../types';
2
+ export declare const transformInvalidMediaContent: (adf: ADFEntity) => {
3
+ transformedAdf: ADFEntity;
4
+ isTransformed: boolean;
5
+ };
@@ -0,0 +1,5 @@
1
+ import { ADFEntity } from '../types';
2
+ export declare const transformMediaLinkMarks: (adf: ADFEntity) => {
3
+ transformedAdf: false | ADFEntity;
4
+ isTransformed: boolean;
5
+ };
@@ -0,0 +1,7 @@
1
+ import { ADFEntity } from '../types';
2
+ interface TransformNodesMissingContentResult {
3
+ transformedAdf: ADFEntity;
4
+ isTransformed: boolean;
5
+ }
6
+ export declare const transformNodesMissingContent: (adf: ADFEntity) => TransformNodesMissingContentResult;
7
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ADFEntity } from '../types';
2
+ export declare const transformTextLinkCodeMarks: (adf: ADFEntity) => {
3
+ transformedAdf: false | ADFEntity;
4
+ isTransformed: boolean;
5
+ };
@@ -0,0 +1,6 @@
1
+ export { transformMediaLinkMarks } from './transforms/media-link-transform';
2
+ export { transformTextLinkCodeMarks } from './transforms/text-link-code-transform';
3
+ export { transformDedupeMarks } from './transforms/dedupe-marks-transform';
4
+ export { transformNodesMissingContent } from './transforms/nodes-missing-content-transform';
5
+ export { transformIndentationMarks } from './transforms/indentation-marks-transform';
6
+ export { transformInvalidMediaContent } from './transforms/invalid-media-content-transform';
@@ -0,0 +1,2 @@
1
+ import { ADFEntity } from '../types';
2
+ export declare function filter(adf: ADFEntity, callback: (node: ADFEntity) => boolean): Array<ADFEntity>;
@@ -0,0 +1,2 @@
1
+ import { ADFEntity } from '../types';
2
+ export declare function map<T = any>(adf: ADFEntity, callback: (node: ADFEntity) => T): Array<T>;
@@ -0,0 +1,2 @@
1
+ import { ADFEntity } from '../types';
2
+ export declare function reduce<T = any>(adf: ADFEntity, callback: (accunulator: T, node: ADFEntity) => T, initial: T): T;
@@ -0,0 +1,12 @@
1
+ import { ADFEntity, VisitorCollection } from '../types';
2
+ export declare function validateVisitors(_visitors: VisitorCollection): boolean;
3
+ /**
4
+ * Provides recursive, depth-first search document traversal. Use visitors collection to define nodes of interest.
5
+ * If no visitor for given node is defined, no-op happens.
6
+ * If visitor returns new node, the old node is replaced.
7
+ * If visitor returns false, node is dropped from the document.
8
+ * If visitor returns null/undefined/void, original node is used.
9
+ * @param adf Document to traverse.
10
+ * @param visitors Collection of visitors.
11
+ */
12
+ export declare function traverse(adf: ADFEntity, visitors: VisitorCollection): false | ADFEntity;
@@ -0,0 +1,4 @@
1
+ export { traverse } from './traverse/traverse';
2
+ export { map } from './traverse/map';
3
+ export { reduce } from './traverse/reduce';
4
+ export { filter } from './traverse/filter';
@@ -0,0 +1,24 @@
1
+ export interface ADFEntityMark {
2
+ type: string;
3
+ attrs?: {
4
+ [name: string]: any;
5
+ };
6
+ }
7
+ export interface ADFEntity {
8
+ type: string;
9
+ attrs?: {
10
+ [name: string]: any;
11
+ };
12
+ content?: Array<ADFEntity | undefined>;
13
+ marks?: Array<ADFEntityMark>;
14
+ text?: string;
15
+ [key: string]: any;
16
+ }
17
+ export type Visitor = (node: ADFEntity, parent: EntityParent, index: number, depth: number) => ADFEntity | false | undefined | void;
18
+ export type VisitorCollection = {
19
+ [nodeType: string]: Visitor;
20
+ };
21
+ export type EntityParent = {
22
+ node?: ADFEntity;
23
+ parent?: EntityParent;
24
+ };
@@ -0,0 +1,137 @@
1
+ import { ADFEntity, ADFEntityMark } from '../types';
2
+ export interface MarkValidationResult {
3
+ valid: boolean;
4
+ originalMark: ADFEntityMark;
5
+ newMark?: ADFEntityMark;
6
+ errorCode?: ValidationError['code'];
7
+ message?: string;
8
+ }
9
+ export interface Output {
10
+ valid: boolean;
11
+ entity?: ADFEntity;
12
+ }
13
+ export interface NodeValidationResult {
14
+ valid: boolean;
15
+ entity?: ADFEntity;
16
+ marksValidationOutput?: MarkValidationResult[];
17
+ }
18
+ export interface ValidatorContent {
19
+ type: 'array';
20
+ items: Array<string | Array<string>>;
21
+ minItems?: number;
22
+ maxItems?: number;
23
+ optional?: boolean;
24
+ allowUnsupportedBlock: boolean;
25
+ allowUnsupportedInline: boolean;
26
+ isTupleLike?: boolean;
27
+ }
28
+ export type AttributesSpec = {
29
+ type: 'number';
30
+ optional?: boolean;
31
+ minimum: number;
32
+ maximum: number;
33
+ } | {
34
+ type: 'integer';
35
+ optional?: boolean;
36
+ minimum: number;
37
+ maximum: number;
38
+ } | {
39
+ type: 'boolean';
40
+ optional?: boolean;
41
+ } | {
42
+ type: 'string';
43
+ optional?: boolean;
44
+ minLength?: number;
45
+ pattern?: RegExp;
46
+ validatorFn?: string;
47
+ } | {
48
+ type: 'enum';
49
+ values: Array<string>;
50
+ optional?: boolean;
51
+ } | {
52
+ type: 'object';
53
+ optional?: boolean;
54
+ } | {
55
+ type: 'array';
56
+ items: Array<AttributesSpec>;
57
+ optional?: boolean;
58
+ };
59
+ export interface ValidatorSpec {
60
+ props?: {
61
+ attrs?: {
62
+ props: {
63
+ [key: string]: AttributesSpec;
64
+ };
65
+ optional?: boolean;
66
+ };
67
+ content?: ValidatorContent;
68
+ text?: AttributesSpec;
69
+ marks?: {
70
+ type: 'array';
71
+ items: Array<Array<string>>;
72
+ maxItems?: number;
73
+ optional?: boolean;
74
+ };
75
+ };
76
+ minItems?: number;
77
+ maxItems?: number;
78
+ required?: Array<string>;
79
+ }
80
+ export interface ValidationErrorMap {
81
+ MISSING_PROPERTIES: {
82
+ props: Array<string>;
83
+ };
84
+ REDUNDANT_PROPERTIES: {
85
+ props: Array<string>;
86
+ };
87
+ REDUNDANT_ATTRIBUTES: {
88
+ attrs: Array<string>;
89
+ };
90
+ REDUNDANT_MARKS: {
91
+ marks: Array<string>;
92
+ };
93
+ INVALID_TYPE: never;
94
+ INVALID_TEXT: never;
95
+ INVALID_CONTENT: never;
96
+ INVALID_CONTENT_LENGTH: {
97
+ length: number;
98
+ requiredLength: number;
99
+ type: RequiredContentLength;
100
+ };
101
+ INVALID_ATTRIBUTES: {
102
+ attrs: Array<string>;
103
+ };
104
+ UNSUPPORTED_ATTRIBUTES: {
105
+ attrs: Array<string>;
106
+ };
107
+ DEPRECATED: never;
108
+ }
109
+ export type RequiredContentLength = 'minimum' | 'maximum';
110
+ export type Content = Array<string | [
111
+ string,
112
+ object
113
+ ] | Array<string>>;
114
+ export type ValidationErrorType = keyof ValidationErrorMap;
115
+ export interface ValidationError {
116
+ code: ValidationErrorType;
117
+ message: string;
118
+ meta?: object;
119
+ }
120
+ export type ErrorCallback = (entity: ADFEntity, error: ValidationError, options: ErrorCallbackOptions) => ADFEntity | undefined;
121
+ export type ValidationMode = 'strict' | 'loose';
122
+ export interface ValidationOptions {
123
+ mode?: ValidationMode;
124
+ allowPrivateAttributes?: boolean;
125
+ }
126
+ export interface SpecValidatorResult {
127
+ hasValidated: boolean;
128
+ result?: NodeValidationResult;
129
+ }
130
+ export type Err = <T extends ValidationErrorType>(code: T, msg: string, meta?: T extends keyof ValidationErrorMap ? ValidationErrorMap[T] : never) => NodeValidationResult;
131
+ export interface ErrorCallbackOptions {
132
+ isNodeAttribute?: boolean;
133
+ isMark?: any;
134
+ allowUnsupportedBlock?: boolean;
135
+ allowUnsupportedInline?: boolean;
136
+ }
137
+ export type Validate = (entity: ADFEntity, errorCallback?: ErrorCallback, allowed?: Content, parentSpec?: ValidatorSpec) => Output;
@@ -0,0 +1 @@
1
+ export type { DocNode } from '@atlaskit/adf-schema';
@@ -0,0 +1,3 @@
1
+ export declare const validatorFnMap: {
2
+ [key: string]: (value: string) => boolean;
3
+ };
@@ -0,0 +1,17 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ attrs: {
8
+ props: {
9
+ align: {
10
+ type: string;
11
+ values: string[];
12
+ };
13
+ };
14
+ };
15
+ };
16
+ };
17
+ export default _default;
@@ -0,0 +1,20 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ attrs: {
8
+ props: {
9
+ id: {
10
+ type: string;
11
+ };
12
+ annotationType: {
13
+ type: string;
14
+ values: string[];
15
+ };
16
+ };
17
+ };
18
+ };
19
+ };
20
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: string[];
2
+ export default _default;
@@ -0,0 +1,26 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ attrs: ({
8
+ props: {
9
+ url: {
10
+ type: string;
11
+ validatorFn: string;
12
+ };
13
+ data?: undefined;
14
+ };
15
+ } | {
16
+ props: {
17
+ data: {
18
+ type: string;
19
+ };
20
+ url?: undefined;
21
+ };
22
+ })[];
23
+ };
24
+ required: string[];
25
+ };
26
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: string[];
2
+ export default _default;
@@ -0,0 +1,15 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ content: {
8
+ type: string;
9
+ items: string[];
10
+ minItems: number;
11
+ allowUnsupportedBlock: boolean;
12
+ };
13
+ };
14
+ };
15
+ export default _default;
@@ -0,0 +1,50 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ attrs: {
8
+ props: {
9
+ extensionKey: {
10
+ type: string;
11
+ minLength: number;
12
+ };
13
+ extensionType: {
14
+ type: string;
15
+ minLength: number;
16
+ };
17
+ parameters: {
18
+ type: string;
19
+ optional: boolean;
20
+ };
21
+ text: {
22
+ type: string;
23
+ optional: boolean;
24
+ };
25
+ layout: {
26
+ type: string;
27
+ values: string[];
28
+ optional: boolean;
29
+ };
30
+ localId: {
31
+ type: string;
32
+ minLength: number;
33
+ optional: boolean;
34
+ };
35
+ };
36
+ };
37
+ marks: {
38
+ type: string;
39
+ items: never[];
40
+ optional: boolean;
41
+ };
42
+ content: {
43
+ type: string;
44
+ items: string[];
45
+ minItems: number;
46
+ allowUnsupportedBlock: boolean;
47
+ };
48
+ };
49
+ };
50
+ export default _default;
@@ -0,0 +1,10 @@
1
+ declare const _default: (string | {
2
+ props: {
3
+ marks: {
4
+ type: string;
5
+ items: string[][];
6
+ optional: boolean;
7
+ };
8
+ };
9
+ })[];
10
+ export default _default;
@@ -0,0 +1,22 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ attrs: {
8
+ props: {
9
+ size: {
10
+ type: string;
11
+ minimum: number;
12
+ maximum: number;
13
+ };
14
+ color: {
15
+ type: string;
16
+ pattern: string;
17
+ };
18
+ };
19
+ };
20
+ };
21
+ };
22
+ export default _default;
@@ -0,0 +1,17 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ attrs: {
8
+ props: {
9
+ mode: {
10
+ type: string;
11
+ values: string[];
12
+ };
13
+ };
14
+ };
15
+ };
16
+ };
17
+ export default _default;
@@ -0,0 +1,14 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ content: {
8
+ type: string;
9
+ items: string[];
10
+ minItems: number;
11
+ };
12
+ };
13
+ };
14
+ export default _default;
@@ -0,0 +1,14 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ content: {
8
+ type: string;
9
+ items: string[][];
10
+ minItems: number;
11
+ };
12
+ };
13
+ };
14
+ export default _default;
@@ -0,0 +1,9 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ };
8
+ };
9
+ export default _default;
@@ -0,0 +1,38 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ content: {
8
+ type: string;
9
+ items: (string | {
10
+ props: {
11
+ marks: {
12
+ type: string;
13
+ items: never[];
14
+ maxItems: number;
15
+ optional: boolean;
16
+ };
17
+ };
18
+ })[][];
19
+ allowUnsupportedInline: boolean;
20
+ optional: boolean;
21
+ };
22
+ marks: {
23
+ type: string;
24
+ items: never[];
25
+ optional: boolean;
26
+ };
27
+ attrs: {
28
+ props: {
29
+ language: {
30
+ type: string;
31
+ optional: boolean;
32
+ };
33
+ };
34
+ optional: boolean;
35
+ };
36
+ };
37
+ };
38
+ export default _default;
@@ -0,0 +1,10 @@
1
+ declare const _default: (string | {
2
+ props: {
3
+ marks: {
4
+ type: string;
5
+ items: string[];
6
+ optional: boolean;
7
+ };
8
+ };
9
+ })[];
10
+ export default _default;
@@ -0,0 +1,11 @@
1
+ declare const _default: (string | {
2
+ props: {
3
+ marks: {
4
+ type: string;
5
+ items: never[];
6
+ maxItems: number;
7
+ optional: boolean;
8
+ };
9
+ };
10
+ })[];
11
+ export default _default;
@@ -0,0 +1,10 @@
1
+ declare const _default: (string | {
2
+ props: {
3
+ marks: {
4
+ type: string;
5
+ items: string[][];
6
+ optional: boolean;
7
+ };
8
+ };
9
+ })[];
10
+ export default _default;
@@ -0,0 +1,20 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ attrs: {
8
+ props: {
9
+ sources: {
10
+ type: string;
11
+ items: {
12
+ type: string;
13
+ }[];
14
+ minItems: number;
15
+ };
16
+ };
17
+ };
18
+ };
19
+ };
20
+ export default _default;
@@ -0,0 +1,17 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ attrs: {
8
+ props: {
9
+ timestamp: {
10
+ type: string;
11
+ minLength: number;
12
+ };
13
+ };
14
+ };
15
+ };
16
+ };
17
+ export default _default;
@@ -0,0 +1,25 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ content: {
8
+ type: string;
9
+ items: string[];
10
+ allowUnsupportedInline: boolean;
11
+ optional: boolean;
12
+ };
13
+ attrs: {
14
+ props: {
15
+ localId: {
16
+ type: string;
17
+ };
18
+ state: {
19
+ type: string;
20
+ };
21
+ };
22
+ };
23
+ };
24
+ };
25
+ export default _default;
@@ -0,0 +1,22 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ content: {
8
+ type: string;
9
+ items: string[];
10
+ minItems: number;
11
+ allowUnsupportedBlock: boolean;
12
+ };
13
+ attrs: {
14
+ props: {
15
+ localId: {
16
+ type: string;
17
+ };
18
+ };
19
+ };
20
+ };
21
+ };
22
+ export default _default;
@@ -0,0 +1,18 @@
1
+ declare const _default: {
2
+ props: {
3
+ version: {
4
+ type: string;
5
+ values: number[];
6
+ };
7
+ type: {
8
+ type: string;
9
+ values: string[];
10
+ };
11
+ content: {
12
+ type: string;
13
+ items: string[][];
14
+ allowUnsupportedBlock: boolean;
15
+ };
16
+ };
17
+ };
18
+ export default _default;