Comparing version 0.2.39 to 0.2.40
@@ -11,4 +11,5 @@ module.exports = { | ||
rules: { | ||
"@typescript-eslint/no-explicit-any": "off" | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/ban-types": "off" | ||
}, | ||
}; |
import { IOEither } from "fp-ts/lib/IOEither"; | ||
import { EnonicError } from "./errors"; | ||
import { NodeCreateParams, NodeQueryParams, NodeQueryResponse, RepoConnection, RepoNode, Source } from "enonic-types/lib/node"; | ||
import { DiffParams, DiffResponse, FindVersionsParams, MultiRepoConnection, MultiRepoConnectParams, NodeCreateParams, NodeFindChildrenParams, NodeModifyParams, NodeQueryParams, NodeQueryResponse, NodeVersionQueryResult, RepoConnection, RepoNode, Source } from "enonic-types/lib/node"; | ||
/** | ||
@@ -9,16 +9,42 @@ * Creates a connection to a repository with a given branch and authentication info. | ||
/** | ||
* This function fetches nodes. | ||
* Creates a connection to several repositories with a given branch and authentication info. | ||
*/ | ||
export declare function get<A>(repo: RepoConnection, keys: string | ReadonlyArray<string>): IOEither<EnonicError, ReadonlyArray<A & RepoNode>>; | ||
export declare function multiRepoConnect(params: MultiRepoConnectParams): IOEither<EnonicError, MultiRepoConnection>; | ||
/** | ||
* This function creates a node. | ||
* Creating a node. To create a content where the name is not important and there could be multiple instances under the | ||
* same parent content, skip the name parameter and specify a displayName. | ||
*/ | ||
export declare function create<A>(repo: RepoConnection, params: A & NodeCreateParams): IOEither<EnonicError, A & RepoNode>; | ||
/** | ||
* This function deletes a node or nodes. | ||
* Deleting a node or nodes. | ||
*/ | ||
export declare function remove(repo: RepoConnection, keys: ReadonlyArray<string>): IOEither<EnonicError, boolean>; | ||
export declare function remove(repo: RepoConnection, keys: string | ReadonlyArray<string>): IOEither<EnonicError, ReadonlyArray<string>>; | ||
/** | ||
* Resolves the differences for a node between current and given branch. | ||
*/ | ||
export declare function diff(repo: RepoConnection, params: DiffParams): IOEither<EnonicError, DiffResponse>; | ||
/** | ||
* Checking if a node or nodes exist for the current context. | ||
*/ | ||
export declare function exists(repo: RepoConnection, keys: string | ReadonlyArray<string>): IOEither<EnonicError, ReadonlyArray<string>>; | ||
/** | ||
* Fetch the versions of a node. | ||
*/ | ||
export declare function findVersions(repo: RepoConnection, params: FindVersionsParams): IOEither<EnonicError, NodeVersionQueryResult>; | ||
/** | ||
* Fetches specific nodes by path or ID. | ||
*/ | ||
export declare function get<A>(repo: RepoConnection, key: string): IOEither<EnonicError, A & RepoNode>; | ||
export declare function get<A>(repo: RepoConnection, keys: ReadonlyArray<string>): IOEither<EnonicError, ReadonlyArray<A & RepoNode>>; | ||
/** | ||
* This command queries nodes. | ||
*/ | ||
export declare function query(repo: RepoConnection, params: NodeQueryParams): IOEither<EnonicError, NodeQueryResponse>; | ||
/** | ||
* This function modifies a node. | ||
*/ | ||
export declare function modify<A>(repo: RepoConnection, params: NodeModifyParams<A>): IOEither<EnonicError, A & RepoNode>; | ||
/** | ||
* Get children for given node. | ||
*/ | ||
export declare function findChildren(repo: RepoConnection, params: NodeFindChildrenParams): IOEither<EnonicError, NodeQueryResponse>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.query = exports.remove = exports.create = exports.get = exports.connect = void 0; | ||
var IOEither_1 = require("fp-ts/lib/IOEither"); | ||
var pipeable_1 = require("fp-ts/lib/pipeable"); | ||
exports.findChildren = exports.modify = exports.query = exports.get = exports.findVersions = exports.exists = exports.diff = exports.remove = exports.create = exports.multiRepoConnect = exports.connect = void 0; | ||
var utils_1 = require("./utils"); | ||
@@ -16,10 +14,11 @@ var nodeLib = __non_webpack_require__("/lib/xp/node"); | ||
/** | ||
* This function fetches nodes. | ||
* Creates a connection to several repositories with a given branch and authentication info. | ||
*/ | ||
function get(repo, keys) { | ||
return pipeable_1.pipe(utils_1.catchEnonicError(function () { return repo.get(keys); }), IOEither_1.map(function (data) { return (Array.isArray(data) ? data : [data]); })); | ||
function multiRepoConnect(params) { | ||
return utils_1.catchEnonicError(function () { return nodeLib.multiRepoConnect(params); }); | ||
} | ||
exports.get = get; | ||
exports.multiRepoConnect = multiRepoConnect; | ||
/** | ||
* This function creates a node. | ||
* Creating a node. To create a content where the name is not important and there could be multiple instances under the | ||
* same parent content, skip the name parameter and specify a displayName. | ||
*/ | ||
@@ -31,3 +30,3 @@ function create(repo, params) { | ||
/** | ||
* This function deletes a node or nodes. | ||
* Deleting a node or nodes. | ||
*/ | ||
@@ -39,2 +38,29 @@ function remove(repo, keys) { | ||
/** | ||
* Resolves the differences for a node between current and given branch. | ||
*/ | ||
function diff(repo, params) { | ||
return utils_1.catchEnonicError(function () { return repo.diff(params); }); | ||
} | ||
exports.diff = diff; | ||
/** | ||
* Checking if a node or nodes exist for the current context. | ||
*/ | ||
function exists(repo, keys) { | ||
return utils_1.catchEnonicError(function () { return repo.exists(keys); }); | ||
} | ||
exports.exists = exists; | ||
/** | ||
* Fetch the versions of a node. | ||
*/ | ||
function findVersions(repo, params) { | ||
return utils_1.catchEnonicError(function () { return repo.findVersions(params); }); | ||
} | ||
exports.findVersions = findVersions; | ||
function get(repo, keys) { | ||
return utils_1.isString(keys) | ||
? utils_1.catchEnonicError(function () { return repo.get(keys); }) | ||
: utils_1.catchEnonicError(function () { return repo.get(keys); }); | ||
} | ||
exports.get = get; | ||
/** | ||
* This command queries nodes. | ||
@@ -46,1 +72,15 @@ */ | ||
exports.query = query; | ||
/** | ||
* This function modifies a node. | ||
*/ | ||
function modify(repo, params) { | ||
return utils_1.catchEnonicError(function () { return repo.modify(params); }); | ||
} | ||
exports.modify = modify; | ||
/** | ||
* Get children for given node. | ||
*/ | ||
function findChildren(repo, params) { | ||
return utils_1.catchEnonicError(function () { return repo.findChildren(params); }); | ||
} | ||
exports.findChildren = findChildren; |
@@ -11,3 +11,3 @@ import { IOEither } from "fp-ts/lib/IOEither"; | ||
export declare function fromNullable<E>(e: E): <A>(a: A | null | undefined) => IOEither<E, A>; | ||
export declare function isJavaThrowable(t: any): t is Throwable; | ||
export declare function isJavaThrowable(t: Throwable | unknown): t is Throwable; | ||
export declare function getMessage(t: Throwable | unknown): string | undefined; | ||
@@ -14,0 +14,0 @@ export declare function getStackTraceAsString(t: Throwable | unknown): string | undefined; |
{ | ||
"name": "enonic-fp", | ||
"version": "0.2.39", | ||
"version": "0.2.40", | ||
"description": "Functional programming helpers for Enonic XP", | ||
@@ -28,8 +28,8 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"enonic-types": "^0.0.54", | ||
"fp-ts": "^2.6.1" | ||
"enonic-types": "^0.0.60", | ||
"fp-ts": "^2.6.2" | ||
}, | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^2.34.0", | ||
"@typescript-eslint/parser": "^2.34.0", | ||
"@typescript-eslint/eslint-plugin": "^3.1.0", | ||
"@typescript-eslint/parser": "^3.1.0", | ||
"eslint": "^7.0.0", | ||
@@ -36,0 +36,0 @@ "rimraf": "^3.0.2", |
73260
1331
+ Addedenonic-types@0.0.60(transitive)
- Removedenonic-types@0.0.54(transitive)
Updatedenonic-types@^0.0.60
Updatedfp-ts@^2.6.2