Comparing version 0.1.7 to 0.1.8
@@ -109,6 +109,18 @@ import { IOEither } from "fp-ts/lib/IOEither"; | ||
} | ||
/** | ||
* This function returns a JSON containing multipart items. If not a multipart request, then this function returns `undefined`. | ||
*/ | ||
export declare function getMultipartForm(): IOEither<EnonicError, ReadonlyArray<MultipartItem | ReadonlyArray<MultipartItem>>>; | ||
export declare function getMultipartItem(name: string, index?: number): IOEither<EnonicError, MultipartItem>; | ||
export declare function getMultipartStream(name: string, index?: number): IOEither<EnonicError, ByteSource>; | ||
export declare function getMultipartText(name: string, index?: number): IOEither<EnonicError, string>; | ||
/** | ||
* This function returns a JSON containing a named multipart item. If the item does not exists, it returns `undefined`. | ||
*/ | ||
export declare function getMultipartItem(name: string, index?: number, errorMessage?: string): IOEither<EnonicError, MultipartItem>; | ||
/** | ||
* This function returns a data-stream for a named multipart item. | ||
*/ | ||
export declare function getMultipartStream(name: string, index?: number, errorMessage?: string): IOEither<EnonicError, ByteSource>; | ||
/** | ||
* This function returns the multipart item data as text. | ||
*/ | ||
export declare function getMultipartText(name: string, index?: number, errorMessage?: string): IOEither<EnonicError, string>; | ||
export declare function getSite<A>(): IOEither<EnonicError, Site<A>>; | ||
@@ -115,0 +127,0 @@ export declare function getSiteConfig<A>(): IOEither<EnonicError, A>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var utils_1 = require("./utils"); | ||
var pipeable_1 = require("fp-ts/lib/pipeable"); | ||
var IOEither_1 = require("fp-ts/es6/IOEither"); | ||
var portal = __non_webpack_require__("/lib/xp/portal"); | ||
@@ -16,2 +18,5 @@ function getContent() { | ||
exports.getIdProviderKey = getIdProviderKey; | ||
/** | ||
* This function returns a JSON containing multipart items. If not a multipart request, then this function returns `undefined`. | ||
*/ | ||
function getMultipartForm() { | ||
@@ -21,12 +26,45 @@ return utils_1.catchEnonicError(function () { return portal.getMultipartForm(); }); | ||
exports.getMultipartForm = getMultipartForm; | ||
function getMultipartItem(name, index) { | ||
return utils_1.catchEnonicError(function () { return portal.getMultipartItem(name, index); }); | ||
/** | ||
* This function returns a JSON containing a named multipart item. If the item does not exists, it returns `undefined`. | ||
*/ | ||
function getMultipartItem(name, index, errorMessage) { | ||
var _a; | ||
if (index === void 0) { index = 0; } | ||
if (errorMessage === void 0) { errorMessage = "portal.error.multipartItem"; } | ||
return pipeable_1.pipe(utils_1.catchEnonicError(function () { return portal.getMultipartItem(name, index); }), IOEither_1.chain(utils_1.fromNullable({ | ||
errorKey: "BadRequestError", | ||
errors: (_a = {}, | ||
_a[name] = [errorMessage], | ||
_a) | ||
}))); | ||
} | ||
exports.getMultipartItem = getMultipartItem; | ||
function getMultipartStream(name, index) { | ||
return utils_1.catchEnonicError(function () { return portal.getMultipartStream(name, index); }); | ||
/** | ||
* This function returns a data-stream for a named multipart item. | ||
*/ | ||
function getMultipartStream(name, index, errorMessage) { | ||
var _a; | ||
if (index === void 0) { index = 0; } | ||
if (errorMessage === void 0) { errorMessage = "portal.error.multipartItem"; } | ||
return pipeable_1.pipe(utils_1.catchEnonicError(function () { return portal.getMultipartStream(name, index); }), IOEither_1.chain(utils_1.fromNullable({ | ||
errorKey: "BadRequestError", | ||
errors: (_a = {}, | ||
_a[name] = [errorMessage], | ||
_a) | ||
}))); | ||
} | ||
exports.getMultipartStream = getMultipartStream; | ||
function getMultipartText(name, index) { | ||
return utils_1.catchEnonicError(function () { return portal.getMultipartText(name, index); }); | ||
/** | ||
* This function returns the multipart item data as text. | ||
*/ | ||
function getMultipartText(name, index, errorMessage) { | ||
var _a; | ||
if (index === void 0) { index = 0; } | ||
if (errorMessage === void 0) { errorMessage = "portal.error.multipartItem"; } | ||
return pipeable_1.pipe(utils_1.catchEnonicError(function () { return portal.getMultipartText(name, index); }), IOEither_1.chain(utils_1.fromNullable({ | ||
errorKey: "BadRequestError", | ||
errors: (_a = {}, | ||
_a[name] = [errorMessage], | ||
_a) | ||
}))); | ||
} | ||
@@ -33,0 +71,0 @@ exports.getMultipartText = getMultipartText; |
{ | ||
"name": "enonic-fp", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Functional programming helpers for Enonic XP", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
59536
1398