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

enonic-wizardry

Package Overview
Dependencies
Maintainers
1
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.1.13 to 0.1.14

23

lib/content.d.ts

@@ -5,4 +5,22 @@ import { EnonicError } from "enonic-fp/lib/common";

export interface WithId {
_id: string;
readonly _id: string;
}
export interface CreateMediaFromAttachmentParams {
/**
* Name of the field in the form
*/
readonly name: string;
/**
* Parent path to store the media in Enonic
*/
readonly parentPath: string;
/**
* Index in the form, if there are multiple fields with the same name
*/
readonly index?: number;
/**
* Error message for if the form field is not found
*/
readonly errorMessage?: string;
}
export declare function publishFromDraftToMaster<A>(content: Content<A>): IOEither<EnonicError, Content<A>>;

@@ -14,2 +32,3 @@ export declare function publishContentByKey<A>(key: string): (a: A) => IOEither<EnonicError, A>;

export declare function modifyAndPublish<A>(key: string, changes: any): IOEither<EnonicError, Content<A>>;
export declare function getContentDataWithId<T>(content: Content<T>): T & WithId;
export declare function getContentDataWithId<A>(content: Content<A>): A & WithId;
export declare function createMediaFromAttachment<A>(params: CreateMediaFromAttachmentParams): IOEither<EnonicError, Content<A>>;

@@ -18,2 +18,4 @@ "use strict";

var context_1 = require("./context");
var portal_1 = require("enonic-fp/lib/portal");
var Apply_1 = require("fp-ts/lib/Apply");
function publishFromDraftToMaster(content) {

@@ -58,6 +60,16 @@ return pipeable_1.pipe(content_1.publish({

function getContentDataWithId(content) {
var dataWithId = content.data;
dataWithId._id = content._id;
return dataWithId;
return __assign(__assign({}, content.data), { _id: content._id });
}
exports.getContentDataWithId = getContentDataWithId;
function createMediaFromAttachment(params) {
return pipeable_1.pipe(Apply_1.sequenceT(IOEither_1.ioEither)(portal_1.getMultipartStream(name, params.index, params.errorMessage), portal_1.getMultipartItem(name, params.index, params.errorMessage)), IOEither_1.chain(function (_a) {
var data = _a[0], item = _a[1];
return content_1.createMedia({
data: data,
parentPath: params.parentPath,
name: item.fileName,
mimeType: item.contentType
});
}));
}
exports.createMediaFromAttachment = createMediaFromAttachment;

2

lib/utils.d.ts

@@ -6,3 +6,3 @@ import { IOEither } from 'fp-ts/lib/IOEither';

export declare function getUuidFromPath(path: string): Option<string>;
export declare function forceArray<A>(data?: A | Array<A>): Array<A>;
export declare function forceArray<A>(data?: A | ReadonlyArray<A>): ReadonlyArray<A>;
export declare function uuidv4(): string;
{
"name": "enonic-wizardry",
"version": "0.1.13",
"version": "0.1.14",
"description": "Functional utility library for Enonic XP",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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