enonic-wizardry
Advanced tools
Comparing version 0.0.5 to 0.0.6
import { Error } from "enonic-fp/lib/common"; | ||
import { Either } from "fp-ts/lib/Either"; | ||
import { Content, ModifyContentParams, CreateContentParams, DeleteContentParams } from "enonic-fp/lib/content"; | ||
export interface WithId { | ||
_id: string; | ||
} | ||
export declare function publishFromDraftToMaster<A>(content: Content<A>): Either<Error, Content<A>>; | ||
@@ -10,1 +13,2 @@ export declare function publishContentByKey<A>(key: string): (a: A) => Either<Error, A>; | ||
export declare function modifyAndPublish<A>(key: string, changes: any): Either<Error, Content<A>>; | ||
export declare function getContentDataWithId<T>(content: Content<T>): T & WithId; |
@@ -36,3 +36,3 @@ var __assign = (this && this.__assign) || function () { | ||
editor: function (content) { | ||
content.data = __assign({}, content.data, changes); | ||
content.data = __assign(__assign({}, content.data), changes); | ||
return content; | ||
@@ -52,1 +52,6 @@ }, | ||
} | ||
export function getContentDataWithId(content) { | ||
var dataWithId = content.data; | ||
dataWithId._id = content._id; | ||
return dataWithId; | ||
} |
@@ -6,3 +6,3 @@ import { Error, ErrorKey, Response } from "enonic-fp/lib/common"; | ||
export declare function status(status: number, body?: string | object): Response; | ||
export declare function errorResponse(i18nPrefix: string): (err: Error) => Response; | ||
export declare function errorResponse(i18nPrefix: string, debug?: boolean): (err: Error) => Response; | ||
export declare const ok: (body: any) => Response; | ||
@@ -9,0 +9,0 @@ export declare const created: (body: any) => Response; |
@@ -25,3 +25,4 @@ import { localize } from "enonic-fp/lib/i18n"; | ||
} | ||
export function errorResponse(i18nPrefix) { | ||
export function errorResponse(i18nPrefix, debug) { | ||
if (debug === void 0) { debug = false; } | ||
return function (err) { | ||
@@ -31,3 +32,3 @@ var i18nKey = i18nPrefix + "." + err.errorKey; | ||
message: getOrElse(function () { return i18nKey; })(localize({ key: i18nKey })), | ||
debug: String(err) | ||
cause: debug ? err.cause : undefined | ||
}); | ||
@@ -49,5 +50,5 @@ }; | ||
response.headers = { | ||
'X-Total-Count': total | ||
'X-Total-Count': String(total) | ||
}; | ||
return response; | ||
} |
import { Error } from "enonic-fp/lib/common"; | ||
import { Either } from "fp-ts/lib/Either"; | ||
import { Content, ModifyContentParams, CreateContentParams, DeleteContentParams } from "enonic-fp/lib/content"; | ||
export interface WithId { | ||
_id: string; | ||
} | ||
export declare function publishFromDraftToMaster<A>(content: Content<A>): Either<Error, Content<A>>; | ||
@@ -10,1 +13,2 @@ export declare function publishContentByKey<A>(key: string): (a: A) => Either<Error, A>; | ||
export declare function modifyAndPublish<A>(key: string, changes: any): Either<Error, Content<A>>; | ||
export declare function getContentDataWithId<T>(content: Content<T>): T & WithId; |
@@ -40,3 +40,3 @@ "use strict"; | ||
editor: function (content) { | ||
content.data = __assign({}, content.data, changes); | ||
content.data = __assign(__assign({}, content.data), changes); | ||
return content; | ||
@@ -60,1 +60,7 @@ }, | ||
exports.modifyAndPublish = modifyAndPublish; | ||
function getContentDataWithId(content) { | ||
var dataWithId = content.data; | ||
dataWithId._id = content._id; | ||
return dataWithId; | ||
} | ||
exports.getContentDataWithId = getContentDataWithId; |
@@ -6,3 +6,3 @@ import { Error, ErrorKey, Response } from "enonic-fp/lib/common"; | ||
export declare function status(status: number, body?: string | object): Response; | ||
export declare function errorResponse(i18nPrefix: string): (err: Error) => Response; | ||
export declare function errorResponse(i18nPrefix: string, debug?: boolean): (err: Error) => Response; | ||
export declare const ok: (body: any) => Response; | ||
@@ -9,0 +9,0 @@ export declare const created: (body: any) => Response; |
@@ -28,3 +28,4 @@ "use strict"; | ||
exports.status = status; | ||
function errorResponse(i18nPrefix) { | ||
function errorResponse(i18nPrefix, debug) { | ||
if (debug === void 0) { debug = false; } | ||
return function (err) { | ||
@@ -34,3 +35,3 @@ var i18nKey = i18nPrefix + "." + err.errorKey; | ||
message: Option_1.getOrElse(function () { return i18nKey; })(i18n_1.localize({ key: i18nKey })), | ||
debug: String(err) | ||
cause: debug ? err.cause : undefined | ||
}); | ||
@@ -53,3 +54,3 @@ }; | ||
response.headers = { | ||
'X-Total-Count': total | ||
'X-Total-Count': String(total) | ||
}; | ||
@@ -56,0 +57,0 @@ return response; |
{ | ||
"name": "enonic-wizardry", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Functional utility library for Enonic XP", | ||
@@ -10,3 +10,6 @@ "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 && npm run build:cli", | ||
"build:cli": "tsc -outDir bin cli/xml-to-ts.ts", | ||
"test": "jest", | ||
"watch:test": "jest --watch" | ||
}, | ||
@@ -28,9 +31,18 @@ "repository": { | ||
"dependencies": { | ||
"enonic-fp": "^0.0.10", | ||
"fp-ts": "^2.0.5" | ||
"@types/xmldom": "^0.1.29", | ||
"change-case": "^3.1.0", | ||
"commander": "^3.0.1", | ||
"enonic-fp": "^0.0.16", | ||
"fp-ts": "^2.0.5", | ||
"xmldom": "^0.1.27", | ||
"xpath": "0.0.27" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^24.0.18", | ||
"@types/node": "^12.7.4", | ||
"jest": "^24.9.0", | ||
"rimraf": "^3.0.0", | ||
"typescript": "^3.5.3" | ||
"ts-jest": "^24.0.2", | ||
"typescript": "^3.6.2" | ||
} | ||
} |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
25744
26
593
7
6
1
+ Added@types/xmldom@^0.1.29
+ Addedchange-case@^3.1.0
+ Addedcommander@^3.0.1
+ Addedxmldom@^0.1.27
+ Addedxpath@0.0.27
+ Added@types/xmldom@0.1.34(transitive)
+ Addedcamel-case@3.0.0(transitive)
+ Addedchange-case@3.1.0(transitive)
+ Addedcommander@3.0.2(transitive)
+ Addedconstant-case@2.0.0(transitive)
+ Addeddot-case@2.1.1(transitive)
+ Addedenonic-fp@0.0.16(transitive)
+ Addedheader-case@1.0.1(transitive)
+ Addedis-lower-case@1.1.3(transitive)
+ Addedis-upper-case@1.1.2(transitive)
+ Addedlower-case@1.1.4(transitive)
+ Addedlower-case-first@1.0.2(transitive)
+ Addedno-case@2.3.2(transitive)
+ Addedparam-case@2.1.1(transitive)
+ Addedpascal-case@2.0.1(transitive)
+ Addedpath-case@2.1.1(transitive)
+ Addedsentence-case@2.1.1(transitive)
+ Addedsnake-case@2.1.0(transitive)
+ Addedswap-case@1.1.2(transitive)
+ Addedtitle-case@2.1.1(transitive)
+ Addedupper-case@1.1.3(transitive)
+ Addedupper-case-first@1.1.2(transitive)
+ Addedxmldom@0.1.31(transitive)
+ Addedxpath@0.0.27(transitive)
- Removedenonic-fp@0.0.10(transitive)
Updatedenonic-fp@^0.0.16