@enonic-types/core 8.0.0-A2 → 8.0.0-A6

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 +33 -10
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -206,7 +206,7 @@ export type RequestBranch = 'draft' | 'master';
206
206
  export type RequestGetHeaderFunction = (headerName: string) => string | null;
207
207
  export type RequestMethod = 'GET' | 'POST' | ' HEAD' | 'OPTIONS' | ' PUT' | 'DELETE' | 'PATCH' | 'TRACE' | 'CONNECT';
208
208
  export type RequestMode = 'edit' | 'inline' | 'live' | 'preview' | 'admin';
209
- export type RequestParams = Record<string, string | string[]>;
209
+ export type RequestParams = Record<string, string | string[] | undefined>;
210
210
  export type RequestScheme = 'http' | 'https';
211
211
 
212
212
  export type RequestCookies = Record<string, string | undefined>;
@@ -295,6 +295,7 @@ export interface RequestConstructorParams {
295
295
  url: string;
296
296
  validTicket?: boolean;
297
297
  webSocket: boolean;
298
+ locales: string[];
298
299
  }
299
300
 
300
301
  export interface RequestInterface
@@ -341,7 +342,7 @@ export interface PageContributions {
341
342
  bodyEnd?: string[];
342
343
  }
343
344
 
344
- export type ResponseBody = unknown[] | Record<string, unknown> | boolean | number | string | null | ByteSource;
345
+ export type ResponseBody = unknown[] | object | boolean | number | string | null | ByteSource;
345
346
 
346
347
  export interface MappedResponse {
347
348
  applyFilters: boolean;
@@ -403,6 +404,18 @@ export interface WebSocketEvent<T> {
403
404
 
404
405
  type WebSocketEventHandler<T = Record<string, unknown>> = (event: WebSocketEvent<T>) => void;
405
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
+
406
419
  export interface Controller<
407
420
  Request extends RequestInterface = DefaultRequest,
408
421
  Response extends ResponseInterface = DefaultResponse,
@@ -418,6 +431,7 @@ export interface Controller<
418
431
  put?: RequestHandler<Request, Response>;
419
432
  trace?: RequestHandler<Request, Response>;
420
433
  webSocketEvent?: WebSocketEventHandler;
434
+ sseEvent?: SseEventHandler;
421
435
  }
422
436
 
423
437
  export interface ErrorRequest<T extends RequestInterface = DefaultRequest> {
@@ -512,6 +526,8 @@ export type RoleKey = `role:${string}`;
512
526
 
513
527
  export type PrincipalKey = UserKey | GroupKey | RoleKey;
514
528
 
529
+ export type PrincipalType = 'user' | 'group' | 'role';
530
+
515
531
  export interface User {
516
532
  type: 'user';
517
533
  key: UserKey;
@@ -559,19 +575,19 @@ export interface AttachmentValidationError
559
575
  attachment: string;
560
576
  }
561
577
 
562
- export interface ValidationError {
563
- message: string;
564
- i18n: string;
565
- errorCode: ValidationErrorCode;
566
- /* eslint-disable @typescript-eslint/no-explicit-any*/
567
- args: any[];
568
- }
569
-
570
578
  export interface ValidationErrorCode {
571
579
  applicationKey: string;
572
580
  code: string;
573
581
  }
574
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
+
575
591
  export interface PublishInfo {
576
592
  from?: string;
577
593
  to?: string;
@@ -714,6 +730,7 @@ export interface Content<
714
730
  hasChildren: boolean;
715
731
  language?: string;
716
732
  valid: boolean;
733
+ validationErrors?: ValidationError[];
717
734
  originProject?: string;
718
735
  childOrder?: string;
719
736
  _sort?: object[];
@@ -1276,3 +1293,9 @@ export interface FormItemFormFragment {
1276
1293
  }
1277
1294
 
1278
1295
  export type FormItem = FormItemSet | FormItemLayout | FormItemOptionSet | FormItemInput | FormItemFormFragment;
1296
+
1297
+ export type ConfigValue = string | number | boolean | ConfigObject | ConfigValue[];
1298
+
1299
+ export interface ConfigObject {
1300
+ [key: string]: ConfigValue
1301
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enonic-types/core",
3
- "version": "8.0.0-A2",
3
+ "version": "8.0.0-A6",
4
4
  "description": "Shared type definition for core libraries.",
5
5
  "types": "index.d.ts",
6
6
  "files": [