enonic-wizardry
Advanced tools
Comparing version 0.2.35 to 0.2.36
@@ -11,7 +11,4 @@ module.exports = { | ||
rules: { | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/no-use-before-define": "off", | ||
"@typescript-eslint/no-var-requires": "off", | ||
"@typescript-eslint/ban-types": "off" | ||
}, | ||
}; |
@@ -6,5 +6,2 @@ import { EnonicError } from "enonic-fp/lib/errors"; | ||
import { IO } from "fp-ts/lib/IO"; | ||
export declare type WithId<T> = T & { | ||
_id: string; | ||
}; | ||
export interface CreateMediaFromAttachmentParams { | ||
@@ -34,9 +31,3 @@ /** | ||
export declare function deleteAndPublish(params: DeleteContentParams): IOEither<EnonicError, void>; | ||
export declare function modifyAndPublish<A extends object>(a: WithId<A>): IOEither<EnonicError, Content<A>>; | ||
export declare function modifyAndPublish<A extends object>(a: Partial<A>, key: string): IOEither<EnonicError, Content<A>>; | ||
export declare function isDataWithId<A>(data: unknown | WithId<A>): data is WithId<A>; | ||
export declare function getContentDataWithId<A extends object>(content: Content<A>): WithId<A>; | ||
export declare function splitDataWithId<A extends object>(a: A & { | ||
_id: string; | ||
}): [string, A]; | ||
export declare function createMediaFromAttachment<A extends object>(params: CreateMediaFromAttachmentParams): IOEither<EnonicError, Content<A>>; |
@@ -13,15 +13,4 @@ "use strict"; | ||
}; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createMediaFromAttachment = exports.splitDataWithId = exports.getContentDataWithId = exports.isDataWithId = exports.modifyAndPublish = exports.deleteAndPublish = exports.createAndPublish = exports.createAll = exports.applyChangesToData = exports.publishContentByKey = exports.publishFromDraftToMaster = void 0; | ||
exports.createMediaFromAttachment = exports.modifyAndPublish = exports.deleteAndPublish = exports.createAndPublish = exports.createAll = exports.applyChangesToData = exports.publishContentByKey = exports.publishFromDraftToMaster = void 0; | ||
var IOEither_1 = require("fp-ts/lib/IOEither"); | ||
@@ -75,22 +64,5 @@ var pipeable_1 = require("fp-ts/lib/pipeable"); | ||
function modifyAndPublish(a, key) { | ||
var doModify = isDataWithId(a) | ||
? content_1.modify(function_1.tupled(applyChangesToData)(splitDataWithId(a))) | ||
: content_1.modify(applyChangesToData(key !== null && key !== void 0 ? key : '', a)); | ||
return pipeable_1.pipe(context_1.runInDraftContext(doModify), IOEither_1.chain(publishFromDraftToMaster)); | ||
return pipeable_1.pipe(context_1.runInDraftContext(content_1.modify(applyChangesToData(key, a))), IOEither_1.chain(publishFromDraftToMaster)); | ||
} | ||
exports.modifyAndPublish = modifyAndPublish; | ||
function isDataWithId(data) { | ||
var _a; | ||
return ((_a = data) === null || _a === void 0 ? void 0 : _a._id) !== undefined; | ||
} | ||
exports.isDataWithId = isDataWithId; | ||
function getContentDataWithId(content) { | ||
return __assign(__assign({}, content.data), { _id: content._id }); | ||
} | ||
exports.getContentDataWithId = getContentDataWithId; | ||
function splitDataWithId(a) { | ||
var _id = a._id, data = __rest(a, ["_id"]); | ||
return [_id, data]; | ||
} | ||
exports.splitDataWithId = splitDataWithId; | ||
function createMediaFromAttachment(params) { | ||
@@ -97,0 +69,0 @@ return pipeable_1.pipe(Apply_1.sequenceS(IOEither_1.ioEither)({ |
{ | ||
"name": "enonic-wizardry", | ||
"version": "0.2.35", | ||
"version": "0.2.36", | ||
"description": "Functional utility library for Enonic XP", | ||
@@ -28,4 +28,4 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"enonic-fp": "^0.2.43", | ||
"enonic-types": "^0.0.63", | ||
"enonic-fp": "^0.2.45", | ||
"enonic-types": "^0.0.67", | ||
"fp-ts": "^2.6.2", | ||
@@ -35,8 +35,8 @@ "io-ts": "^2.2.4" | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^3.1.0", | ||
"@typescript-eslint/parser": "^3.1.0", | ||
"eslint": "^7.1.0", | ||
"@typescript-eslint/eslint-plugin": "^3.3.0", | ||
"@typescript-eslint/parser": "^3.3.0", | ||
"eslint": "^7.2.0", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^3.9.3" | ||
"typescript": "^3.9.5" | ||
} | ||
} |
@@ -95,3 +95,3 @@ # Enonic Wizardry | ||
* [Utils](./src/utils.ts) | ||
* [Utils](src/array.ts) | ||
* `substringAfter` | ||
@@ -98,0 +98,0 @@ * `json` |
22693
390
+ Addedenonic-types@0.0.67(transitive)
- Removedenonic-types@0.0.63(transitive)
Updatedenonic-fp@^0.2.45
Updatedenonic-types@^0.0.67