Comparing version 0.3.6 to 0.3.7
@@ -22,2 +22,3 @@ "use strict"; | ||
var utils_1 = require("./utils"); | ||
var turbo_1 = require("./turbo"); | ||
exports.ok = asResponseFromStatus(200); | ||
@@ -114,3 +115,6 @@ exports.created = asResponseFromStatus(201); | ||
: httpStatusOrError.status; | ||
return IO_1.io.of(__assign(__assign({ contentType: contentType(body) }, extras), { status: httpStatus, body: body })); | ||
// automatic serialization of turbo streams | ||
return isTurboStream(body) | ||
? IO_1.io.of(__assign(__assign({ contentType: turbo_1.getTurboStreamsMimetype() }, extras), { status: httpStatus, body: turbo_1.serialize(body) })) | ||
: IO_1.io.of(__assign(__assign({ contentType: contentType(body) }, extras), { status: httpStatus, body: body })); | ||
} | ||
@@ -124,1 +128,4 @@ exports.status = status; | ||
} | ||
function isTurboStream(v) { | ||
return turbo_1.isTurboStreamAction((v instanceof Array) ? v[0] : v); | ||
} |
{ | ||
"name": "enonic-fp", | ||
"version": "0.3.6", | ||
"version": "0.3.7", | ||
"sideEffects": false, | ||
@@ -27,9 +27,9 @@ "description": "Functional programming helpers for Enonic XP", | ||
"dependencies": { | ||
"enonic-types": "^0.1.10", | ||
"fp-ts": "^2.9.1" | ||
"enonic-types": "^0.1.17", | ||
"fp-ts": "^2.9.3" | ||
}, | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^4.11.0", | ||
"@typescript-eslint/parser": "^4.11.0", | ||
"eslint": "^7.16.0", | ||
"@typescript-eslint/eslint-plugin": "^4.13.0", | ||
"@typescript-eslint/parser": "^4.13.0", | ||
"eslint": "^7.17.0", | ||
"rimraf": "^3.0.2", | ||
@@ -36,0 +36,0 @@ "typescript": "^4.1.3" |
@@ -10,3 +10,3 @@ import { IOEither } from "fp-ts/IOEither"; | ||
export declare function getContent<A extends object, PageConfig extends object = never>(): IOEither<EnonicError, Content<A, PageConfig>>; | ||
export declare function getComponent<A>(): IOEither<EnonicError, Component<A>>; | ||
export declare function getComponent<Config extends object = never>(): IOEither<EnonicError, Component<Config>>; | ||
export declare function getIdProviderKey(): IOEither<EnonicError, string>; | ||
@@ -13,0 +13,0 @@ /** |
115749
54
2323
Updatedenonic-types@^0.1.17
Updatedfp-ts@^2.9.3