slackblock 2.0.0 → 3.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,11 +1,32 @@
1
- import { E as Element, S as SlackPostEphemeralPayload, a as SlackPostMessagePayload, B as BoltCompatiblePayload, C as Child, b as Block } from './types-DhAVIy-s.js';
2
- export { c as SerializedBlock, d as SerializedElement, e as SerializedOption, f as SlackMessageDraft } from './types-DhAVIy-s.js';
1
+ import { E as Element, S as SlackPostEphemeralPayload, a as SlackPostMessagePayload, B as BoltCompatiblePayload, C as Child, b as Block } from './types-DfyTK0D6.js';
2
+ export { c as SerializedBlock, d as SerializedElement, e as SerializedOption, f as SlackMessageDraft } from './types-DfyTK0D6.js';
3
3
  import '@slack/types';
4
4
 
5
+ type ValidationRule = 'required-field' | 'too-long' | 'too-many' | 'invalid-format' | 'invalid-value' | 'invalid-structure' | 'unsupported-prop' | 'unsupported-child';
6
+ type ValidationIssue = {
7
+ rule: ValidationRule;
8
+ subcode?: string;
9
+ message: string;
10
+ path: string;
11
+ component?: string;
12
+ field?: string;
13
+ };
14
+ declare class SlackblockValidationError extends Error {
15
+ readonly path: string;
16
+ readonly rule: ValidationRule;
17
+ readonly subcode?: string;
18
+ readonly component?: string;
19
+ readonly field?: string;
20
+ readonly issue: ValidationIssue;
21
+ constructor(issue: ValidationIssue);
22
+ }
23
+
5
24
  type ValidationMode = 'off' | 'warn' | 'strict';
25
+ type ValidationReporter = (issue: ValidationIssue) => void;
6
26
 
7
27
  type RenderOptions = {
8
28
  validate?: ValidationMode;
29
+ onValidation?: ValidationReporter;
9
30
  channel?: string;
10
31
  user?: string;
11
32
  };
@@ -19,14 +40,8 @@ declare function render(element: Element, options: RenderOptions & {
19
40
  }): SlackPostMessagePayload;
20
41
  declare function render(element: Element, options?: RenderOptions): BoltCompatiblePayload;
21
42
 
22
- declare class SlackblockValidationError extends Error {
23
- readonly path: string;
24
- readonly rule: string;
25
- constructor(message: string, path: string, rule: string);
26
- }
27
-
28
43
  declare const escapeMrkdwn: (text: string) => string;
29
44
 
30
45
  declare const blockKitBuilderUrl: (blocks: Block[]) => string;
31
46
 
32
- export { BoltCompatiblePayload, type RenderOptions, SlackPostEphemeralPayload, SlackPostMessagePayload, SlackblockValidationError, type ValidationMode, blockKitBuilderUrl, render as default, escapeMrkdwn, renderToBlocks, render as renderToMessage };
47
+ export { BoltCompatiblePayload, type RenderOptions, SlackPostEphemeralPayload, SlackPostMessagePayload, SlackblockValidationError, type ValidationIssue, type ValidationMode, type ValidationReporter, type ValidationRule, blockKitBuilderUrl, render as default, escapeMrkdwn, renderToBlocks, render as renderToMessage };