enonic-types
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -32,3 +32,8 @@ /** | ||
*/ | ||
findUsers<A>(params: FindUsersParams): UserQueryResult<A>; | ||
findUsers<A>(params: FindUsersParams & { | ||
includeProfile: true; | ||
}): UserQueryResult<UserWithProfile<A>>; | ||
findUsers(params: FindUsersParams & { | ||
includeProfile?: false; | ||
}): UserQueryResult<User>; | ||
/** | ||
@@ -142,4 +147,4 @@ * Retrieves the user specified and updates it with the changes applied through the editor. | ||
} | ||
export interface WithProfile<A> { | ||
readonly profile?: A; | ||
export interface UserWithProfile<A> extends User { | ||
readonly profile: A; | ||
} | ||
@@ -170,3 +175,2 @@ export interface Role extends Principal { | ||
readonly sort?: string; | ||
readonly includeProfile?: boolean; | ||
} | ||
@@ -176,3 +180,3 @@ export interface UserQueryResult<A> { | ||
readonly count: number; | ||
readonly hits: ReadonlyArray<User & WithProfile<A>>; | ||
readonly hits: ReadonlyArray<A>; | ||
} | ||
@@ -179,0 +183,0 @@ export interface ModifyUserParams { |
@@ -310,3 +310,3 @@ import { Region } from "./portal"; | ||
readonly data: { | ||
readonly siteConfig: SiteConfig<A>; | ||
readonly siteConfig: SiteConfig<A> | ReadonlyArray<SiteConfig<A>>; | ||
}; | ||
@@ -313,0 +313,0 @@ readonly x: Record<string, Record<string, XData>>; |
{ | ||
"name": "enonic-types", | ||
"sideEffects": false, | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "TypeScript types for Enonic XP", | ||
@@ -27,8 +27,8 @@ "typings": "index.d.ts", | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^4.6.0", | ||
"@typescript-eslint/parser": "^4.6.0", | ||
"eslint": "^7.12.1", | ||
"@typescript-eslint/eslint-plugin": "^4.8.2", | ||
"@typescript-eslint/parser": "^4.8.2", | ||
"eslint": "^7.14.0", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^4.0.5" | ||
"typescript": "^4.1.2" | ||
} | ||
} |
@@ -30,4 +30,15 @@ import { ByteSource, Content, Site } from "./content"; | ||
export interface PortalLibrary { | ||
getComponent<A>(): Component<A> | null; | ||
getContent<A extends object, PageConfig extends object = never>(): Content<A, PageConfig> | null; | ||
/** | ||
* This function returns the component corresponding to the current execution context. It is meant to be called | ||
* from a layout or part controller. | ||
*/ | ||
getComponent<A>(): Component<A>; | ||
/** | ||
* his function returns the content corresponding to the current execution context. It is meant to be called from a | ||
* page, layout or part controller | ||
*/ | ||
getContent<A extends object, PageConfig extends object = never>(): Content<A, PageConfig>; | ||
/** | ||
* This function returns the id provider key corresponding to the current execution context. | ||
*/ | ||
getIdProviderKey(): string | null; | ||
@@ -50,16 +61,68 @@ /** | ||
getMultipartText(name: string, index?: number): string | undefined; | ||
/** | ||
* This function returns the parent site of the content corresponding to the current execution context. It is meant | ||
* to be called from a page, layout or part controller. | ||
*/ | ||
getSite<A extends object>(): Site<A>; | ||
/** | ||
* This function returns the site configuration for this app in the parent site of the content corresponding to the | ||
* current execution context. It is meant to be called from a page, layout or part controller. | ||
*/ | ||
getSiteConfig<A>(): A; | ||
/** | ||
* This function generates a URL pointing to an ID provider. | ||
*/ | ||
idProviderUrl(params: IdProviderUrlParams): string; | ||
/** | ||
* This function generates a URL to an image placeholder. | ||
*/ | ||
imagePlaceholder(params: ImagePlaceHolderParams): string; | ||
/** | ||
* This function generates a URL pointing to a static file. | ||
*/ | ||
assetUrl(params: AssetUrlParams): string; | ||
/** | ||
* This function generates a URL pointing to an attachment. | ||
*/ | ||
attachmentUrl(params: AttachmentUrlParams): string; | ||
/** | ||
* This function generates a URL pointing to a component. | ||
*/ | ||
componentUrl(params: ComponentUrlParams): string; | ||
/** | ||
* This function generates a URL pointing to a service. | ||
*/ | ||
serviceUrl(params: ServiceUrlParams): string; | ||
/** | ||
* This function generates a URL pointing to an image. | ||
*/ | ||
imageUrl(params: ImageUrlParams): string; | ||
/** | ||
* This function generates a URL pointing to the login function of an ID provider. | ||
*/ | ||
loginUrl(params: LoginUrlParams): string; | ||
/** | ||
* This function generates a URL pointing to the logout function of the application corresponding to the current user. | ||
*/ | ||
logoutUrl(params: LogoutUrlParams): string; | ||
/** | ||
* This function generates a URL pointing to a page. | ||
*/ | ||
pageUrl(params: PageUrlParams): string; | ||
/** | ||
* This function generates a URL. | ||
*/ | ||
url(params: UrlParams): string; | ||
/** | ||
* This function replaces abstract internal links contained in an HTML text by generated URLs. | ||
* | ||
* When outputting processed HTML in Thymeleaf, use attribute `data-th-utext="${processedHtml}"`. | ||
*/ | ||
processHtml(params: ProcessHtmlParams): string; | ||
/** | ||
* This function sanitizes an HTML string by stripping all potentially unsafe tags and attributes. | ||
* | ||
* HTML sanitization can be used to protect against cross-site scripting (XSS) attacks by sanitizing any HTML code | ||
* submitted by a user. | ||
*/ | ||
sanitizeHtml(html: string): string; | ||
@@ -66,0 +129,0 @@ } |
71037
2062