Comparing version 0.3.17 to 0.5.0-next.0
/// <reference types="enonic-types" /> | ||
import { IOEither } from "fp-ts/es6/IOEither"; | ||
import { Semigroup } from "fp-ts/es6/Semigroup"; | ||
import type { AddAttachmentParams, Attachments, AttachmentStreamParams, ByteSource, Content, ContentType, CreateContentParams, CreateMediaParams, DeleteContentParams, ExistsParams, GetChildrenParams, GetContentParams, GetOutboundDependenciesParams, GetPermissionsParams, GetPermissionsResult, GetSiteConfigParams, GetSiteParams, ModifyContentParams, MoveParams, Page, PublishContentParams, PublishResponse, QueryContentParams, QueryContentParamsWithSort, QueryResponse, QueryResponseMetaDataScore, QueryResponseMetaDataSort, RemoveAttachmentParams, SetPermissionsParams, Site, UnpublishContentParams } from "/lib/xp/content"; | ||
import type { AddAttachmentParams, Attachments, AttachmentStreamParams, ByteSource, Content, ContentType, CreateContentParams, CreateMediaParams, DeleteContentParams, ExistsParams, GetChildrenParams, GetContentParams, GetOutboundDependenciesParams, GetPermissionsParams, GetPermissionsResult, GetSiteConfigParams, GetSiteParams, ModifyContentParams, MoveParams, PublishContentParams, PublishResponse, QueryContentParams, QueryContentParamsWithSort, QueryResponse, RemoveAttachmentParams, SetPermissionsParams, Site, UnpublishContentParams } from "/lib/xp/content"; | ||
import { EnonicError } from "./errors"; | ||
import { ContentTypeByName, KeyOfContentType, LiteralContentTypeNames, QueryResponseSorted } from "*/lib/xp/content"; | ||
export declare function get<A extends object>(params: GetContentParams): IOEither<EnonicError, Content<A>>; | ||
export declare function get<A extends object>(key: string): IOEither<EnonicError, Content<A>>; | ||
export declare function get<A extends object>(paramsOrKey: GetContentParams | string): IOEither<EnonicError, Content<A>>; | ||
export declare function query<Data extends object, AggregationKeys extends string = never>(params: QueryContentParams<AggregationKeys>): IOEither<EnonicError, QueryResponse<Data, AggregationKeys, QueryResponseMetaDataScore>>; | ||
export declare function query<Data extends object, AggregationKeys extends string = never>(params: QueryContentParamsWithSort<AggregationKeys>): IOEither<EnonicError, QueryResponse<Data, AggregationKeys, QueryResponseMetaDataSort>>; | ||
export declare function create<A extends object>(params: CreateContentParams<A>): IOEither<EnonicError, Content<A>>; | ||
export declare function modify<A extends object, PageConfig extends object = object, XData extends object = object>(params: ModifyContentParams<A, PageConfig, XData>): IOEither<EnonicError, Content<A, PageConfig, XData>>; | ||
export declare function query<Data, ContentTypeName extends LiteralContentTypeNames = KeyOfContentType<Data>>(params: QueryContentParams<ContentTypeName>): IOEither<EnonicError, QueryResponse<Data>>; | ||
export declare function query<Data, ContentTypeName extends LiteralContentTypeNames = KeyOfContentType<Data>>(params: QueryContentParamsWithSort<ContentTypeName>): IOEither<EnonicError, QueryResponseSorted<Data>>; | ||
export declare function create<Data, ContentTypeName extends LiteralContentTypeNames>(params: CreateContentParams<Data, ContentTypeName>): IOEither<EnonicError, Content<ContentTypeByName<ContentTypeName, Data>>>; | ||
export declare function modify<Data>(params: ModifyContentParams<Data>): IOEither<EnonicError, Content<Data>>; | ||
/** | ||
* Require only Content._id and Content.data | ||
*/ | ||
declare type PartialContent<A extends object, PageConfig extends object = object, XData extends object = object> = Partial<Content<A, PageConfig, XData>> & Pick<Content<A, PageConfig, XData>, "_id" | "data">; | ||
export interface ConcatContentParams<A extends object, PageConfig extends object = object, XData extends object = object> { | ||
readonly semigroup: Semigroup<PartialContent<A, PageConfig, XData>>; | ||
declare type PartialContent<Data> = Partial<Content<Data>> & Pick<Content<Data>, "_id" | "data">; | ||
export interface ConcatContentParams<Data> { | ||
readonly semigroup: Semigroup<PartialContent<Data>>; | ||
readonly key?: string; | ||
@@ -26,4 +27,4 @@ readonly requireValid?: boolean; | ||
*/ | ||
export declare function modifyWithSemigroup<A extends object, PageConfig extends object = object, XData extends object = object>(params: ConcatContentParams<A, PageConfig, XData>): (newContent: PartialContent<A, PageConfig, XData>) => IOEither<EnonicError, Content<A, PageConfig, XData>>; | ||
export declare function getContentSemigroup<A extends object, PageConfig extends object, XData extends object>(dataSemigroup: Semigroup<A>, pageConfigSemigroup?: Semigroup<Page<PageConfig> | undefined>, xDataSemigroup?: Semigroup<Record<string, Record<string, XData>> | undefined>): Semigroup<PartialContent<A, PageConfig, XData>>; | ||
export declare function modifyWithSemigroup<Data>(params: ConcatContentParams<Data>): (newContent: PartialContent<Data>) => IOEither<EnonicError, Content<Data>>; | ||
export declare function getContentSemigroup<Data, Type extends string = KeyOfContentType<Data>>(dataSemigroup: Semigroup<Data>, xDataSemigroup?: Semigroup<XP.XData>): Semigroup<Content<Data, Type>>; | ||
export declare function remove(params: DeleteContentParams): IOEither<EnonicError, void>; | ||
@@ -42,5 +43,5 @@ export declare function remove(key: string): IOEither<EnonicError, void>; | ||
export declare function move<A extends object>(params: MoveParams): IOEither<EnonicError, Content<A>>; | ||
export declare function getSite<A extends object, PageConfig extends object = never>(params: GetSiteParams): IOEither<EnonicError, Site<A, PageConfig>>; | ||
export declare function getSite<A extends object, PageConfig extends object = never>(key: string): IOEither<EnonicError, Site<A, PageConfig>>; | ||
export declare function getSiteConfig<A extends object>(params: GetSiteConfigParams): IOEither<EnonicError, A>; | ||
export declare function getSite(params: GetSiteParams): IOEither<EnonicError, Site>; | ||
export declare function getSite(key: string): IOEither<EnonicError, Site>; | ||
export declare function getSiteConfig(params: GetSiteConfigParams): IOEither<EnonicError, XP.SiteConfig>; | ||
export declare function createMedia<A extends object>(params: CreateMediaParams): IOEither<EnonicError, Content<A>>; | ||
@@ -47,0 +48,0 @@ export declare function addAttachment(params: AddAttachmentParams): IOEither<EnonicError, void>; |
@@ -6,6 +6,6 @@ "use strict"; | ||
var IOEither_1 = require("fp-ts/es6/IOEither"); | ||
var Semigroup_1 = require("fp-ts/es6/Semigroup"); | ||
var utils_1 = require("./utils"); | ||
var errors_1 = require("./errors"); | ||
var contentLib = require("/lib/xp/content"); | ||
var Semigroup_1 = require("fp-ts/Semigroup"); | ||
function get(paramsOrKey) { | ||
@@ -38,5 +38,3 @@ return (0, function_1.pipe)((0, utils_1.stringToByKey)(paramsOrKey), function (params) { return (0, errors_1.catchEnonicError)(function () { return contentLib.get(params); }); }, (0, IOEither_1.chain)((0, utils_1.fromNullable)(errors_1.notFoundError))); | ||
requireValid: params.requireValid, | ||
editor: function (oldContent) { | ||
return params.semigroup.concat(oldContent, newContent); | ||
}, | ||
editor: function (oldContent) { return params.semigroup.concat(oldContent, newContent); }, | ||
}); | ||
@@ -47,4 +45,3 @@ }); | ||
exports.modifyWithSemigroup = modifyWithSemigroup; | ||
function getContentSemigroup(dataSemigroup, pageConfigSemigroup, xDataSemigroup) { | ||
if (pageConfigSemigroup === void 0) { pageConfigSemigroup = (0, Semigroup_1.last)(); } | ||
function getContentSemigroup(dataSemigroup, xDataSemigroup) { | ||
if (xDataSemigroup === void 0) { xDataSemigroup = (0, Semigroup_1.last)(); } | ||
@@ -70,6 +67,7 @@ return { | ||
data: dataSemigroup.concat(x.data, y.data), | ||
x: xDataSemigroup.concat(y.x, x.x), | ||
page: pageConfigSemigroup.concat(y.page, x.page), | ||
x: xDataSemigroup.concat(x.data, y.data), | ||
page: x.page, | ||
attachments: (_m = y.attachments) !== null && _m !== void 0 ? _m : x.attachments, | ||
publish: (_o = y.publish) !== null && _o !== void 0 ? _o : x.publish, | ||
workflow: x.workflow, | ||
}); | ||
@@ -76,0 +74,0 @@ }, |
/// <reference types="enonic-types" /> | ||
/// <reference types="enonic-types" /> | ||
/// <reference types="enonic-types" /> | ||
/// <reference types="enonic-types" /> | ||
import { IO } from "fp-ts/es6/IO"; | ||
@@ -3,0 +6,0 @@ import type { ResourceKey } from "/lib/thymeleaf"; |
/// <reference types="enonic-types" /> | ||
/// <reference types="enonic-types" /> | ||
import type { BreadcrumbMenu, GetBreadcrumbMenuParams, GetMenuParams, GetMenuTreeParams, MenuItem, MenuTree } from "/lib/menu"; | ||
@@ -3,0 +4,0 @@ import type { Content } from "/lib/xp/content"; |
@@ -21,3 +21,3 @@ /// <reference types="enonic-types" /> | ||
*/ | ||
export declare function remove(repo: RepoConnection, keys: string | ReadonlyArray<string>): IOEither<EnonicError, ReadonlyArray<string>>; | ||
export declare function remove(repo: RepoConnection, keys: string | Array<string>): IOEither<EnonicError, ReadonlyArray<string>>; | ||
/** | ||
@@ -30,3 +30,3 @@ * Resolves the differences for a node between current and given branch. | ||
*/ | ||
export declare function exists(repo: RepoConnection, keys: string | ReadonlyArray<string>): IOEither<EnonicError, ReadonlyArray<string>>; | ||
export declare function exists(repo: RepoConnection, keys: string | Array<string>): IOEither<EnonicError, ReadonlyArray<string>>; | ||
/** | ||
@@ -40,7 +40,7 @@ * Fetch the versions of a node. | ||
export declare function get<A>(repo: RepoConnection, key: string | NodeGetParams): IOEither<EnonicError, A & RepoNode>; | ||
export declare function get<A>(repo: RepoConnection, keys: ReadonlyArray<string | NodeGetParams>): IOEither<EnonicError, ReadonlyArray<A & RepoNode>>; | ||
export declare function get<A>(repo: RepoConnection, keys: Array<string | NodeGetParams>): IOEither<EnonicError, ReadonlyArray<A & RepoNode>>; | ||
/** | ||
* This command queries nodes. | ||
*/ | ||
export declare function query<B extends string>(repo: RepoConnection, params: NodeQueryParams<B>): IOEither<EnonicError, NodeQueryResponse<B>>; | ||
export declare function query(repo: RepoConnection, params: NodeQueryParams): IOEither<EnonicError, NodeQueryResponse>; | ||
/** | ||
@@ -53,2 +53,2 @@ * This function modifies a node. | ||
*/ | ||
export declare function findChildren(repo: RepoConnection, params: NodeFindChildrenParams): IOEither<EnonicError, NodeQueryResponse<never>>; | ||
export declare function findChildren(repo: RepoConnection, params: NodeFindChildrenParams): IOEither<EnonicError, NodeQueryResponse>; |
{ | ||
"name": "enonic-fp", | ||
"version": "0.3.17", | ||
"version": "0.5.0-next.0", | ||
"sideEffects": false, | ||
@@ -27,15 +27,15 @@ "description": "Functional programming helpers for Enonic XP", | ||
"dependencies": { | ||
"enonic-types": "^0.3.9", | ||
"fp-ts": "^2.11.5" | ||
"enonic-types": "^0.5.0-next.1", | ||
"fp-ts": "^2.12.1" | ||
}, | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^5.7.0", | ||
"@typescript-eslint/parser": "^5.7.0", | ||
"eslint": "^8.4.1", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"prettier": "^2.5.1", | ||
"@typescript-eslint/eslint-plugin": "^5.30.0", | ||
"@typescript-eslint/parser": "^5.30.0", | ||
"eslint": "^8.18.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"prettier": "^2.7.1", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^4.5.4" | ||
"typescript": "^4.7.4" | ||
} | ||
} |
/// <reference types="enonic-types" /> | ||
/// <reference types="enonic-types" /> | ||
import { IOEither } from "fp-ts/es6/IOEither"; | ||
@@ -6,3 +7,3 @@ import { type EnonicError } from "./errors"; | ||
import type { AssetUrlParams, AttachmentUrlParams, Component, ComponentUrlParams, IdProviderUrlParams, ImagePlaceHolderParams, ImageUrlParams, LoginUrlParams, LogoutUrlParams, MultipartItem, PageUrlParams, ProcessHtmlParams, ServiceUrlParams, UrlParams } from "/lib/xp/portal"; | ||
export declare function getContent<A extends object, PageConfig extends object = never>(): IOEither<EnonicError, Content<A, PageConfig>>; | ||
export declare function getContent<Data>(): IOEither<EnonicError, Content<Data>>; | ||
export declare function getComponent<Config extends object = never>(): IOEither<EnonicError, Component<Config>>; | ||
@@ -30,4 +31,4 @@ export declare function getIdProviderKey(): IOEither<EnonicError, string>; | ||
export declare function getMultipartText(name: string, index?: number): IOEither<EnonicError, string | undefined>; | ||
export declare function getSite<A extends object>(): IOEither<EnonicError, Site<A>>; | ||
export declare function getSiteConfig<A extends object>(): IOEither<EnonicError, A>; | ||
export declare function getSite(): IOEither<EnonicError, Site>; | ||
export declare function getSiteConfig(): IOEither<EnonicError, XP.SiteConfig>; | ||
export declare function idProviderUrl(params: IdProviderUrlParams): string; | ||
@@ -34,0 +35,0 @@ export declare function imagePlaceholder(params: ImagePlaceHolderParams): string; |
/// <reference types="enonic-types" /> | ||
/// <reference types="enonic-types" /> | ||
import type { GetWebSocketUrlParams, TurboStreamAction, TurboStreamsLibrary, TurboStreamsParams, TurboStreamsRemoveParams } from "/lib/turbo-streams"; | ||
@@ -3,0 +4,0 @@ import { IOEither } from "fp-ts/es6/IOEither"; |
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
2113
111865
+ Addedenonic-types@0.5.0(transitive)
- Removedenonic-types@0.3.23(transitive)
Updatedenonic-types@^0.5.0-next.1
Updatedfp-ts@^2.12.1