Comparing version 0.0.7 to 0.0.8
@@ -5,3 +5,3 @@ import { Either } from 'fp-ts/lib/Either'; | ||
_id: string; | ||
name: string; | ||
_name: string; | ||
_path: string; | ||
@@ -24,5 +24,14 @@ creator: string; | ||
page: any; | ||
attachments: object; | ||
attachments: Attachments; | ||
publish: any; | ||
} | ||
export interface Attachment { | ||
name: string; | ||
label?: string; | ||
size: number; | ||
mimeType: string; | ||
} | ||
export declare type Attachments = { | ||
[key: string]: Attachment; | ||
}; | ||
export interface QueryContentParams { | ||
@@ -83,2 +92,94 @@ start?: number; | ||
} | ||
export interface UnpublishContentParams { | ||
keys: string[]; | ||
} | ||
export interface GetChildrenParams { | ||
key: string; | ||
start?: number; | ||
count?: number; | ||
sort?: string; | ||
} | ||
export interface MoveParams { | ||
source: string; | ||
target: string; | ||
} | ||
export interface GetSiteParams { | ||
key: string; | ||
} | ||
export interface Site<T> { | ||
_id: string; | ||
_name: string; | ||
_path: string; | ||
type: string; | ||
hasChildren: Boolean; | ||
valid: Boolean; | ||
data: { | ||
siteConfig: SiteConfig<T>; | ||
}; | ||
x: { | ||
[key: string]: string; | ||
}; | ||
page: any; | ||
attachments: object; | ||
publish: any; | ||
} | ||
export interface SiteConfig<T> { | ||
applicationKey: string; | ||
config: T; | ||
} | ||
export interface GetSiteConfigParams { | ||
key: string; | ||
applicationKey: string; | ||
} | ||
export interface AttachmentStreamParams { | ||
key: string; | ||
name: string; | ||
} | ||
export interface RemoveAttachmentParams { | ||
key: string; | ||
name: string | string[]; | ||
} | ||
export interface CreateMediaParams { | ||
name?: string; | ||
parentPath?: string; | ||
mimeType?: string; | ||
focalX?: number; | ||
focalY?: number; | ||
data: any; | ||
} | ||
export interface GetPermissionsParams { | ||
key: string; | ||
} | ||
export interface GetPermissionsResult { | ||
inheritsPermissions: boolean; | ||
permissions: PermissionsParams[]; | ||
} | ||
export interface PermissionsParams { | ||
principal: string; | ||
allow: string[]; | ||
deny: string[]; | ||
} | ||
export interface SetPermissionsParams { | ||
key: string; | ||
inheritPermissions: boolean; | ||
overwriteChildPermissions: boolean; | ||
permissions: PermissionsParams[]; | ||
} | ||
export interface IconType { | ||
data?: any; | ||
mimeType?: string; | ||
modifiedTime?: string; | ||
} | ||
export interface ContentType { | ||
"name": string; | ||
"displayName": string; | ||
"description": string; | ||
"superType": string; | ||
"abstract": boolean; | ||
"final": boolean; | ||
"allowChildContent": boolean; | ||
"displayNameExpression": string; | ||
"icon": IconType[]; | ||
"form": any[]; | ||
} | ||
export declare function get<T>(params: GetContentParams): Either<Error, Content<T>>; | ||
@@ -90,1 +191,14 @@ export declare function query<T>(params: QueryContentParams): Either<Error, QueryResponse<T>>; | ||
export declare function publish(params: PublishContentParams): Either<Error, PublishResponse>; | ||
export declare function unpublish(params: UnpublishContentParams): Either<Error, string[]>; | ||
export declare function getChildren<T>(params: GetChildrenParams): Either<Error, QueryResponse<T>>; | ||
export declare function move<T>(params: MoveParams): Either<Error, Content<T>>; | ||
export declare function getSite<T>(params: GetSiteParams): Either<Error, Site<T>>; | ||
export declare function getSiteConfig<T>(params: GetSiteConfigParams): Either<Error, T>; | ||
export declare function createMedia<T>(params: CreateMediaParams): Either<Error, Content<T>>; | ||
export declare function getAttachments(key: string): Either<Error, Attachments>; | ||
export declare function getAttachmentStream(params: AttachmentStreamParams): Either<Error, any>; | ||
export declare function removeAttachment(params: RemoveAttachmentParams): Either<Error, void>; | ||
export declare function getPermissions(params: GetPermissionsParams): Either<Error, GetPermissionsResult>; | ||
export declare function setPermissions(params: SetPermissionsParams): Either<Error, GetPermissionsResult>; | ||
export declare function getType(name: string): Either<Error, ContentType>; | ||
export declare function getTypes(): Either<Error, ContentType[]>; |
@@ -24,1 +24,41 @@ import { tryCatch, chain, fromNullable, right, left } from 'fp-ts/lib/Either'; | ||
} | ||
export function unpublish(params) { | ||
return tryCatch(function () { return content.unpublish(params); }, function (e) { return ({ errorKey: "PublishError", cause: String(e) }); }); | ||
} | ||
export function getChildren(params) { | ||
return tryCatch(function () { return content.getChildren(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} | ||
export function move(params) { | ||
return tryCatch(function () { return content.move(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} | ||
export function getSite(params) { | ||
return tryCatch(function () { return content.getSite(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} | ||
export function getSiteConfig(params) { | ||
return tryCatch(function () { return content.getSiteConfig(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} | ||
export function createMedia(params) { | ||
return tryCatch(function () { return content.createMedia(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} | ||
export function getAttachments(key) { | ||
return pipe(tryCatch(function () { return content.getAttachments(key); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }), chain(fromNullable({ errorKey: "NotFoundError" }))); | ||
} | ||
// The return type is Java: com.google.common.io.ByteSource | ||
export function getAttachmentStream(params) { | ||
return pipe(tryCatch(function () { return content.getAttachmentStream(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }), chain(fromNullable({ errorKey: "NotFoundError" }))); | ||
} | ||
export function removeAttachment(params) { | ||
return tryCatch(function () { return content.removeAttachment(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} | ||
export function getPermissions(params) { | ||
return tryCatch(function () { return content.getPermissions(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} | ||
export function setPermissions(params) { | ||
return tryCatch(function () { return content.setPermissions(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} | ||
export function getType(name) { | ||
return tryCatch(function () { return content.getType(name); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} | ||
export function getTypes() { | ||
return tryCatch(function () { return content.getTypes(); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} |
@@ -5,3 +5,3 @@ import { Either } from 'fp-ts/lib/Either'; | ||
_id: string; | ||
name: string; | ||
_name: string; | ||
_path: string; | ||
@@ -24,5 +24,14 @@ creator: string; | ||
page: any; | ||
attachments: object; | ||
attachments: Attachments; | ||
publish: any; | ||
} | ||
export interface Attachment { | ||
name: string; | ||
label?: string; | ||
size: number; | ||
mimeType: string; | ||
} | ||
export declare type Attachments = { | ||
[key: string]: Attachment; | ||
}; | ||
export interface QueryContentParams { | ||
@@ -83,2 +92,94 @@ start?: number; | ||
} | ||
export interface UnpublishContentParams { | ||
keys: string[]; | ||
} | ||
export interface GetChildrenParams { | ||
key: string; | ||
start?: number; | ||
count?: number; | ||
sort?: string; | ||
} | ||
export interface MoveParams { | ||
source: string; | ||
target: string; | ||
} | ||
export interface GetSiteParams { | ||
key: string; | ||
} | ||
export interface Site<T> { | ||
_id: string; | ||
_name: string; | ||
_path: string; | ||
type: string; | ||
hasChildren: Boolean; | ||
valid: Boolean; | ||
data: { | ||
siteConfig: SiteConfig<T>; | ||
}; | ||
x: { | ||
[key: string]: string; | ||
}; | ||
page: any; | ||
attachments: object; | ||
publish: any; | ||
} | ||
export interface SiteConfig<T> { | ||
applicationKey: string; | ||
config: T; | ||
} | ||
export interface GetSiteConfigParams { | ||
key: string; | ||
applicationKey: string; | ||
} | ||
export interface AttachmentStreamParams { | ||
key: string; | ||
name: string; | ||
} | ||
export interface RemoveAttachmentParams { | ||
key: string; | ||
name: string | string[]; | ||
} | ||
export interface CreateMediaParams { | ||
name?: string; | ||
parentPath?: string; | ||
mimeType?: string; | ||
focalX?: number; | ||
focalY?: number; | ||
data: any; | ||
} | ||
export interface GetPermissionsParams { | ||
key: string; | ||
} | ||
export interface GetPermissionsResult { | ||
inheritsPermissions: boolean; | ||
permissions: PermissionsParams[]; | ||
} | ||
export interface PermissionsParams { | ||
principal: string; | ||
allow: string[]; | ||
deny: string[]; | ||
} | ||
export interface SetPermissionsParams { | ||
key: string; | ||
inheritPermissions: boolean; | ||
overwriteChildPermissions: boolean; | ||
permissions: PermissionsParams[]; | ||
} | ||
export interface IconType { | ||
data?: any; | ||
mimeType?: string; | ||
modifiedTime?: string; | ||
} | ||
export interface ContentType { | ||
"name": string; | ||
"displayName": string; | ||
"description": string; | ||
"superType": string; | ||
"abstract": boolean; | ||
"final": boolean; | ||
"allowChildContent": boolean; | ||
"displayNameExpression": string; | ||
"icon": IconType[]; | ||
"form": any[]; | ||
} | ||
export declare function get<T>(params: GetContentParams): Either<Error, Content<T>>; | ||
@@ -90,1 +191,14 @@ export declare function query<T>(params: QueryContentParams): Either<Error, QueryResponse<T>>; | ||
export declare function publish(params: PublishContentParams): Either<Error, PublishResponse>; | ||
export declare function unpublish(params: UnpublishContentParams): Either<Error, string[]>; | ||
export declare function getChildren<T>(params: GetChildrenParams): Either<Error, QueryResponse<T>>; | ||
export declare function move<T>(params: MoveParams): Either<Error, Content<T>>; | ||
export declare function getSite<T>(params: GetSiteParams): Either<Error, Site<T>>; | ||
export declare function getSiteConfig<T>(params: GetSiteConfigParams): Either<Error, T>; | ||
export declare function createMedia<T>(params: CreateMediaParams): Either<Error, Content<T>>; | ||
export declare function getAttachments(key: string): Either<Error, Attachments>; | ||
export declare function getAttachmentStream(params: AttachmentStreamParams): Either<Error, any>; | ||
export declare function removeAttachment(params: RemoveAttachmentParams): Either<Error, void>; | ||
export declare function getPermissions(params: GetPermissionsParams): Either<Error, GetPermissionsResult>; | ||
export declare function setPermissions(params: SetPermissionsParams): Either<Error, GetPermissionsResult>; | ||
export declare function getType(name: string): Either<Error, ContentType>; | ||
export declare function getTypes(): Either<Error, ContentType[]>; |
@@ -32,1 +32,54 @@ "use strict"; | ||
exports.publish = publish; | ||
function unpublish(params) { | ||
return Either_1.tryCatch(function () { return content.unpublish(params); }, function (e) { return ({ errorKey: "PublishError", cause: String(e) }); }); | ||
} | ||
exports.unpublish = unpublish; | ||
function getChildren(params) { | ||
return Either_1.tryCatch(function () { return content.getChildren(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} | ||
exports.getChildren = getChildren; | ||
function move(params) { | ||
return Either_1.tryCatch(function () { return content.move(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} | ||
exports.move = move; | ||
function getSite(params) { | ||
return Either_1.tryCatch(function () { return content.getSite(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} | ||
exports.getSite = getSite; | ||
function getSiteConfig(params) { | ||
return Either_1.tryCatch(function () { return content.getSiteConfig(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} | ||
exports.getSiteConfig = getSiteConfig; | ||
function createMedia(params) { | ||
return Either_1.tryCatch(function () { return content.createMedia(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} | ||
exports.createMedia = createMedia; | ||
function getAttachments(key) { | ||
return pipeable_1.pipe(Either_1.tryCatch(function () { return content.getAttachments(key); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }), Either_1.chain(Either_1.fromNullable({ errorKey: "NotFoundError" }))); | ||
} | ||
exports.getAttachments = getAttachments; | ||
// The return type is Java: com.google.common.io.ByteSource | ||
function getAttachmentStream(params) { | ||
return pipeable_1.pipe(Either_1.tryCatch(function () { return content.getAttachmentStream(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }), Either_1.chain(Either_1.fromNullable({ errorKey: "NotFoundError" }))); | ||
} | ||
exports.getAttachmentStream = getAttachmentStream; | ||
function removeAttachment(params) { | ||
return Either_1.tryCatch(function () { return content.removeAttachment(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} | ||
exports.removeAttachment = removeAttachment; | ||
function getPermissions(params) { | ||
return Either_1.tryCatch(function () { return content.getPermissions(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} | ||
exports.getPermissions = getPermissions; | ||
function setPermissions(params) { | ||
return Either_1.tryCatch(function () { return content.setPermissions(params); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} | ||
exports.setPermissions = setPermissions; | ||
function getType(name) { | ||
return Either_1.tryCatch(function () { return content.getType(name); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} | ||
exports.getType = getType; | ||
function getTypes() { | ||
return Either_1.tryCatch(function () { return content.getTypes(); }, function (e) { return ({ errorKey: "InternalServerError", cause: String(e) }); }); | ||
} | ||
exports.getTypes = getTypes; |
{ | ||
"name": "enonic-fp", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Functional programming helpers for Enonic XP", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
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
41251
988