@atlaskit/adf-utils 19.21.0 → 19.21.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 (82) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/afm-cc/tsconfig.json +2 -2
  3. package/afm-passionfruit/tsconfig.json +26 -0
  4. package/afm-volt/tsconfig.json +7 -1
  5. package/builders/package.json +1 -1
  6. package/dist/cjs/scrub/scrub-content.js +7 -1
  7. package/dist/es2019/scrub/scrub-content.js +7 -1
  8. package/dist/esm/scrub/scrub-content.js +7 -1
  9. package/dist/types/builders/marks/breakout.d.ts +1 -1
  10. package/dist/types/builders/marks/data-consumer.d.ts +1 -1
  11. package/dist/types/builders/marks/fragment.d.ts +1 -1
  12. package/dist/types/builders/nodes/block-task-item.d.ts +1 -1
  13. package/dist/types/builders/nodes/bodied-extension.d.ts +1 -1
  14. package/dist/types/builders/nodes/caption.d.ts +1 -1
  15. package/dist/types/builders/nodes/code-block.d.ts +1 -1
  16. package/dist/types/builders/nodes/date.d.ts +1 -1
  17. package/dist/types/builders/nodes/decision-item.d.ts +1 -1
  18. package/dist/types/builders/nodes/decision-list.d.ts +1 -1
  19. package/dist/types/builders/nodes/expand.d.ts +1 -1
  20. package/dist/types/builders/nodes/extension.d.ts +1 -1
  21. package/dist/types/builders/nodes/hard-break.d.ts +1 -1
  22. package/dist/types/builders/nodes/heading.d.ts +1 -1
  23. package/dist/types/builders/nodes/inline-extension.d.ts +1 -1
  24. package/dist/types/builders/nodes/multi-bodied-extension.d.ts +1 -1
  25. package/dist/types/builders/nodes/nested-expand.d.ts +1 -1
  26. package/dist/types/builders/nodes/ordered-list.d.ts +1 -1
  27. package/dist/types/builders/nodes/panel.d.ts +1 -1
  28. package/dist/types/builders/nodes/placeholder.d.ts +1 -1
  29. package/dist/types/builders/nodes/status.d.ts +1 -1
  30. package/dist/types/builders/nodes/table-cell.d.ts +1 -1
  31. package/dist/types/builders/nodes/table-header.d.ts +1 -1
  32. package/dist/types/builders/nodes/task-item.d.ts +1 -1
  33. package/dist/types/builders/nodes/task-list.d.ts +1 -1
  34. package/dist/types/builders/types.d.ts +2 -2
  35. package/dist/types/scrub/scrub-content.d.ts +2 -2
  36. package/dist/types/transforms/dedupe-marks-transform.d.ts +2 -2
  37. package/dist/types/transforms/indentation-marks-transform.d.ts +1 -1
  38. package/dist/types/transforms/nested-table-transform.d.ts +2 -2
  39. package/dist/types/transforms/nodes-missing-content-transform.d.ts +1 -1
  40. package/dist/types/types/index.d.ts +3 -3
  41. package/dist/types/types/validatorTypes.d.ts +52 -52
  42. package/dist/types-ts4.5/builders/marks/breakout.d.ts +1 -1
  43. package/dist/types-ts4.5/builders/marks/data-consumer.d.ts +1 -1
  44. package/dist/types-ts4.5/builders/marks/fragment.d.ts +1 -1
  45. package/dist/types-ts4.5/builders/nodes/block-task-item.d.ts +1 -1
  46. package/dist/types-ts4.5/builders/nodes/bodied-extension.d.ts +1 -1
  47. package/dist/types-ts4.5/builders/nodes/caption.d.ts +1 -1
  48. package/dist/types-ts4.5/builders/nodes/code-block.d.ts +1 -1
  49. package/dist/types-ts4.5/builders/nodes/date.d.ts +1 -1
  50. package/dist/types-ts4.5/builders/nodes/decision-item.d.ts +1 -1
  51. package/dist/types-ts4.5/builders/nodes/decision-list.d.ts +1 -1
  52. package/dist/types-ts4.5/builders/nodes/expand.d.ts +1 -1
  53. package/dist/types-ts4.5/builders/nodes/extension.d.ts +1 -1
  54. package/dist/types-ts4.5/builders/nodes/hard-break.d.ts +1 -1
  55. package/dist/types-ts4.5/builders/nodes/heading.d.ts +1 -1
  56. package/dist/types-ts4.5/builders/nodes/inline-extension.d.ts +1 -1
  57. package/dist/types-ts4.5/builders/nodes/multi-bodied-extension.d.ts +1 -1
  58. package/dist/types-ts4.5/builders/nodes/nested-expand.d.ts +1 -1
  59. package/dist/types-ts4.5/builders/nodes/ordered-list.d.ts +1 -1
  60. package/dist/types-ts4.5/builders/nodes/panel.d.ts +1 -1
  61. package/dist/types-ts4.5/builders/nodes/placeholder.d.ts +1 -1
  62. package/dist/types-ts4.5/builders/nodes/status.d.ts +1 -1
  63. package/dist/types-ts4.5/builders/nodes/table-cell.d.ts +1 -1
  64. package/dist/types-ts4.5/builders/nodes/table-header.d.ts +1 -1
  65. package/dist/types-ts4.5/builders/nodes/task-item.d.ts +1 -1
  66. package/dist/types-ts4.5/builders/nodes/task-list.d.ts +1 -1
  67. package/dist/types-ts4.5/builders/types.d.ts +2 -2
  68. package/dist/types-ts4.5/scrub/scrub-content.d.ts +2 -2
  69. package/dist/types-ts4.5/transforms/dedupe-marks-transform.d.ts +2 -2
  70. package/dist/types-ts4.5/transforms/indentation-marks-transform.d.ts +1 -1
  71. package/dist/types-ts4.5/transforms/nested-table-transform.d.ts +2 -2
  72. package/dist/types-ts4.5/transforms/nodes-missing-content-transform.d.ts +1 -1
  73. package/dist/types-ts4.5/types/index.d.ts +3 -3
  74. package/dist/types-ts4.5/types/validatorTypes.d.ts +52 -52
  75. package/empty-adf/package.json +1 -1
  76. package/package.json +2 -2
  77. package/scrub/package.json +1 -1
  78. package/transforms/package.json +1 -1
  79. package/traverse/package.json +1 -1
  80. package/types/package.json +1 -1
  81. package/validator/package.json +1 -1
  82. package/validatorTypes/package.json +1 -1
@@ -1,105 +1,95 @@
1
1
  import type { ADFEntity, ADFEntityMark } from '../types';
2
2
  export interface MarkValidationResult {
3
- valid: boolean;
4
- originalMark: ADFEntityMark;
5
- newMark?: ADFEntityMark;
6
3
  errorCode?: ValidationError['code'];
7
4
  message?: string;
5
+ newMark?: ADFEntityMark;
6
+ originalMark: ADFEntityMark;
7
+ valid: boolean;
8
8
  }
9
9
  export interface Output {
10
- valid: boolean;
11
10
  entity?: ADFEntity;
11
+ valid: boolean;
12
12
  }
13
13
  export interface NodeValidationResult {
14
- valid: boolean;
15
14
  entity?: ADFEntity;
16
15
  marksValidationOutput?: MarkValidationResult[];
16
+ valid: boolean;
17
17
  }
18
18
  export interface ValidatorContent {
19
- type: 'array';
20
- items: Array<string | Array<string>>;
21
- minItems?: number;
22
- maxItems?: number;
23
- optional?: boolean;
24
19
  allowUnsupportedBlock: boolean;
25
20
  allowUnsupportedInline: boolean;
26
21
  isTupleLike?: boolean;
22
+ items: Array<string | Array<string>>;
23
+ maxItems?: number;
24
+ minItems?: number;
25
+ optional?: boolean;
26
+ type: 'array';
27
27
  }
28
28
  export type AttributesSpec = {
29
- type: 'number';
30
- optional?: boolean;
31
- minimum: number;
32
29
  maximum: number;
33
- } | {
34
- type: 'integer';
35
- optional?: boolean;
36
30
  minimum: number;
37
- maximum: number;
31
+ optional?: boolean;
32
+ type: 'number';
38
33
  } | {
39
- type: 'boolean';
34
+ maximum: number;
35
+ minimum: number;
40
36
  optional?: boolean;
37
+ type: 'integer';
41
38
  } | {
42
- type: 'string';
43
39
  optional?: boolean;
40
+ type: 'boolean';
41
+ } | {
44
42
  minLength?: number;
43
+ optional?: boolean;
45
44
  pattern?: RegExp;
45
+ type: 'string';
46
46
  validatorFn?: string;
47
47
  } | {
48
+ optional?: boolean;
48
49
  type: 'enum';
49
50
  values: Array<string>;
50
- optional?: boolean;
51
51
  } | {
52
- type: 'object';
53
52
  optional?: boolean;
53
+ type: 'object';
54
54
  } | {
55
- type: 'array';
55
+ isTupleLike?: boolean;
56
56
  items: Array<AttributesSpec>;
57
- optional?: boolean;
58
- minItems?: number;
59
57
  maxItems?: number;
60
- isTupleLike?: boolean;
58
+ minItems?: number;
59
+ optional?: boolean;
60
+ type: 'array';
61
61
  } | ValidatorSpecAttrs;
62
62
  export interface ValidatorSpecAttrs {
63
+ optional?: boolean;
63
64
  props: {
64
65
  [key: string]: AttributesSpec;
65
66
  };
66
- optional?: boolean;
67
67
  }
68
68
  export interface ValidatorSpec {
69
+ maxItems?: number;
70
+ minItems?: number;
69
71
  props?: {
70
- type?: {
71
- type: 'enum';
72
- values: Array<string>;
73
- };
74
72
  attrs?: ValidatorSpecAttrs;
75
73
  content?: ValidatorContent;
76
- text?: AttributesSpec;
77
74
  marks?: {
78
- type: 'array';
79
75
  items: Array<Array<string>>;
80
76
  maxItems?: number;
81
77
  optional?: boolean;
78
+ type: 'array';
79
+ };
80
+ text?: AttributesSpec;
81
+ type?: {
82
+ type: 'enum';
83
+ values: Array<string>;
82
84
  };
83
85
  };
84
- minItems?: number;
85
- maxItems?: number;
86
86
  required?: Array<string>;
87
87
  }
88
88
  export interface ValidationErrorMap {
89
- MISSING_PROPERTIES: {
90
- props: Array<string>;
91
- };
92
- REDUNDANT_PROPERTIES: {
93
- props: Array<string>;
94
- };
95
- REDUNDANT_ATTRIBUTES: {
89
+ DEPRECATED: never;
90
+ INVALID_ATTRIBUTES: {
96
91
  attrs: Array<string>;
97
92
  };
98
- REDUNDANT_MARKS: {
99
- marks: Array<string>;
100
- };
101
- INVALID_TYPE: never;
102
- INVALID_TEXT: never;
103
93
  INVALID_CONTENT: {
104
94
  parentType?: string;
105
95
  };
@@ -108,13 +98,23 @@ export interface ValidationErrorMap {
108
98
  requiredLength: number;
109
99
  type: RequiredContentLength;
110
100
  };
111
- INVALID_ATTRIBUTES: {
101
+ INVALID_TEXT: never;
102
+ INVALID_TYPE: never;
103
+ MISSING_PROPERTIES: {
104
+ props: Array<string>;
105
+ };
106
+ REDUNDANT_ATTRIBUTES: {
112
107
  attrs: Array<string>;
113
108
  };
109
+ REDUNDANT_MARKS: {
110
+ marks: Array<string>;
111
+ };
112
+ REDUNDANT_PROPERTIES: {
113
+ props: Array<string>;
114
+ };
114
115
  UNSUPPORTED_ATTRIBUTES: {
115
116
  attrs: Array<string>;
116
117
  };
117
- DEPRECATED: never;
118
118
  }
119
119
  export type RequiredContentLength = 'minimum' | 'maximum';
120
120
  export type Content = Array<string | [string, object] | Array<string>>;
@@ -127,8 +127,8 @@ export interface ValidationError {
127
127
  export type ErrorCallback = (entity: ADFEntity, error: ValidationError, options: ErrorCallbackOptions) => ADFEntity | undefined;
128
128
  export type ValidationMode = 'strict' | 'loose';
129
129
  export interface ValidationOptions {
130
- mode?: ValidationMode;
131
130
  allowPrivateAttributes?: boolean;
131
+ mode?: ValidationMode;
132
132
  }
133
133
  export interface SpecValidatorResult {
134
134
  hasValidated: boolean;
@@ -136,10 +136,10 @@ export interface SpecValidatorResult {
136
136
  }
137
137
  export type Err = <T extends ValidationErrorType>(code: T, msg: string, meta?: T extends keyof ValidationErrorMap ? ValidationErrorMap[T] : never) => NodeValidationResult;
138
138
  export interface ErrorCallbackOptions {
139
- isNodeAttribute?: boolean;
140
- isMark?: any;
139
+ allowNestedTables?: boolean;
141
140
  allowUnsupportedBlock?: boolean;
142
141
  allowUnsupportedInline?: boolean;
143
- allowNestedTables?: boolean;
142
+ isMark?: any;
143
+ isNodeAttribute?: boolean;
144
144
  }
145
145
  export type Validate = (entity: ADFEntity, errorCallback?: ErrorCallback, allowed?: Content, parentSpec?: ValidatorSpec) => Output;
@@ -1,3 +1,3 @@
1
1
  import { type BreakoutMarkAttrs, type BreakoutMarkDefinition, type CodeBlockDefinition, type LayoutSectionDefinition } from '@atlaskit/adf-schema';
2
2
  import { type WithAppliedMark } from '../types';
3
- export declare const breakout: (attrs: BreakoutMarkAttrs) => (maybeNode: CodeBlockDefinition | LayoutSectionDefinition) => WithAppliedMark<CodeBlockDefinition | LayoutSectionDefinition, BreakoutMarkDefinition>;
3
+ export declare const breakout: (attrs: BreakoutMarkAttrs) => (maybeNode: CodeBlockDefinition | LayoutSectionDefinition) => WithAppliedMark<typeof maybeNode, BreakoutMarkDefinition>;
@@ -1,3 +1,3 @@
1
1
  import { type ExtensionDefinition, type BodiedExtensionDefinition, type InlineExtensionDefinition, type DataConsumerAttributes, type DataConsumerDefinition } from '@atlaskit/adf-schema';
2
2
  import { type WithAppliedMark } from '../types';
3
- export declare const dataConsumer: (attrs: DataConsumerAttributes) => (maybeNode: ExtensionDefinition | BodiedExtensionDefinition | InlineExtensionDefinition) => WithAppliedMark<ExtensionDefinition | BodiedExtensionDefinition | InlineExtensionDefinition, DataConsumerDefinition>;
3
+ export declare const dataConsumer: (attrs: DataConsumerAttributes) => (maybeNode: ExtensionDefinition | BodiedExtensionDefinition | InlineExtensionDefinition) => WithAppliedMark<typeof maybeNode, DataConsumerDefinition>;
@@ -1,3 +1,3 @@
1
1
  import { type ExtensionDefinition, type BodiedExtensionDefinition, type InlineExtensionDefinition, type TableDefinition, type FragmentAttributes, type FragmentDefinition } from '@atlaskit/adf-schema';
2
2
  import { type WithAppliedMark } from '../types';
3
- export declare const fragment: (attrs: FragmentAttributes) => (maybeNode: TableDefinition | ExtensionDefinition | BodiedExtensionDefinition | InlineExtensionDefinition) => WithAppliedMark<ExtensionDefinition | BodiedExtensionDefinition | InlineExtensionDefinition | TableDefinition, FragmentDefinition>;
3
+ export declare const fragment: (attrs: FragmentAttributes) => (maybeNode: TableDefinition | ExtensionDefinition | BodiedExtensionDefinition | InlineExtensionDefinition) => WithAppliedMark<typeof maybeNode, FragmentDefinition>;
@@ -1,2 +1,2 @@
1
1
  import { type BlockTaskItemDefinition, type ParagraphDefinition, type ExtensionDefinition } from '@atlaskit/adf-schema';
2
- export declare const blockTaskItem: (attrs: BlockTaskItemDefinition['attrs']) => (...content: Array<ParagraphDefinition | ExtensionDefinition>) => BlockTaskItemDefinition;
2
+ export declare const blockTaskItem: (attrs: BlockTaskItemDefinition["attrs"]) => (...content: Array<ParagraphDefinition | ExtensionDefinition>) => BlockTaskItemDefinition;
@@ -1,2 +1,2 @@
1
1
  import { type BodiedExtensionDefinition, type NonNestableBlockContent } from '@atlaskit/adf-schema';
2
- export declare const bodiedExtension: (attrs: BodiedExtensionDefinition['attrs']) => (...content: Array<NonNestableBlockContent>) => BodiedExtensionDefinition;
2
+ export declare const bodiedExtension: (attrs: BodiedExtensionDefinition["attrs"]) => (...content: Array<NonNestableBlockContent>) => BodiedExtensionDefinition;
@@ -1,2 +1,2 @@
1
1
  import { type CaptionDefinition } from '@atlaskit/adf-schema';
2
- export declare const caption: (...content: CaptionDefinition['content']) => CaptionDefinition;
2
+ export declare const caption: (...content: CaptionDefinition["content"]) => CaptionDefinition;
@@ -1,3 +1,3 @@
1
1
  import { type CodeBlockDefinition, type TextDefinition, type NoMark } from '@atlaskit/adf-schema';
2
2
  export type CodeBlockContent = TextDefinition & NoMark;
3
- export declare const codeBlock: (attrs: CodeBlockDefinition['attrs'] | undefined) => (...content: Array<CodeBlockContent>) => CodeBlockDefinition;
3
+ export declare const codeBlock: (attrs: CodeBlockDefinition["attrs"] | undefined) => (...content: Array<CodeBlockContent>) => CodeBlockDefinition;
@@ -1,2 +1,2 @@
1
1
  import { type DateDefinition } from '@atlaskit/adf-schema';
2
- export declare const date: (attrs?: DateDefinition['attrs']) => DateDefinition;
2
+ export declare const date: (attrs?: DateDefinition["attrs"]) => DateDefinition;
@@ -1,2 +1,2 @@
1
1
  import { type DecisionItemDefinition, type Inline } from '@atlaskit/adf-schema';
2
- export declare const decisionItem: (attrs: DecisionItemDefinition['attrs']) => (...content: Array<Inline>) => DecisionItemDefinition;
2
+ export declare const decisionItem: (attrs: DecisionItemDefinition["attrs"]) => (...content: Array<Inline>) => DecisionItemDefinition;
@@ -1,2 +1,2 @@
1
1
  import { type DecisionListDefinition, type DecisionItemDefinition } from '@atlaskit/adf-schema';
2
- export declare const decisionList: (attrs: DecisionListDefinition['attrs']) => (...content: Array<DecisionItemDefinition>) => DecisionListDefinition;
2
+ export declare const decisionList: (attrs: DecisionListDefinition["attrs"]) => (...content: Array<DecisionItemDefinition>) => DecisionListDefinition;
@@ -1,2 +1,2 @@
1
1
  import type { ExpandDefinition, NestedExpandDefinition, NonNestableBlockContent } from '@atlaskit/adf-schema';
2
- export declare const expand: (attrs: ExpandDefinition['attrs']) => (...content: Array<NonNestableBlockContent | NestedExpandDefinition>) => ExpandDefinition;
2
+ export declare const expand: (attrs: ExpandDefinition["attrs"]) => (...content: Array<NonNestableBlockContent | NestedExpandDefinition>) => ExpandDefinition;
@@ -1,2 +1,2 @@
1
1
  import { type ExtensionDefinition } from '@atlaskit/adf-schema';
2
- export declare const extension: (attrs: ExtensionDefinition['attrs']) => ExtensionDefinition;
2
+ export declare const extension: (attrs: ExtensionDefinition["attrs"]) => ExtensionDefinition;
@@ -1,2 +1,2 @@
1
1
  import { type HardBreakDefinition } from '@atlaskit/adf-schema';
2
- export declare const hardBreak: (attrs?: HardBreakDefinition['attrs']) => HardBreakDefinition;
2
+ export declare const hardBreak: (attrs?: HardBreakDefinition["attrs"]) => HardBreakDefinition;
@@ -1,2 +1,2 @@
1
1
  import { type Inline, type HeadingDefinition } from '@atlaskit/adf-schema';
2
- export declare const heading: (attrs: HeadingDefinition['attrs']) => (...content: Array<Inline>) => HeadingDefinition;
2
+ export declare const heading: (attrs: HeadingDefinition["attrs"]) => (...content: Array<Inline>) => HeadingDefinition;
@@ -1,2 +1,2 @@
1
1
  import { type InlineExtensionDefinition } from '@atlaskit/adf-schema';
2
- export declare const inlineExtension: (attrs: InlineExtensionDefinition['attrs']) => () => InlineExtensionDefinition;
2
+ export declare const inlineExtension: (attrs: InlineExtensionDefinition["attrs"]) => () => InlineExtensionDefinition;
@@ -1,2 +1,2 @@
1
1
  import type { ExtensionFrameDefinition, MultiBodiedExtensionDefinition } from '@atlaskit/adf-schema';
2
- export declare const bodiedExtension: (attrs: MultiBodiedExtensionDefinition['attrs']) => (...content: Array<ExtensionFrameDefinition>) => MultiBodiedExtensionDefinition;
2
+ export declare const bodiedExtension: (attrs: MultiBodiedExtensionDefinition["attrs"]) => (...content: Array<ExtensionFrameDefinition>) => MultiBodiedExtensionDefinition;
@@ -1,2 +1,2 @@
1
1
  import type { NestedExpandDefinition, NestedExpandContent } from '@atlaskit/adf-schema';
2
- export declare const nestedExpand: (attrs: NestedExpandDefinition['attrs']) => (...content: NestedExpandContent) => NestedExpandDefinition;
2
+ export declare const nestedExpand: (attrs: NestedExpandDefinition["attrs"]) => (...content: NestedExpandContent) => NestedExpandDefinition;
@@ -1,2 +1,2 @@
1
1
  import { type ListItemDefinition, type OrderedListDefinition } from '@atlaskit/adf-schema';
2
- export declare const orderedList: (attrs?: OrderedListDefinition['attrs']) => (...content: Array<ListItemDefinition>) => OrderedListDefinition;
2
+ export declare const orderedList: (attrs?: OrderedListDefinition["attrs"]) => (...content: Array<ListItemDefinition>) => OrderedListDefinition;
@@ -1,2 +1,2 @@
1
1
  import { type PanelDefinition, type PanelAttributes } from '@atlaskit/adf-schema';
2
- export declare const panel: (attrs: PanelAttributes) => (...content: PanelDefinition['content']) => PanelDefinition;
2
+ export declare const panel: (attrs: PanelAttributes) => (...content: PanelDefinition["content"]) => PanelDefinition;
@@ -1,2 +1,2 @@
1
1
  import { type PlaceholderDefinition } from '@atlaskit/adf-schema';
2
- export declare const placeholder: (attrs: PlaceholderDefinition['attrs']) => PlaceholderDefinition;
2
+ export declare const placeholder: (attrs: PlaceholderDefinition["attrs"]) => PlaceholderDefinition;
@@ -1,2 +1,2 @@
1
1
  import { type StatusDefinition } from '@atlaskit/adf-schema';
2
- export declare const status: (attrs?: StatusDefinition['attrs']) => StatusDefinition;
2
+ export declare const status: (attrs?: StatusDefinition["attrs"]) => StatusDefinition;
@@ -1,2 +1,2 @@
1
1
  import { type TableCellDefinition, type CellAttributes } from '@atlaskit/adf-schema';
2
- export declare const tableCell: (attrs?: CellAttributes) => (...content: TableCellDefinition['content']) => TableCellDefinition;
2
+ export declare const tableCell: (attrs?: CellAttributes) => (...content: TableCellDefinition["content"]) => TableCellDefinition;
@@ -1,2 +1,2 @@
1
1
  import { type TableHeaderDefinition, type CellAttributes } from '@atlaskit/adf-schema';
2
- export declare const tableHeader: (attrs?: CellAttributes) => (...content: TableHeaderDefinition['content']) => TableHeaderDefinition;
2
+ export declare const tableHeader: (attrs?: CellAttributes) => (...content: TableHeaderDefinition["content"]) => TableHeaderDefinition;
@@ -1,2 +1,2 @@
1
1
  import { type Inline, type TaskItemDefinition } from '@atlaskit/adf-schema';
2
- export declare const taskItem: (attrs: TaskItemDefinition['attrs']) => (...content: Array<Inline>) => TaskItemDefinition;
2
+ export declare const taskItem: (attrs: TaskItemDefinition["attrs"]) => (...content: Array<Inline>) => TaskItemDefinition;
@@ -1,2 +1,2 @@
1
1
  import { type TaskListDefinition, type TaskListContent } from '@atlaskit/adf-schema';
2
- export declare const taskList: (attrs: TaskListDefinition['attrs']) => (...content: TaskListContent) => TaskListDefinition;
2
+ export declare const taskList: (attrs: TaskListDefinition["attrs"]) => (...content: TaskListContent) => TaskListDefinition;
@@ -1,7 +1,7 @@
1
1
  export type WithMark = {
2
- type: any;
3
- marks?: Array<any>;
4
2
  [prop: string]: any;
3
+ marks?: Array<any>;
4
+ type: any;
5
5
  };
6
6
  export type WithAppliedMark<T, M> = T & {
7
7
  marks?: Array<M>;
@@ -3,9 +3,9 @@ export declare const scrubStr: (val: string, offset?: number) => string;
3
3
  export type ScrubLinkOptions = {
4
4
  valueReplacements: ValueReplacements;
5
5
  };
6
- export declare const scrubLink: (marks: {
6
+ export declare const scrubLink: (marks: Array<{
7
7
  [key: string]: any;
8
- }[], { valueReplacements }: ScrubLinkOptions) => {
8
+ }>, { valueReplacements }: ScrubLinkOptions) => {
9
9
  [key: string]: any;
10
10
  }[];
11
11
  export declare const scrubAttrs: (nodeType: string, attrs: unknown, offset?: number) => any;
@@ -1,8 +1,8 @@
1
1
  import { type ADFEntity, type ADFEntityMark } from '../types';
2
2
  interface TransformDedupeMarksResult {
3
- transformedAdf: ADFEntity;
4
- isTransformed: boolean;
5
3
  discardedMarks: ADFEntityMark[];
4
+ isTransformed: boolean;
5
+ transformedAdf: ADFEntity;
6
6
  }
7
7
  export declare const transformDedupeMarks: (adf: ADFEntity) => TransformDedupeMarksResult;
8
8
  export {};
@@ -1,7 +1,7 @@
1
1
  import { type ADFEntity } from '../types';
2
2
  interface TransformIndentationMarksResult {
3
- transformedAdf: ADFEntity;
4
3
  isTransformed: boolean;
4
+ transformedAdf: ADFEntity;
5
5
  }
6
6
  export declare const transformIndentationMarks: (adf: ADFEntity) => TransformIndentationMarksResult;
7
7
  export {};
@@ -1,10 +1,10 @@
1
1
  import type { ADFEntity } from '../types';
2
2
  export declare const isNestedTableExtension: (extensionNode: ADFEntity) => boolean;
3
3
  export declare const transformNestedTablesIncomingDocument: (adf: ADFEntity, options?: {
4
- environment?: 'renderer' | 'editor';
5
4
  disableNestedRendererTreatment?: boolean;
5
+ environment?: "renderer" | "editor";
6
6
  }) => {
7
- transformedAdf: ADFEntity;
8
7
  isTransformed: boolean;
8
+ transformedAdf: ADFEntity;
9
9
  };
10
10
  export declare const transformNestedTableNodeOutgoingDocument: (tableCellNode: ADFEntity) => ADFEntity;
@@ -1,7 +1,7 @@
1
1
  import { type ADFEntity } from '../types';
2
2
  interface TransformNodesMissingContentResult {
3
- transformedAdf: ADFEntity;
4
3
  isTransformed: boolean;
4
+ transformedAdf: ADFEntity;
5
5
  }
6
6
  export declare const transformNodesMissingContent: (adf: ADFEntity) => TransformNodesMissingContentResult;
7
7
  export {};
@@ -1,18 +1,18 @@
1
1
  export interface ADFEntityMark {
2
- type: string;
3
2
  attrs?: {
4
3
  [name: string]: any;
5
4
  };
5
+ type: string;
6
6
  }
7
7
  export interface ADFEntity {
8
- type: string;
8
+ [key: string]: any;
9
9
  attrs?: {
10
10
  [name: string]: any;
11
11
  };
12
12
  content?: Array<ADFEntity | undefined>;
13
13
  marks?: Array<ADFEntityMark>;
14
14
  text?: string;
15
- [key: string]: any;
15
+ type: string;
16
16
  }
17
17
  export type Visitor = (node: ADFEntity, parent: EntityParent, index: number, depth: number) => ADFEntity | false | undefined | void;
18
18
  export type VisitorCollection = {
@@ -1,105 +1,95 @@
1
1
  import type { ADFEntity, ADFEntityMark } from '../types';
2
2
  export interface MarkValidationResult {
3
- valid: boolean;
4
- originalMark: ADFEntityMark;
5
- newMark?: ADFEntityMark;
6
3
  errorCode?: ValidationError['code'];
7
4
  message?: string;
5
+ newMark?: ADFEntityMark;
6
+ originalMark: ADFEntityMark;
7
+ valid: boolean;
8
8
  }
9
9
  export interface Output {
10
- valid: boolean;
11
10
  entity?: ADFEntity;
11
+ valid: boolean;
12
12
  }
13
13
  export interface NodeValidationResult {
14
- valid: boolean;
15
14
  entity?: ADFEntity;
16
15
  marksValidationOutput?: MarkValidationResult[];
16
+ valid: boolean;
17
17
  }
18
18
  export interface ValidatorContent {
19
- type: 'array';
20
- items: Array<string | Array<string>>;
21
- minItems?: number;
22
- maxItems?: number;
23
- optional?: boolean;
24
19
  allowUnsupportedBlock: boolean;
25
20
  allowUnsupportedInline: boolean;
26
21
  isTupleLike?: boolean;
22
+ items: Array<string | Array<string>>;
23
+ maxItems?: number;
24
+ minItems?: number;
25
+ optional?: boolean;
26
+ type: 'array';
27
27
  }
28
28
  export type AttributesSpec = {
29
- type: 'number';
30
- optional?: boolean;
31
- minimum: number;
32
29
  maximum: number;
33
- } | {
34
- type: 'integer';
35
- optional?: boolean;
36
30
  minimum: number;
37
- maximum: number;
31
+ optional?: boolean;
32
+ type: 'number';
38
33
  } | {
39
- type: 'boolean';
34
+ maximum: number;
35
+ minimum: number;
40
36
  optional?: boolean;
37
+ type: 'integer';
41
38
  } | {
42
- type: 'string';
43
39
  optional?: boolean;
40
+ type: 'boolean';
41
+ } | {
44
42
  minLength?: number;
43
+ optional?: boolean;
45
44
  pattern?: RegExp;
45
+ type: 'string';
46
46
  validatorFn?: string;
47
47
  } | {
48
+ optional?: boolean;
48
49
  type: 'enum';
49
50
  values: Array<string>;
50
- optional?: boolean;
51
51
  } | {
52
- type: 'object';
53
52
  optional?: boolean;
53
+ type: 'object';
54
54
  } | {
55
- type: 'array';
55
+ isTupleLike?: boolean;
56
56
  items: Array<AttributesSpec>;
57
- optional?: boolean;
58
- minItems?: number;
59
57
  maxItems?: number;
60
- isTupleLike?: boolean;
58
+ minItems?: number;
59
+ optional?: boolean;
60
+ type: 'array';
61
61
  } | ValidatorSpecAttrs;
62
62
  export interface ValidatorSpecAttrs {
63
+ optional?: boolean;
63
64
  props: {
64
65
  [key: string]: AttributesSpec;
65
66
  };
66
- optional?: boolean;
67
67
  }
68
68
  export interface ValidatorSpec {
69
+ maxItems?: number;
70
+ minItems?: number;
69
71
  props?: {
70
- type?: {
71
- type: 'enum';
72
- values: Array<string>;
73
- };
74
72
  attrs?: ValidatorSpecAttrs;
75
73
  content?: ValidatorContent;
76
- text?: AttributesSpec;
77
74
  marks?: {
78
- type: 'array';
79
75
  items: Array<Array<string>>;
80
76
  maxItems?: number;
81
77
  optional?: boolean;
78
+ type: 'array';
79
+ };
80
+ text?: AttributesSpec;
81
+ type?: {
82
+ type: 'enum';
83
+ values: Array<string>;
82
84
  };
83
85
  };
84
- minItems?: number;
85
- maxItems?: number;
86
86
  required?: Array<string>;
87
87
  }
88
88
  export interface ValidationErrorMap {
89
- MISSING_PROPERTIES: {
90
- props: Array<string>;
91
- };
92
- REDUNDANT_PROPERTIES: {
93
- props: Array<string>;
94
- };
95
- REDUNDANT_ATTRIBUTES: {
89
+ DEPRECATED: never;
90
+ INVALID_ATTRIBUTES: {
96
91
  attrs: Array<string>;
97
92
  };
98
- REDUNDANT_MARKS: {
99
- marks: Array<string>;
100
- };
101
- INVALID_TYPE: never;
102
- INVALID_TEXT: never;
103
93
  INVALID_CONTENT: {
104
94
  parentType?: string;
105
95
  };
@@ -108,13 +98,23 @@ export interface ValidationErrorMap {
108
98
  requiredLength: number;
109
99
  type: RequiredContentLength;
110
100
  };
111
- INVALID_ATTRIBUTES: {
101
+ INVALID_TEXT: never;
102
+ INVALID_TYPE: never;
103
+ MISSING_PROPERTIES: {
104
+ props: Array<string>;
105
+ };
106
+ REDUNDANT_ATTRIBUTES: {
112
107
  attrs: Array<string>;
113
108
  };
109
+ REDUNDANT_MARKS: {
110
+ marks: Array<string>;
111
+ };
112
+ REDUNDANT_PROPERTIES: {
113
+ props: Array<string>;
114
+ };
114
115
  UNSUPPORTED_ATTRIBUTES: {
115
116
  attrs: Array<string>;
116
117
  };
117
- DEPRECATED: never;
118
118
  }
119
119
  export type RequiredContentLength = 'minimum' | 'maximum';
120
120
  export type Content = Array<string | [
@@ -130,8 +130,8 @@ export interface ValidationError {
130
130
  export type ErrorCallback = (entity: ADFEntity, error: ValidationError, options: ErrorCallbackOptions) => ADFEntity | undefined;
131
131
  export type ValidationMode = 'strict' | 'loose';
132
132
  export interface ValidationOptions {
133
- mode?: ValidationMode;
134
133
  allowPrivateAttributes?: boolean;
134
+ mode?: ValidationMode;
135
135
  }
136
136
  export interface SpecValidatorResult {
137
137
  hasValidated: boolean;
@@ -139,10 +139,10 @@ export interface SpecValidatorResult {
139
139
  }
140
140
  export type Err = <T extends ValidationErrorType>(code: T, msg: string, meta?: T extends keyof ValidationErrorMap ? ValidationErrorMap[T] : never) => NodeValidationResult;
141
141
  export interface ErrorCallbackOptions {
142
- isNodeAttribute?: boolean;
143
- isMark?: any;
142
+ allowNestedTables?: boolean;
144
143
  allowUnsupportedBlock?: boolean;
145
144
  allowUnsupportedInline?: boolean;
146
- allowNestedTables?: boolean;
145
+ isMark?: any;
146
+ isNodeAttribute?: boolean;
147
147
  }
148
148
  export type Validate = (entity: ADFEntity, errorCallback?: ErrorCallback, allowed?: Content, parentSpec?: ValidatorSpec) => Output;
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/empty-adf.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/empty-adf.d.ts"
12
12
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-utils",
3
- "version": "19.21.0",
3
+ "version": "19.21.2",
4
4
  "description": "Set of utilities to traverse, modify and create ADF documents.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -36,7 +36,7 @@
36
36
  "./validatorTypes": "./src/types/validatorTypes.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@atlaskit/adf-schema": "^50.2.0",
39
+ "@atlaskit/adf-schema": "^50.2.1",
40
40
  "@babel/runtime": "^7.0.0"
41
41
  },
42
42
  "devDependencies": {
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/scrub.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/scrub.d.ts"
12
12
  ]