-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
102 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// import type {Content} from '@enonic-types/lib-content'; | ||
import type {Content} from '@enonic-types/lib-content'; | ||
|
||
import {APP_NAME_PATH, MIXIN_PATH} from '/lib/common/constants'; | ||
|
||
|
||
export const getBlockRobots = (content): boolean => content.x[APP_NAME_PATH] | ||
&& content.x[APP_NAME_PATH][MIXIN_PATH] | ||
&& content.x[APP_NAME_PATH][MIXIN_PATH].blockRobots; | ||
export const getBlockRobots = (content: Content): boolean => !!content.x?.[APP_NAME_PATH]?.[MIXIN_PATH]?.blockRobots; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import type {Content} from '@enonic-types/lib-content'; | ||
|
||
|
||
import {get as getContentByKey} from '/lib/xp/content'; | ||
import {APP_NAME_PATH, MIXIN_PATH} from '/lib/common/constants'; | ||
|
||
|
||
export const getContentForCanonicalUrl = (content) => content.x[APP_NAME_PATH] | ||
&& content.x[APP_NAME_PATH][MIXIN_PATH] | ||
&& content.x[APP_NAME_PATH][MIXIN_PATH].seoContentForCanonicalUrl | ||
export const getContentForCanonicalUrl = (content: Content): Content => | ||
content.x?.[APP_NAME_PATH]?.[MIXIN_PATH]?.seoContentForCanonicalUrl | ||
&& getContentByKey({ | ||
key: content.x[APP_NAME_PATH][MIXIN_PATH].seoContentForCanonicalUrl | ||
key: content.x[APP_NAME_PATH][MIXIN_PATH].seoContentForCanonicalUrl as string | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export declare type Request< | ||
T extends Record<string, string> = { | ||
body?: string | ||
contextPath?: string | ||
cookies?: Record<string, string> | ||
headers?: Record<string, string> | ||
params?: Record<string, string> | ||
pathParams?: Record<string, string> | ||
rawPath?: string | ||
remoteAddress?: string | ||
// webSocket?: unknown | ||
} | ||
> = { | ||
branch: 'draft'|'master' | ||
host: string | ||
method: 'GET'|'POST'|'HEAD'|'PUT'|'DELETE'|'PATCH' | ||
mode: 'edit'|'inline'|'live'|'preview' | ||
path: string | ||
port: string|number | ||
scheme: string | ||
url: string | ||
} & T; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// https://developer.enonic.com/docs/xp/stable/framework/http#http-response | ||
export declare interface ComplexCookie { | ||
value: string // Value (required) The value to store in the cookie. This example will create a cookie looking like this complex: value. | ||
path?: string // The paths on the site where this cookie should be available from (and all containing paths). Defaults to empty | ||
domain?: string // Add additional sites that should be able to read the cookie. Defaults to empty (Only the server that creates the cookie can read it.) | ||
comment?: string // A comment describing the cookie. Default to `null. Deprecated and will be removed in future versions of XP. | ||
maxAge?: number // Number of seconds before the browser is allowed to delete the cookie. Defaults to -1 (The cookie will live until the browser is shut down.) | ||
secure?: boolean // Control if the cookie should only be accepted to be created and read over https and similar secure protocols. Defaults to false | ||
httpOnly?: boolean // Control if the cookie is available for scripts or not. If true, only the serverside code can read the cookie. Defaults to false (Also client-side scripts can read the cookie.) | ||
sameSite?: string // XP 7.3.0 SameSite flag for the cookie. Can be lax, strict, none or for "not set". Default is "not set", meaning "browser’s default". | ||
} | ||
|
||
export declare interface PageContributions { | ||
headBegin?: string[] | ||
headEnd?: string[] | ||
bodyBegin?: string[] | ||
bodyEnd?: string[] | ||
} | ||
|
||
export declare interface Response { | ||
applyFilters?: boolean | ||
body: string|null // Body of the response as string. Null if the response content-type is not of type text. | ||
bodyStream?: unknown | ||
contentType?: string | ||
cookies?: Record<string,string|ComplexCookie> | ||
headers?: Record<string,string> | ||
message?: string | ||
pageContributions?: PageContributions | ||
postProcess?: boolean | ||
redirect?: string | ||
status?: number | ||
webSocket?: { | ||
data: Record<string, unknown> | ||
subProtocols?: string[] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters