Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

enonic-wizardry

Package Overview
Dependencies
Maintainers
2
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enonic-wizardry - npm Package Compare versions

Comparing version 0.3.13 to 0.3.14

3

content.d.ts

@@ -0,4 +1,5 @@

/// <reference types="enonic-types" />
import { EnonicError } from "enonic-fp/errors";
import { IOEither } from "fp-ts/IOEither";
import { Content, CreateContentParams, DeleteContentParams, GetContentParams, ModifyContentParams } from "enonic-types/content";
import { Content, CreateContentParams, DeleteContentParams, GetContentParams, ModifyContentParams } from "/lib/xp/content";
import { Separated } from "fp-ts/Separated";

@@ -5,0 +6,0 @@ import { IO } from "fp-ts/IO";

@@ -17,2 +17,3 @@ "use strict";

var IOEither_1 = require("fp-ts/IOEither");
var IOE = require("fp-ts/IOEither");
var function_1 = require("fp-ts/function");

@@ -31,3 +32,3 @@ var content_1 = require("enonic-fp/content");

function getAsOption(paramsOrKey) {
return function_1.pipe(paramsOrKey, utils_1.fromNullable(errors_1.notFoundError), IOEither_1.chain(function (params) { return content_1.get(params); }), utils_1.fromIOEither);
return (0, function_1.pipe)(paramsOrKey, (0, utils_1.fromNullable)(errors_1.notFoundError), (0, IOEither_1.chain)(function (params) { return (0, content_1.get)(params); }), utils_1.fromIOEither);
}

@@ -37,7 +38,7 @@ exports.getAsOption = getAsOption;

return ids.length > 0
? function_1.pipe(content_1.query({
? (0, function_1.pipe)((0, content_1.query)({
count: ids.length,
query: "_id IN (" + idsAsString(ids) + ")",
}), IOEither_1.map(function (result) { return sortResultByIdOrder(result.hits, ids); }))
: IOEither_1.right([]);
query: "_id IN (".concat(idsAsString(ids), ")"),
}), (0, IOEither_1.map)(function (result) { return sortResultByIdOrder(result.hits, ids); }))
: (0, IOEither_1.right)([]);
}

@@ -48,3 +49,3 @@ exports.getContentByIds = getContentByIds;

.filter(notEmptyOrUndefined)
.map(function (id) { return "\"" + id + "\""; })
.map(function (id) { return "\"".concat(id, "\""); })
.join(",");

@@ -67,11 +68,11 @@ }

function createAndPublish(params) {
return function_1.pipe(context_1.runInDraftContext(content_1.create(params)), IOEither_1.chainFirst(function (content) { return content_1.publish(content); }));
return (0, function_1.pipe)((0, context_1.runInDraftContext)((0, content_1.create)(params)), (0, IOEither_1.chainFirst)(function (content) { return (0, content_1.publish)(content); }));
}
exports.createAndPublish = createAndPublish;
function deleteAndPublish(params) {
return function_1.pipe(context_1.runInDraftContext(content_1.remove(params)), IOEither_1.chainFirst(function () { return content_1.publish(params.key); }));
return (0, function_1.pipe)((0, context_1.runInDraftContext)((0, content_1.remove)(params)), (0, IOEither_1.chainFirst)(function () { return (0, content_1.publish)(params.key); }));
}
exports.deleteAndPublish = deleteAndPublish;
function modifyAndPublish(a, key) {
return function_1.pipe(context_1.runInDraftContext(content_1.modify(applyChangesToData(key, a))), IOEither_1.chainFirst(function (content) { return content_1.publish(content); }));
return (0, function_1.pipe)((0, context_1.runInDraftContext)((0, content_1.modify)(applyChangesToData(key, a))), (0, IOEither_1.chainFirst)(function (content) { return (0, content_1.publish)(content); }));
}

@@ -88,6 +89,6 @@ exports.modifyAndPublish = modifyAndPublish;

function createMediaFromAttachment(params) {
return function_1.pipe(Apply_1.sequenceS(IOEither_1.ioEither)({
data: portal_1.getMultipartStream(params.name, params.index),
item: portal_1.getMultipartItem(params.name, params.index),
}), IOEither_1.filterOrElse(hasDataAndItem, function () {
return (0, function_1.pipe)((0, Apply_1.sequenceS)(IOE.ApplyPar)({
data: (0, portal_1.getMultipartStream)(params.name, params.index),
item: (0, portal_1.getMultipartItem)(params.name, params.index),
}), (0, IOEither_1.filterOrElse)(hasDataAndItem, function () {
var _a;

@@ -97,8 +98,8 @@ return (__assign(__assign({}, errors_1.badRequestError), { errors: [

key: params.name,
message: (_a = params.errorMessage) !== null && _a !== void 0 ? _a : "Missing parameter: \"" + params.name + "\"",
message: (_a = params.errorMessage) !== null && _a !== void 0 ? _a : "Missing parameter: \"".concat(params.name, "\""),
},
] }));
}), IOEither_1.chain(function (_a) {
}), (0, IOEither_1.chain)(function (_a) {
var data = _a.data, item = _a.item;
return content_1.createMedia({
return (0, content_1.createMedia)({
data: data,

@@ -105,0 +106,0 @@ parentPath: params.parentPath,

@@ -0,4 +1,5 @@

/// <reference types="enonic-types" />
import { IOEither } from "fp-ts/IOEither";
import { RunContext } from "enonic-types/context";
export declare function chainRun(runContext: RunContext): <E, A, B>(f: (a: A) => IOEither<E, B>) => (ma: IOEither<E, A>) => IOEither<E, B>;
import { ContextAttributes, RunContext } from "/lib/xp/context";
export declare function chainRun<Attributes extends ContextAttributes>(runContext: RunContext<Attributes>): <E, A, B>(f: (a: A) => IOEither<E, B>) => (ma: IOEither<E, A>) => IOEither<E, B>;
export declare const runAsSuperUser: <A>(a: import("fp-ts/lib/IO").IO<A>) => import("fp-ts/lib/IO").IO<A>;

@@ -5,0 +6,0 @@ export declare const runInDraftContext: <A>(a: import("fp-ts/lib/IO").IO<A>) => import("fp-ts/lib/IO").IO<A>;

@@ -8,7 +8,7 @@ "use strict";

return function (f) {
return IOEither_1.chain(function (a) { return context_1.run(runContext)(f(a)); });
return (0, IOEither_1.chain)(function (a) { return (0, context_1.run)(runContext)(f(a)); });
};
}
exports.chainRun = chainRun;
exports.runAsSuperUser = context_1.run({
exports.runAsSuperUser = (0, context_1.run)({
user: {

@@ -19,3 +19,3 @@ login: "su",

});
exports.runInDraftContext = context_1.run({
exports.runInDraftContext = (0, context_1.run)({
branch: "draft",

@@ -22,0 +22,0 @@ });

@@ -0,4 +1,5 @@

/// <reference types="enonic-types" />
import { IOEither } from "fp-ts/IOEither";
import { GetMenuParams, MenuItem } from "enonic-types/menu";
import { GetMenuParams, MenuItem } from "/lib/menu";
import { EnonicError } from "enonic-fp/errors";
export declare function getSubMenuByKey(levels: number, params?: GetMenuParams, key?: string): IOEither<EnonicError, ReadonlyArray<MenuItem>>;

@@ -10,5 +10,5 @@ "use strict";

return key !== undefined
? function_1.pipe(content_1.get({ key: key }), IOEither_1.chain(menu_1.getSubMenus(levels, params)))
: IOEither_1.right([]);
? (0, function_1.pipe)((0, content_1.get)({ key: key }), (0, IOEither_1.chain)((0, menu_1.getSubMenus)(levels, params)))
: (0, IOEither_1.right)([]);
}
exports.getSubMenuByKey = getSubMenuByKey;
{
"name": "enonic-wizardry",
"sideEffects": false,
"version": "0.3.13",
"version": "0.3.14",
"description": "Functional utility library for Enonic XP",

@@ -29,17 +29,17 @@ "main": "lib/index.js",

"dependencies": {
"enonic-fp": "^0.3.12",
"enonic-types": "^0.2.2",
"fp-ts": "^2.10.5",
"enonic-fp": "^0.3.16",
"enonic-types": "^0.3.9",
"fp-ts": "^2.11.5",
"io-ts": "^2.2.16"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",
"eslint": "^7.27.0",
"@typescript-eslint/eslint-plugin": "^5.6.0",
"@typescript-eslint/parser": "^5.6.0",
"eslint": "^8.4.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"prettier": "^2.3.0",
"eslint-plugin-prettier": "^4.0.0",
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
"typescript": "^4.3.2"
"typescript": "^4.5.3"
}
}

@@ -21,3 +21,3 @@ "use strict";

return {
report: Either_1.fold(function (es) {
report: (0, Either_1.fold)(function (es) {
return es.map(function (err) { return validationErrorToErrorDetail(err, localizeParams); });

@@ -30,3 +30,3 @@ }, function () { return []; }),

var key = getPathInInterface(err.context);
return function_1.pipe(getMessageKeys(key, isLastEmpty(err.context), localizeParams), i18n_1.localizeFirst, Option_1.getOrElse(function () { var _a; return (_a = err.message) !== null && _a !== void 0 ? _a : "Invalid value"; }), function (message) { return ({
return (0, function_1.pipe)(getMessageKeys(key, isLastEmpty(err.context), localizeParams), i18n_1.localizeFirst, (0, Option_1.getOrElse)(function () { var _a; return (_a = err.message) !== null && _a !== void 0 ? _a : "Invalid value"; }), function (message) { return ({
key: key,

@@ -40,5 +40,5 @@ message: message,

var keyedMessageKeys = [
i18nPrefix + ".bad-request-error." + key,
i18nPrefix + ".400." + key,
i18nPrefix + "." + key,
"".concat(i18nPrefix, ".bad-request-error.").concat(key),
"".concat(i18nPrefix, ".400.").concat(key),
"".concat(i18nPrefix, ".").concat(key),
];

@@ -50,4 +50,4 @@ var emptyMessageKeys = [

var defaultMessageKeys = [
i18nPrefix + ".bad-request-error",
i18nPrefix + ".400",
"".concat(i18nPrefix, ".bad-request-error"),
"".concat(i18nPrefix, ".400"),
"errors.bad-request-error.default",

@@ -54,0 +54,0 @@ "errors.400.default",

@@ -27,3 +27,3 @@ "use strict";

function normalizeDecoded(decoded, localizeParams) {
return function_1.pipe(decoded, IOEither_1.fromEither, IOEither_1.mapLeft(function () { return (__assign(__assign({}, errors_1.badRequestError), { errors: ErrorDetailReporter_1.getErrorDetailReporter(localizeParams).report(decoded) })); }));
return (0, function_1.pipe)(decoded, IOEither_1.fromEither, (0, IOEither_1.mapLeft)(function () { return (__assign(__assign({}, errors_1.badRequestError), { errors: (0, ErrorDetailReporter_1.getErrorDetailReporter)(localizeParams).report(decoded) })); }));
}

@@ -30,0 +30,0 @@ exports.normalizeDecoded = normalizeDecoded;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc