@item-enonic-types/global
Advanced tools
Comparing version 7.11.0-B3 to 7.11.0-RC1
@@ -34,2 +34,65 @@ export interface Request { | ||
export interface WebSocketResponse<WebSocketData = {}> { | ||
webSocket: { | ||
data?: WebSocketData; | ||
subProtocols?: ReadonlyArray<string>; | ||
}; | ||
} | ||
export interface MacroContext<Params = never> { | ||
readonly name: string; | ||
readonly body: string; | ||
readonly params: Params; | ||
readonly document: string; | ||
readonly request: Request; | ||
} | ||
/** | ||
* Request object to be used with functions in "error.ts" | ||
*/ | ||
export interface ErrorRequest { | ||
readonly status: number; | ||
readonly message: string; | ||
readonly exception?: unknown; | ||
readonly request: Request; | ||
} | ||
/** | ||
* Predefined parameters that CustomSelector service always has | ||
*/ | ||
export interface CustomSelectorServiceRequestParams { | ||
readonly count: string; | ||
readonly start?: string; | ||
readonly ids?: string; | ||
readonly query?: string; | ||
readonly [key: string]: string | undefined; | ||
} | ||
export type CustomSelectorServiceRequest = Omit<Request, "params"> & { | ||
params: CustomSelectorServiceRequestParams; | ||
}; | ||
export interface CustomSelectorServiceResponseBody { | ||
total: number; | ||
count: number; | ||
hits: Array<CustomSelectorServiceResponseHit>; | ||
} | ||
/** | ||
* This Response can be used by a Service that provides data to a CustomSelector input field | ||
*/ | ||
export type CustomSelectorServiceResponse = Response<CustomSelectorServiceResponseBody>; | ||
export interface CustomSelectorServiceResponseHit { | ||
id: string; | ||
displayName: string; | ||
description?: string; | ||
iconUrl?: string; | ||
icon?: { | ||
data: string; | ||
type: string; | ||
}; | ||
} | ||
interface AbstractWebSocketEvent<WebSocketData = {}> { | ||
@@ -36,0 +99,0 @@ readonly session: { |
declare namespace XP { | ||
type Request = import("./controller").Request; | ||
type Response<ResponseBody> = import("./controller").Response<ResponseBody>; | ||
type Response<ResponseBody = unknown> = import("./controller").Response<ResponseBody>; | ||
@@ -10,16 +10,5 @@ type Controller = <ResponseBody = unknown>(req: Request) => Response<ResponseBody>; | ||
interface WebSocketResponse<WebSocketData = {}> { | ||
webSocket: { | ||
data?: WebSocketData; | ||
subProtocols?: ReadonlyArray<string>; | ||
}; | ||
} | ||
type WebSocketResponse<WebSocketData = {}> = import("./controller").WebSocketResponse<WebSocketData>; | ||
interface MacroContext<Params = never> { | ||
readonly name: string; | ||
readonly body: string; | ||
readonly params: Params; | ||
readonly document: string; | ||
readonly request: Request; | ||
} | ||
type MacroContext<Params = never> = import("./controller").MacroContext<Params>; | ||
@@ -37,8 +26,3 @@ /** | ||
*/ | ||
interface ErrorRequest { | ||
readonly status: number; | ||
readonly message: string; | ||
readonly exception?: unknown; | ||
readonly request: Request; | ||
} | ||
type ErrorRequest = import("./controller").ErrorRequest; | ||
@@ -48,23 +32,10 @@ /** | ||
*/ | ||
interface CustomSelectorServiceRequestParams { | ||
readonly count: string; | ||
readonly start?: string; | ||
readonly ids?: string; | ||
readonly query?: string; | ||
type CustomSelectorServiceRequestParams = import("./controller").CustomSelectorServiceRequestParams; | ||
readonly [key: string]: string | undefined; | ||
} | ||
/** | ||
* This Request can be used by a Service that provides data to a CustomSelector input field | ||
*/ | ||
type CustomSelectorServiceRequest = Omit<Request, "params"> & { | ||
params: CustomSelectorServiceRequestParams; | ||
}; | ||
type CustomSelectorServiceRequest = import("./controller").CustomSelectorServiceRequest; | ||
interface CustomSelectorServiceResponseBody { | ||
total: number; | ||
count: number; | ||
hits: Array<CustomSelectorServiceResponseHit>; | ||
} | ||
type CustomSelectorServiceResponseBody = import("./controller").CustomSelectorServiceResponseBody; | ||
@@ -74,14 +45,5 @@ /** | ||
*/ | ||
type CustomSelectorServiceResponse = Response<CustomSelectorServiceResponseBody>; | ||
type CustomSelectorServiceResponse = import("./controller").CustomSelectorServiceResponse; | ||
interface CustomSelectorServiceResponseHit { | ||
id: string; | ||
displayName: string; | ||
description?: string; | ||
iconUrl?: string; | ||
icon?: { | ||
data: string; | ||
type: string; | ||
}; | ||
} | ||
type CustomSelectorServiceResponseHit = import("./controller").CustomSelectorServiceResponseHit; | ||
} |
@@ -5,3 +5,3 @@ { | ||
"sideEffects": false, | ||
"version": "7.11.0-B3", | ||
"version": "7.11.0-RC1", | ||
"description": "Global variables and functions type definition.", | ||
@@ -8,0 +8,0 @@ "typings": "index.d.ts", |
# Global types for Enonic XP | ||
[![npm version](https://badge.fury.io/js/@item-enonic-types%2Fglobal.svg)](https://badge.fury.io/js/@item-enonic-types%2Fglobal) | ||
> **Note** There is also an [official package for Global types for XP](https://www.npmjs.com/package/@enonic-types/global). | ||
@@ -4,0 +6,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7774
161
44