Comparing version 0.0.15 to 0.0.16
import { tryCatch } from "fp-ts/lib/Either"; | ||
import { fromNullable } from "fp-ts/lib/Option"; | ||
var auth = __non_webpack_require__('/lib/xp/auth'); | ||
var auth = __non_webpack_require__("/lib/xp/auth"); | ||
export function login(params) { | ||
@@ -5,0 +5,0 @@ return tryCatch(function () { return auth.login(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); |
@@ -33,3 +33,5 @@ export interface Request { | ||
contentType?: string; | ||
headers?: object; | ||
headers?: { | ||
[key: string]: string; | ||
}; | ||
cookies?: { | ||
@@ -36,0 +38,0 @@ [key: string]: string; |
@@ -1,2 +0,2 @@ | ||
import { Either } from 'fp-ts/lib/Either'; | ||
import { Either } from "fp-ts/lib/Either"; | ||
import { Error } from "./common"; | ||
@@ -14,6 +14,6 @@ export interface Content<T> { | ||
displayName: string; | ||
hasChildren: Boolean; | ||
hasChildren: boolean; | ||
language: string; | ||
valid: Boolean; | ||
childOrder: String; | ||
valid: boolean; | ||
childOrder: string; | ||
data: T; | ||
@@ -33,5 +33,5 @@ x: { | ||
} | ||
export declare type Attachments = { | ||
export interface Attachments { | ||
[key: string]: Attachment; | ||
}; | ||
} | ||
export interface QueryContentParams { | ||
@@ -93,3 +93,3 @@ start?: number; | ||
export interface UnpublishContentParams { | ||
keys: string[]; | ||
keys: Array<string>; | ||
} | ||
@@ -114,4 +114,4 @@ export interface GetChildrenParams { | ||
type: string; | ||
hasChildren: Boolean; | ||
valid: Boolean; | ||
hasChildren: boolean; | ||
valid: boolean; | ||
data: { | ||
@@ -141,3 +141,3 @@ siteConfig: SiteConfig<T>; | ||
key: string; | ||
name: string | string[]; | ||
name: string | Array<string>; | ||
} | ||
@@ -157,8 +157,8 @@ export interface CreateMediaParams { | ||
inheritsPermissions: boolean; | ||
permissions: PermissionsParams[]; | ||
permissions: Array<PermissionsParams>; | ||
} | ||
export interface PermissionsParams { | ||
principal: string; | ||
allow: string[]; | ||
deny: string[]; | ||
allow: Array<string>; | ||
deny: Array<string>; | ||
} | ||
@@ -169,3 +169,3 @@ export interface SetPermissionsParams { | ||
overwriteChildPermissions: boolean; | ||
permissions: PermissionsParams[]; | ||
permissions: Array<PermissionsParams>; | ||
} | ||
@@ -186,4 +186,4 @@ export interface IconType { | ||
"displayNameExpression": string; | ||
"icon": IconType[]; | ||
"form": any[]; | ||
"icon": Array<IconType>; | ||
"form": Array<any>; | ||
} | ||
@@ -196,3 +196,3 @@ export declare function get<T>(params: GetContentParams): Either<Error, Content<T>>; | ||
export declare function publish(params: PublishContentParams): Either<Error, PublishResponse>; | ||
export declare function unpublish(params: UnpublishContentParams): Either<Error, string[]>; | ||
export declare function unpublish(params: UnpublishContentParams): Either<Error, Array<string>>; | ||
export declare function getChildren<T>(params: GetChildrenParams): Either<Error, QueryResponse<T>>; | ||
@@ -209,2 +209,2 @@ export declare function move<T>(params: MoveParams): Either<Error, Content<T>>; | ||
export declare function getType(name: string): Either<Error, ContentType>; | ||
export declare function getTypes(): Either<Error, ContentType[]>; | ||
export declare function getTypes(): Either<Error, Array<ContentType>>; |
@@ -1,4 +0,4 @@ | ||
import { tryCatch, chain, fromNullable, right, left } from 'fp-ts/lib/Either'; | ||
import { pipe } from 'fp-ts/lib/pipeable'; | ||
var content = __non_webpack_require__('/lib/xp/content'); | ||
import { chain, fromNullable, left, right, tryCatch } from "fp-ts/lib/Either"; | ||
import { pipe } from "fp-ts/lib/pipeable"; | ||
var content = __non_webpack_require__("/lib/xp/content"); | ||
export function get(params) { | ||
@@ -5,0 +5,0 @@ return pipe(tryCatch(function () { return content.get(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }), chain(fromNullable({ errorKey: "NotFoundError" }))); |
@@ -28,3 +28,3 @@ import { Either } from "fp-ts/lib/Either"; | ||
}; | ||
principals?: string[]; | ||
principals?: Array<string>; | ||
attributes?: { | ||
@@ -31,0 +31,0 @@ [key: string]: string | boolean | number; |
import { tryCatch } from "fp-ts/lib/Either"; | ||
var context = __non_webpack_require__('/lib/xp/context'); | ||
var context = __non_webpack_require__("/lib/xp/context"); | ||
export function get() { | ||
return tryCatch(function () { return context.get(); }, function (e) { return ({ | ||
errorKey: "InternalServerError", | ||
cause: String(e) | ||
cause: String(e), | ||
errorKey: "InternalServerError" | ||
}); }); | ||
@@ -8,0 +8,0 @@ } |
import { Either } from "fp-ts/lib/Either"; | ||
import { Error } from "./common"; | ||
interface HttpRequestParamsProxy { | ||
/** Proxy host name to use. */ | ||
host?: string; | ||
/** Proxy port to use. */ | ||
port?: number; | ||
/** User name for proxy authentication. */ | ||
user?: string; | ||
/** Password for proxy authentication. */ | ||
password?: string; | ||
} | ||
interface HttpRequestParamsAuth { | ||
/** User name for basic authentication. */ | ||
user?: string; | ||
/** Password for basic authentication. */ | ||
password?: string; | ||
} | ||
export interface HttpRequestParams { | ||
/** URL to which the request is sent. */ | ||
url: string; | ||
/** The HTTP method to use for the request (e.g. "POST", "GET", "HEAD", "PUT", "DELETE"). */ | ||
method?: string; | ||
/** Query or form parameters to be sent with the request. */ | ||
params?: { | ||
[key: string]: string; | ||
}; | ||
/** HTTP headers, an object where the keys are header names and the values the header values. */ | ||
headers?: { | ||
[key: string]: string; | ||
}; | ||
/** The timeout on establishing the connection, in milliseconds. */ | ||
connectionTimeout?: number; | ||
/** The timeout on waiting to receive data, in milliseconds. */ | ||
readTimeout?: number; | ||
/** Body content to send with the request, usually for POST or PUT requests. It can be of type string or stream. */ | ||
body?: string | any; | ||
/** Content type of the request. */ | ||
contentType?: string; | ||
/** | ||
* Multipart form data to send with the request, an array of part objects. Each part object contains | ||
* 'name', 'value', and optionally 'fileName' and 'contentType' properties. Where 'value' can be either a string or a | ||
* Stream object. | ||
*/ | ||
multipart?: Array<object>; | ||
/** Settings for basic authentication. */ | ||
auth?: HttpRequestParamsAuth; | ||
/** Proxy settings. */ | ||
proxy?: HttpRequestParamsProxy; | ||
/** | ||
* If set to false redirect responses (status=3xx) will not trigger a new internal request, and the function will | ||
* return directly with the 3xx status. | ||
*/ | ||
followRedirects?: boolean; | ||
} | ||
export interface HttpResponse { | ||
/** HTTP status code returned. */ | ||
status: number; | ||
/** HTTP status message returned. */ | ||
message: string; | ||
/** HTTP headers of the response. */ | ||
headers: { | ||
[key: string]: string | undefined; | ||
}; | ||
/** Content type of the response. */ | ||
contentType: string; | ||
/** Body of the response as string. Null if the response content-type is not of type text. */ | ||
body: string | null; | ||
/** Body of the response as a stream object. */ | ||
bodyStream: any; | ||
} | ||
/** | ||
* Sends an HTTP request and returns the response received from the remote server. | ||
* The request is sent synchronously, the execution blocks until the response is received. | ||
*/ | ||
export declare function request(params: HttpRequestParams): Either<Error, HttpResponse>; | ||
export {}; |
import { tryCatch } from "fp-ts/lib/Either"; | ||
var httpClient = __non_webpack_require__('/lib/http-client'); | ||
var httpClient = __non_webpack_require__("/lib/http-client"); | ||
/** | ||
* Sends an HTTP request and returns the response received from the remote server. | ||
* The request is sent synchronously, the execution blocks until the response is received. | ||
*/ | ||
export function request(params) { | ||
return tryCatch(function () { return httpClient.request(params); }, function (e) { return ({ | ||
errorKey: "BadGatewayError", | ||
cause: String(e) | ||
cause: String(e), | ||
errorKey: "BadGatewayError" | ||
}); }); | ||
} |
import { fromNullable, map } from "fp-ts/lib/Option"; | ||
import { pipe } from "fp-ts/lib/pipeable"; | ||
var i18n = __non_webpack_require__('/lib/xp/i18n'); | ||
var i18n = __non_webpack_require__("/lib/xp/i18n"); | ||
var NOT_TRANSLATED_MESSAGE = "NOT_TRANSLATED"; | ||
@@ -5,0 +5,0 @@ export function getPhrases(locale, bundles) { |
import * as E from "fp-ts/lib/Either"; | ||
import { pipe } from "fp-ts/lib/pipeable"; | ||
var email = __non_webpack_require__('/lib/xp/mail'); | ||
var email = __non_webpack_require__("/lib/xp/mail"); | ||
export function send(params) { | ||
return pipe(E.tryCatch(function () { return email.send(params); }, function (e) { return ({ | ||
errorKey: "InternalServerError", | ||
cause: String(e) | ||
cause: String(e), | ||
errorKey: "InternalServerError" | ||
}); }), E.chain(function (success) { return success | ||
@@ -9,0 +9,0 @@ ? E.right(undefined) |
@@ -7,3 +7,3 @@ import { Either } from "fp-ts/lib/Either"; | ||
contextPath?: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
params?: { | ||
@@ -20,3 +20,3 @@ [key: string]: string; | ||
application?: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
params?: { | ||
@@ -35,3 +35,3 @@ [key: string]: string; | ||
}; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
} | ||
@@ -42,3 +42,3 @@ export interface ComponentUrlParams { | ||
component?: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
params?: { | ||
@@ -56,3 +56,3 @@ [key: string]: string; | ||
filter?: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
params?: { | ||
@@ -65,3 +65,3 @@ [key: string]: string; | ||
path?: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
params?: { | ||
@@ -75,3 +75,3 @@ [key: string]: string; | ||
contextPath?: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
params?: { | ||
@@ -84,3 +84,3 @@ [key: string]: string; | ||
contextPath?: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
params?: { | ||
@@ -93,3 +93,3 @@ [key: string]: string; | ||
application?: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
params?: { | ||
@@ -101,3 +101,3 @@ [key: string]: string; | ||
path?: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
params?: { | ||
@@ -109,3 +109,3 @@ [key: string]: string; | ||
value: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
} | ||
@@ -112,0 +112,0 @@ export declare function getContent<A>(): Either<Error, Content<A>>; |
@@ -1,3 +0,3 @@ | ||
import { tryCatch, fromNullable } from "fp-ts/lib/Either"; | ||
var portal = __non_webpack_require__('/lib/xp/portal'); | ||
import { fromNullable, tryCatch } from "fp-ts/lib/Either"; | ||
var portal = __non_webpack_require__("/lib/xp/portal"); | ||
export function getContent() { | ||
@@ -8,4 +8,4 @@ return tryCatch(function () { return portal.getContent(); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
return fromNullable({ | ||
errorKey: "InternalServerError", | ||
cause: "Missing id provider in context" | ||
cause: "Missing id provider in context", | ||
errorKey: "InternalServerError" | ||
})(portal.getIdProviderKey()); | ||
@@ -12,0 +12,0 @@ } |
import { chain, fromNullable, tryCatch } from "fp-ts/lib/Either"; | ||
import { pipe } from "fp-ts/lib/pipeable"; | ||
var repo = __non_webpack_require__('/lib/xp/repo'); | ||
var repo = __non_webpack_require__("/lib/xp/repo"); | ||
export function create(params) { | ||
@@ -22,6 +22,6 @@ return tryCatch(function () { return repo.create(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
return { | ||
errorKey: (e.code === 'branchNotFound') | ||
cause: String(e), | ||
errorKey: (e.code === "branchNotFound") | ||
? "NotFoundError" | ||
: "InternalServerError", | ||
cause: String(e) | ||
: "InternalServerError" | ||
}; | ||
@@ -28,0 +28,0 @@ })); |
import { Either } from "fp-ts/lib/Either"; | ||
import { Error } from "./common"; | ||
export interface ThymeleafRenderOptions { | ||
mode: 'HTML' | 'XML' | 'TEXT' | 'JAVASCRIPT' | 'CSS' | 'RAW'; | ||
mode: "HTML" | "XML" | "TEXT" | "JAVASCRIPT" | "CSS" | "RAW"; | ||
} | ||
export declare function render<A>(view: any, model?: A, options?: ThymeleafRenderOptions): Either<Error, string>; | ||
export declare function getRenderer<A>(view: any, options?: ThymeleafRenderOptions): (model: A) => Either<Error, string>; |
import { tryCatch } from "fp-ts/lib/Either"; | ||
var thymeleaf = __non_webpack_require__('/lib/thymeleaf'); | ||
var thymeleaf = __non_webpack_require__("/lib/thymeleaf"); | ||
export function render(view, model, options) { | ||
@@ -4,0 +4,0 @@ return tryCatch(function () { return thymeleaf.render(view, model, options); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); |
@@ -5,3 +5,3 @@ "use strict"; | ||
var Option_1 = require("fp-ts/lib/Option"); | ||
var auth = __non_webpack_require__('/lib/xp/auth'); | ||
var auth = __non_webpack_require__("/lib/xp/auth"); | ||
function login(params) { | ||
@@ -8,0 +8,0 @@ return Either_1.tryCatch(function () { return auth.login(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); |
@@ -33,3 +33,5 @@ export interface Request { | ||
contentType?: string; | ||
headers?: object; | ||
headers?: { | ||
[key: string]: string; | ||
}; | ||
cookies?: { | ||
@@ -36,0 +38,0 @@ [key: string]: string; |
@@ -1,2 +0,2 @@ | ||
import { Either } from 'fp-ts/lib/Either'; | ||
import { Either } from "fp-ts/lib/Either"; | ||
import { Error } from "./common"; | ||
@@ -14,6 +14,6 @@ export interface Content<T> { | ||
displayName: string; | ||
hasChildren: Boolean; | ||
hasChildren: boolean; | ||
language: string; | ||
valid: Boolean; | ||
childOrder: String; | ||
valid: boolean; | ||
childOrder: string; | ||
data: T; | ||
@@ -33,5 +33,5 @@ x: { | ||
} | ||
export declare type Attachments = { | ||
export interface Attachments { | ||
[key: string]: Attachment; | ||
}; | ||
} | ||
export interface QueryContentParams { | ||
@@ -93,3 +93,3 @@ start?: number; | ||
export interface UnpublishContentParams { | ||
keys: string[]; | ||
keys: Array<string>; | ||
} | ||
@@ -114,4 +114,4 @@ export interface GetChildrenParams { | ||
type: string; | ||
hasChildren: Boolean; | ||
valid: Boolean; | ||
hasChildren: boolean; | ||
valid: boolean; | ||
data: { | ||
@@ -141,3 +141,3 @@ siteConfig: SiteConfig<T>; | ||
key: string; | ||
name: string | string[]; | ||
name: string | Array<string>; | ||
} | ||
@@ -157,8 +157,8 @@ export interface CreateMediaParams { | ||
inheritsPermissions: boolean; | ||
permissions: PermissionsParams[]; | ||
permissions: Array<PermissionsParams>; | ||
} | ||
export interface PermissionsParams { | ||
principal: string; | ||
allow: string[]; | ||
deny: string[]; | ||
allow: Array<string>; | ||
deny: Array<string>; | ||
} | ||
@@ -169,3 +169,3 @@ export interface SetPermissionsParams { | ||
overwriteChildPermissions: boolean; | ||
permissions: PermissionsParams[]; | ||
permissions: Array<PermissionsParams>; | ||
} | ||
@@ -186,4 +186,4 @@ export interface IconType { | ||
"displayNameExpression": string; | ||
"icon": IconType[]; | ||
"form": any[]; | ||
"icon": Array<IconType>; | ||
"form": Array<any>; | ||
} | ||
@@ -196,3 +196,3 @@ export declare function get<T>(params: GetContentParams): Either<Error, Content<T>>; | ||
export declare function publish(params: PublishContentParams): Either<Error, PublishResponse>; | ||
export declare function unpublish(params: UnpublishContentParams): Either<Error, string[]>; | ||
export declare function unpublish(params: UnpublishContentParams): Either<Error, Array<string>>; | ||
export declare function getChildren<T>(params: GetChildrenParams): Either<Error, QueryResponse<T>>; | ||
@@ -209,2 +209,2 @@ export declare function move<T>(params: MoveParams): Either<Error, Content<T>>; | ||
export declare function getType(name: string): Either<Error, ContentType>; | ||
export declare function getTypes(): Either<Error, ContentType[]>; | ||
export declare function getTypes(): Either<Error, Array<ContentType>>; |
@@ -5,3 +5,3 @@ "use strict"; | ||
var pipeable_1 = require("fp-ts/lib/pipeable"); | ||
var content = __non_webpack_require__('/lib/xp/content'); | ||
var content = __non_webpack_require__("/lib/xp/content"); | ||
function get(params) { | ||
@@ -8,0 +8,0 @@ return pipeable_1.pipe(Either_1.tryCatch(function () { return content.get(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }), Either_1.chain(Either_1.fromNullable({ errorKey: "NotFoundError" }))); |
@@ -28,3 +28,3 @@ import { Either } from "fp-ts/lib/Either"; | ||
}; | ||
principals?: string[]; | ||
principals?: Array<string>; | ||
attributes?: { | ||
@@ -31,0 +31,0 @@ [key: string]: string | boolean | number; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Either_1 = require("fp-ts/lib/Either"); | ||
var context = __non_webpack_require__('/lib/xp/context'); | ||
var context = __non_webpack_require__("/lib/xp/context"); | ||
function get() { | ||
return Either_1.tryCatch(function () { return context.get(); }, function (e) { return ({ | ||
errorKey: "InternalServerError", | ||
cause: String(e) | ||
cause: String(e), | ||
errorKey: "InternalServerError" | ||
}); }); | ||
@@ -10,0 +10,0 @@ } |
import { Either } from "fp-ts/lib/Either"; | ||
import { Error } from "./common"; | ||
interface HttpRequestParamsProxy { | ||
/** Proxy host name to use. */ | ||
host?: string; | ||
/** Proxy port to use. */ | ||
port?: number; | ||
/** User name for proxy authentication. */ | ||
user?: string; | ||
/** Password for proxy authentication. */ | ||
password?: string; | ||
} | ||
interface HttpRequestParamsAuth { | ||
/** User name for basic authentication. */ | ||
user?: string; | ||
/** Password for basic authentication. */ | ||
password?: string; | ||
} | ||
export interface HttpRequestParams { | ||
/** URL to which the request is sent. */ | ||
url: string; | ||
/** The HTTP method to use for the request (e.g. "POST", "GET", "HEAD", "PUT", "DELETE"). */ | ||
method?: string; | ||
/** Query or form parameters to be sent with the request. */ | ||
params?: { | ||
[key: string]: string; | ||
}; | ||
/** HTTP headers, an object where the keys are header names and the values the header values. */ | ||
headers?: { | ||
[key: string]: string; | ||
}; | ||
/** The timeout on establishing the connection, in milliseconds. */ | ||
connectionTimeout?: number; | ||
/** The timeout on waiting to receive data, in milliseconds. */ | ||
readTimeout?: number; | ||
/** Body content to send with the request, usually for POST or PUT requests. It can be of type string or stream. */ | ||
body?: string | any; | ||
/** Content type of the request. */ | ||
contentType?: string; | ||
/** | ||
* Multipart form data to send with the request, an array of part objects. Each part object contains | ||
* 'name', 'value', and optionally 'fileName' and 'contentType' properties. Where 'value' can be either a string or a | ||
* Stream object. | ||
*/ | ||
multipart?: Array<object>; | ||
/** Settings for basic authentication. */ | ||
auth?: HttpRequestParamsAuth; | ||
/** Proxy settings. */ | ||
proxy?: HttpRequestParamsProxy; | ||
/** | ||
* If set to false redirect responses (status=3xx) will not trigger a new internal request, and the function will | ||
* return directly with the 3xx status. | ||
*/ | ||
followRedirects?: boolean; | ||
} | ||
export interface HttpResponse { | ||
/** HTTP status code returned. */ | ||
status: number; | ||
/** HTTP status message returned. */ | ||
message: string; | ||
/** HTTP headers of the response. */ | ||
headers: { | ||
[key: string]: string | undefined; | ||
}; | ||
/** Content type of the response. */ | ||
contentType: string; | ||
/** Body of the response as string. Null if the response content-type is not of type text. */ | ||
body: string | null; | ||
/** Body of the response as a stream object. */ | ||
bodyStream: any; | ||
} | ||
/** | ||
* Sends an HTTP request and returns the response received from the remote server. | ||
* The request is sent synchronously, the execution blocks until the response is received. | ||
*/ | ||
export declare function request(params: HttpRequestParams): Either<Error, HttpResponse>; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Either_1 = require("fp-ts/lib/Either"); | ||
var httpClient = __non_webpack_require__('/lib/http-client'); | ||
var httpClient = __non_webpack_require__("/lib/http-client"); | ||
/** | ||
* Sends an HTTP request and returns the response received from the remote server. | ||
* The request is sent synchronously, the execution blocks until the response is received. | ||
*/ | ||
function request(params) { | ||
return Either_1.tryCatch(function () { return httpClient.request(params); }, function (e) { return ({ | ||
errorKey: "BadGatewayError", | ||
cause: String(e) | ||
cause: String(e), | ||
errorKey: "BadGatewayError" | ||
}); }); | ||
} | ||
exports.request = request; |
@@ -5,3 +5,3 @@ "use strict"; | ||
var pipeable_1 = require("fp-ts/lib/pipeable"); | ||
var i18n = __non_webpack_require__('/lib/xp/i18n'); | ||
var i18n = __non_webpack_require__("/lib/xp/i18n"); | ||
var NOT_TRANSLATED_MESSAGE = "NOT_TRANSLATED"; | ||
@@ -8,0 +8,0 @@ function getPhrases(locale, bundles) { |
@@ -5,7 +5,7 @@ "use strict"; | ||
var pipeable_1 = require("fp-ts/lib/pipeable"); | ||
var email = __non_webpack_require__('/lib/xp/mail'); | ||
var email = __non_webpack_require__("/lib/xp/mail"); | ||
function send(params) { | ||
return pipeable_1.pipe(E.tryCatch(function () { return email.send(params); }, function (e) { return ({ | ||
errorKey: "InternalServerError", | ||
cause: String(e) | ||
cause: String(e), | ||
errorKey: "InternalServerError" | ||
}); }), E.chain(function (success) { return success | ||
@@ -12,0 +12,0 @@ ? E.right(undefined) |
@@ -7,3 +7,3 @@ import { Either } from "fp-ts/lib/Either"; | ||
contextPath?: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
params?: { | ||
@@ -20,3 +20,3 @@ [key: string]: string; | ||
application?: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
params?: { | ||
@@ -35,3 +35,3 @@ [key: string]: string; | ||
}; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
} | ||
@@ -42,3 +42,3 @@ export interface ComponentUrlParams { | ||
component?: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
params?: { | ||
@@ -56,3 +56,3 @@ [key: string]: string; | ||
filter?: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
params?: { | ||
@@ -65,3 +65,3 @@ [key: string]: string; | ||
path?: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
params?: { | ||
@@ -75,3 +75,3 @@ [key: string]: string; | ||
contextPath?: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
params?: { | ||
@@ -84,3 +84,3 @@ [key: string]: string; | ||
contextPath?: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
params?: { | ||
@@ -93,3 +93,3 @@ [key: string]: string; | ||
application?: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
params?: { | ||
@@ -101,3 +101,3 @@ [key: string]: string; | ||
path?: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
params?: { | ||
@@ -109,3 +109,3 @@ [key: string]: string; | ||
value: string; | ||
type?: 'server' | 'absolute'; | ||
type?: "server" | "absolute"; | ||
} | ||
@@ -112,0 +112,0 @@ export declare function getContent<A>(): Either<Error, Content<A>>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Either_1 = require("fp-ts/lib/Either"); | ||
var portal = __non_webpack_require__('/lib/xp/portal'); | ||
var portal = __non_webpack_require__("/lib/xp/portal"); | ||
function getContent() { | ||
@@ -11,4 +11,4 @@ return Either_1.tryCatch(function () { return portal.getContent(); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
return Either_1.fromNullable({ | ||
errorKey: "InternalServerError", | ||
cause: "Missing id provider in context" | ||
cause: "Missing id provider in context", | ||
errorKey: "InternalServerError" | ||
})(portal.getIdProviderKey()); | ||
@@ -15,0 +15,0 @@ } |
@@ -5,3 +5,3 @@ "use strict"; | ||
var pipeable_1 = require("fp-ts/lib/pipeable"); | ||
var repo = __non_webpack_require__('/lib/xp/repo'); | ||
var repo = __non_webpack_require__("/lib/xp/repo"); | ||
function create(params) { | ||
@@ -30,6 +30,6 @@ return Either_1.tryCatch(function () { return repo.create(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
return { | ||
errorKey: (e.code === 'branchNotFound') | ||
cause: String(e), | ||
errorKey: (e.code === "branchNotFound") | ||
? "NotFoundError" | ||
: "InternalServerError", | ||
cause: String(e) | ||
: "InternalServerError" | ||
}; | ||
@@ -36,0 +36,0 @@ })); |
import { Either } from "fp-ts/lib/Either"; | ||
import { Error } from "./common"; | ||
export interface ThymeleafRenderOptions { | ||
mode: 'HTML' | 'XML' | 'TEXT' | 'JAVASCRIPT' | 'CSS' | 'RAW'; | ||
mode: "HTML" | "XML" | "TEXT" | "JAVASCRIPT" | "CSS" | "RAW"; | ||
} | ||
export declare function render<A>(view: any, model?: A, options?: ThymeleafRenderOptions): Either<Error, string>; | ||
export declare function getRenderer<A>(view: any, options?: ThymeleafRenderOptions): (model: A) => Either<Error, string>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Either_1 = require("fp-ts/lib/Either"); | ||
var thymeleaf = __non_webpack_require__('/lib/thymeleaf'); | ||
var thymeleaf = __non_webpack_require__("/lib/thymeleaf"); | ||
function render(view, model, options) { | ||
@@ -6,0 +6,0 @@ return Either_1.tryCatch(function () { return thymeleaf.render(view, model, options); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); |
{ | ||
"name": "enonic-fp", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "Functional programming helpers for Enonic XP", | ||
@@ -10,3 +10,4 @@ "main": "lib/index.js", | ||
"clean": "rimraf lib/* es6/*", | ||
"build": "npm run clean && tsc && tsc -p tsconfig.es6.json" | ||
"build": "npm run clean && tsc && tsc -p tsconfig.es6.json", | ||
"lint:ts": "tslint --project tsconfig.json --config tslint.json --fix" | ||
}, | ||
@@ -32,4 +33,6 @@ "repository": { | ||
"rimraf": "^3.0.0", | ||
"tslint": "^5.20.0", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typescript": "^3.6.2" | ||
} | ||
} |
79018
51
2076
4