@enonic-types/core 8.0.0-A3 → 8.0.0-B1

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 (2) hide show
  1. package/index.d.ts +22 -8
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -404,6 +404,18 @@ export interface WebSocketEvent<T> {
404
404
 
405
405
  type WebSocketEventHandler<T = Record<string, unknown>> = (event: WebSocketEvent<T>) => void;
406
406
 
407
+ export type SseEventType = 'open' | 'close' | 'timeout' | 'error';
408
+
409
+ export interface SseEvent<T = Record<string, unknown>> {
410
+ type: SseEventType;
411
+ clientId: string;
412
+ lastEventId?: string;
413
+ attributes?: T;
414
+ error?: string;
415
+ }
416
+
417
+ type SseEventHandler<T = Record<string, unknown>> = (event: SseEvent<T>) => void;
418
+
407
419
  export interface Controller<
408
420
  Request extends RequestInterface = DefaultRequest,
409
421
  Response extends ResponseInterface = DefaultResponse,
@@ -419,6 +431,7 @@ export interface Controller<
419
431
  put?: RequestHandler<Request, Response>;
420
432
  trace?: RequestHandler<Request, Response>;
421
433
  webSocketEvent?: WebSocketEventHandler;
434
+ sseEvent?: SseEventHandler;
422
435
  }
423
436
 
424
437
  export interface ErrorRequest<T extends RequestInterface = DefaultRequest> {
@@ -562,19 +575,19 @@ export interface AttachmentValidationError
562
575
  attachment: string;
563
576
  }
564
577
 
565
- export interface ValidationError {
566
- message: string;
567
- i18n: string;
568
- errorCode: ValidationErrorCode;
569
- /* eslint-disable @typescript-eslint/no-explicit-any*/
570
- args: any[];
571
- }
572
-
573
578
  export interface ValidationErrorCode {
574
579
  applicationKey: string;
575
580
  code: string;
576
581
  }
577
582
 
583
+ export interface ValidationError {
584
+ message: string | null;
585
+ i18n: string | null;
586
+ errorCode: ValidationErrorCode;
587
+ /* eslint-disable @typescript-eslint/no-explicit-any*/
588
+ args?: any[];
589
+ }
590
+
578
591
  export interface PublishInfo {
579
592
  from?: string;
580
593
  to?: string;
@@ -717,6 +730,7 @@ export interface Content<
717
730
  hasChildren: boolean;
718
731
  language?: string;
719
732
  valid: boolean;
733
+ validationErrors?: ValidationError[];
720
734
  originProject?: string;
721
735
  childOrder?: string;
722
736
  _sort?: object[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enonic-types/core",
3
- "version": "8.0.0-A3",
3
+ "version": "8.0.0-B1",
4
4
  "description": "Shared type definition for core libraries.",
5
5
  "types": "index.d.ts",
6
6
  "files": [