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

contensis-management-api

Package Overview
Dependencies
Maintainers
5
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

contensis-management-api - npm Package Compare versions

Comparing version 1.0.0-beta.20 to 1.0.0-rc.1

bundle-es2015/models/ISecurityOperations.d.ts

5

bundle-es2015/client/client.d.ts

@@ -1,2 +0,2 @@

import { Config, ContensisClient, IContentTypeOperations, IEntryOperations, INodeOperations, IProjectOperations, IRoleOperations, IPermissionOperations, IComponentOperations, IGroupOperations, IUserOperations } from '../models';
import { Config, ContensisClient, IContentTypeOperations, IEntryOperations, INodeOperations, IProjectOperations, IRoleOperations, IPermissionOperations, IComponentOperations, ISecurityOperations } from '../models';
import { ClientConfig } from './client-config';

@@ -11,3 +11,2 @@ import { ClientParams } from 'contensis-core-api';

entries: IEntryOperations;
groups: IGroupOperations;
nodes: INodeOperations;

@@ -17,3 +16,3 @@ permissions: IPermissionOperations;

roles: IRoleOperations;
users: IUserOperations;
security: ISecurityOperations;
bearerToken: string;

@@ -20,0 +19,0 @@ bearerTokenExpiryDate: Date;

6

bundle-es2015/client/client.js

@@ -10,4 +10,3 @@ import { EntryOperations } from '../entries/entry-operations';

import { ComponentOperations } from '../components/component-operations';
import { GroupOperations } from '../groups/group-operations';
import { UserOperations } from '../users/user-operations';
import { GroupOperations, UserOperations, SecurityOperations } from '../security';
import * as Scopes from './scopes';

@@ -25,3 +24,2 @@ import fetch from 'cross-fetch';

this.entries = new EntryOperations(this.httpClient, this);
this.groups = new GroupOperations(this.httpClient, this);
this.nodes = new NodeOperations(this.httpClient, this);

@@ -31,3 +29,3 @@ this.permissions = new PermissionOperations(this.httpClient, this);

this.roles = new RoleOperations(this.httpClient, this);
this.users = new UserOperations(this.httpClient, this);
this.security = new SecurityOperations(new UserOperations(this.httpClient, this), new GroupOperations(this.httpClient, this));
}

@@ -34,0 +32,0 @@ static create(config = null) {

@@ -17,3 +17,4 @@ import { Entry, EntryGetOptions, EntryListOptions, IEntryOperations, ContensisClient, WorkflowTrigger } from '../models';

invokeWorkflowByTrigger(entry: Entry, workflowTrigger: WorkflowTrigger): Promise<Entry>;
private searchUsingPost;
private ensureIsNode;
}

@@ -1,2 +0,2 @@

import { defaultMapperForLanguage, defaultMapperForLatestVersionStatus, UrlBuilder, isNodejs, isString } from 'contensis-core-api';
import { defaultMapperForLanguage, defaultMapperForLatestVersionStatus, UrlBuilder, isNodejs, isString, isBrowser, isIE } from 'contensis-core-api';
import * as FormData from 'form-data';

@@ -54,12 +54,26 @@ import * as fs from 'graceful-fs';

let params = this.contensisClient.getParams();
query.pageSize = query.pageSize || params.pageSize;
query.pageIndex = query.pageIndex || 0;
let url = UrlBuilder.create('/api/management/projects/:projectId/entries/search')
.setParams(params)
let pageSize = query.pageSize || params.pageSize;
let pageIndex = query.pageIndex || 0;
let orderBy = (query.orderBy && (query.orderBy._items || query.orderBy));
let { clientType, clientDetails, projectId, language, responseHandler, rootUrl, versionStatus, ...requestParams } = params;
let payload = {
...requestParams,
pageSize,
pageIndex,
where: JSON.stringify(query.where),
};
if (orderBy && orderBy.length > 0) {
payload['orderBy'] = JSON.stringify(orderBy);
}
let url = UrlBuilder.create('/api/management/projects/:projectId/entries/search', { ...payload })
.setParams({ ...payload, projectId })
.toUrl();
let absoluteUrl = (!params.rootUrl || params.rootUrl === '/') ? url : params.rootUrl + url;
if (isBrowser() && isIE() && absoluteUrl.length > 2083) {
return this.searchUsingPost(query);
}
return this.contensisClient.ensureBearerToken().then(() => {
return this.httpClient.request(url, {
method: 'POST',
method: 'GET',
headers: this.contensisClient.getHeaders(),
body: JSON.stringify(query)
});

@@ -237,2 +251,20 @@ });

}
searchUsingPost(query) {
if (!query) {
return new Promise((resolve) => { resolve(null); });
}
let params = this.contensisClient.getParams();
query.pageSize = query.pageSize || params.pageSize;
query.pageIndex = query.pageIndex || 0;
let url = UrlBuilder.create('/api/management/projects/:projectId/entries/search')
.setParams(params)
.toUrl();
return this.contensisClient.ensureBearerToken().then(() => {
return this.httpClient.request(url, {
method: 'POST',
headers: this.contensisClient.getHeaders(),
body: JSON.stringify(query)
});
});
}
ensureIsNode(functionName) {

@@ -239,0 +271,0 @@ if (!isNodejs()) {

@@ -5,2 +5,3 @@ import * as Contensis from '../index';

import fetch from 'cross-fetch';
import { toQuery } from 'contensis-core-api';
const Zengenti = { Contensis };

@@ -129,2 +130,300 @@ const global = window || this;

});
describe('Search entries', () => {
beforeEach(() => {
setDefaultSpy(global, {
pageIndex: 0,
pageSize: 25,
totalCount: 2,
items: [{
title: 'entry1'
},
{
title: 'entry2'
}
]
});
Zengenti.Contensis.Client.defaultClientConfig = null;
Zengenti.Contensis.Client.configure({
fetchFn: global.fetch
});
});
it('with query as Object', async () => {
let client = Zengenti.Contensis.Client.create(getDefaultConfig());
let orderBy = [{
asc: 'name'
}, {
desc: 'brewTypeCount'
}];
let where = [{
field: 'brewTypeCount',
greaterThan: 5
}, {
field: 'Origin',
in: ['Peru', 'Columbia']
}];
let query = {
pageIndex: 1,
pageSize: 50,
orderBy,
where
};
let entries = await client.entries.search(query);
let expectedQueryString = toQuery({
...query,
orderBy: JSON.stringify(orderBy),
where: JSON.stringify(where)
});
expect(global.fetch.calls.first().args[0]).toEqual(getDefaultAuthenticateUrl());
expect(global.fetch.calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`,
getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as the default Query instance ', async () => {
let client = Zengenti.Contensis.Client.create(getDefaultConfig());
let query = new Contensis.Query();
let entries = await client.entries.search(query);
let expectedQueryString = toQuery({
pageIndex: 0,
pageSize: 20,
where: JSON.stringify([])
});
expect(global.fetch.calls.first().args[0]).toEqual(getDefaultAuthenticateUrl());
expect(global.fetch.calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`,
getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as a specific Query instance ', async () => {
let client = Zengenti.Contensis.Client.create(getDefaultConfig());
let query = new Contensis.Query(Contensis.Op.startsWith('authorName', 'W'));
query.orderBy = Contensis.OrderBy.asc('authorName');
query.pageIndex = 1;
query.pageSize = 50;
let entries = await client.entries.search(query);
let expectedQueryString = toQuery({
pageIndex: 1,
pageSize: 50,
orderBy: JSON.stringify([{
asc: 'authorName'
}]),
where: JSON.stringify([{
field: 'authorName',
startsWith: 'W'
}])
});
expect(global.fetch.calls.first().args[0]).toEqual(getDefaultAuthenticateUrl());
expect(global.fetch.calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`,
getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as Object for distanceWithin operator', async () => {
let client = Zengenti.Contensis.Client.create(getDefaultConfig());
let orderBy = [{
asc: 'authorName'
}];
let where = [{
field: 'authorLocation',
distanceWithin: {
lat: 52.377,
lon: -2.749,
distance: '10mi'
}
}];
let query = {
pageIndex: 1,
pageSize: 50,
orderBy,
where
};
let entries = await client.entries.search(query);
let expectedQueryString = toQuery({
...query,
orderBy: JSON.stringify(orderBy),
where: JSON.stringify(where)
});
expect(global.fetch.calls.first().args[0]).toEqual(getDefaultAuthenticateUrl());
expect(global.fetch.calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`,
getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as Query instance for distanceWithin operator', async () => {
let client = Zengenti.Contensis.Client.create(getDefaultConfig());
let query = new Contensis.Query(Contensis.Op.distanceWithin('authorLocation', 52.377, -2.749, '10mi'));
query.orderBy = Contensis.OrderBy.asc('authorName');
query.pageIndex = 1;
query.pageSize = 50;
let entries = await client.entries.search(query);
let expectedQueryString = toQuery({
pageIndex: 1,
pageSize: 50,
orderBy: JSON.stringify([{
asc: 'authorName'
}]),
where: JSON.stringify([{
field: 'authorLocation',
distanceWithin: {
lat: 52.377,
lon: -2.749,
distance: '10mi'
}
}])
});
expect(global.fetch.calls.first().args[0]).toEqual(getDefaultAuthenticateUrl());
expect(global.fetch.calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`,
getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
});
describe('Search entries in IE browser', () => {
beforeEach(() => {
setDefaultSpy(global, {
pageIndex: 0,
pageSize: 25,
totalCount: 2,
items: [{
title: 'entry1'
},
{
title: 'entry2'
}
]
});
Zengenti.Contensis.Client.defaultClientConfig = null;
Zengenti.Contensis.Client.configure({
fetchFn: global.fetch
});
global.document.documentMode = 11;
});
it('with query as Object and url length = 2083', async () => {
let client = Zengenti.Contensis.Client.create(getDefaultConfig());
let orderBy = [{
asc: 'authorName'
}];
// use string with length = 1863
let where = [{
field: 'authorName',
// tslint:disable-next-line:max-line-length
startsWith: 'n123XX8OFpCGJg0OJXfKRRoOk69tWiEfnqi2y5eElXQP1ZjTo0MsozSnWSJqdAvXefl0wmmELbyRArciCS4heXVw9XvYGqKsHM0X4eOxWpP8Otz8OoRApVGiPWeL6nzxblSDcP58qh8wkgUGWPHg21WGrgduYXpvFDdKnAwF1z6YKBMv7sOaVTHowp6mpzndOqUn6caURbF3Ob4ybumG1vl8BEvfwRjpjpAuULobQLN9pt31BoosToBWLdvrkDhSeNPLzltvMIBVGOVn97zWvdsuAg4wxznEz8rLvLK48hLdN4BJ3eWYkfhfk8TbUkDt82ZQwXCmdTpqP6ODPKRc4qkglAabHjUBwOzz9QCwxp7xeupfPWgDQlHCYHsKQ5X7xsWa5hl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sEqs85zYg6MxkctOcQ0lxqv6s9y7Z7pcWbU0k8pmccUm3EDUideWwDnoftuUwIGVfnJrpZn7ihhVzEOB8ojbuGrO41mHZNa8tSlXz6cfg2LXRrRgWRFBMdkswg73HmVaDuvbF2LkwFjoPweHuh62uQb88gOg2Hbbip9212Mnx9gzed81bIRS5yvODYk50LJ7o9zkv3WPGIekAnMJgDVCBsekNxnR3XR0jMCLZx4t73Hm93vb7T8uzyylrbJz2BWyk1EpZ22uynFyIitDpAYHe483oeYwhfKfJPdKjaYsYZAM1ZKdfwK5o0vaRW3X5nlLHfe4QWcMZOAhCq8GVbQkUFcdPSqeZ2nOuPUzwAGGONpIBXm7FOITI9WPibTjCL'
}];
let query = {
pageIndex: 1,
pageSize: 50,
orderBy,
where
};
let entries = await client.entries.search(query);
let expectedQueryString = toQuery({
...query,
orderBy: JSON.stringify(orderBy),
where: JSON.stringify(where)
});
let url = `http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`;
expect(url.length).toEqual(2083);
expect(global.fetch.calls.first().args[0]).toEqual(getDefaultAuthenticateUrl());
expect(global.fetch.calls.mostRecent().args).toEqual([
url,
getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as Object and url length > 2083', async () => {
let client = Zengenti.Contensis.Client.create(getDefaultConfig());
let orderBy = [{
asc: 'authorName'
}];
// use string with length = 1864
let where = [{
field: 'authorName',
// tslint:disable-next-line:max-line-length
startsWith: 'n1234XX8OFpCGJg0OJXfKRRoOk69tWiEfnqi2y5eElXQP1ZjTo0MsozSnWSJqdAvXefl0wmmELbyRArciCS4heXVw9XvYGqKsHM0X4eOxWpP8Otz8OoRApVGiPWeL6nzxblSDcP58qh8wkgUGWPHg21WGrgduYXpvFDdKnAwF1z6YKBMv7sOaVTHowp6mpzndOqUn6caURbF3Ob4ybumG1vl8BEvfwRjpjpAuULobQLN9pt31BoosToBWLdvrkDhSeNPLzltvMI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jMtkLLtZg2r7nGEHLMD76ELxzKC3Zg269m3EW47wPKam9HuWMGjqnD0BghH5zlnRRxHVNgg5JZI5URcgGa6LfXh4zymO2xqSql1YAltvO7lHaIEnF2edze6KvEFJj1smsn57AWsEqs85zYg6MxkctOcQ0lxqv6s9y7Z7pcWbU0k8pmccUm3EDUideWwDnoftuUwIGVfnJrpZn7ihhVzEOB8ojbuGrO41mHZNa8tSlXz6cfg2LXRrRgWRFBMdkswg73HmVaDuvbF2LkwFjoPweHuh62uQb88gOg2Hbbip9212Mnx9gzed81bIRS5yvODYk50LJ7o9zkv3WPGIekAnMJgDVCBsekNxnR3XR0jMCLZx4t73Hm93vb7T8uzyylrbJz2BWyk1EpZ22uynFyIitDpAYHe483oeYwhfKfJPdKjaYsYZAM1ZKdfwK5o0vaRW3X5nlLHfe4QWcMZOAhCq8GVbQkUFcdPSqeZ2nOuPUzwAGGONpIBXm7FOITI9WPibTjCL'
}];
let query = {
pageIndex: 1,
pageSize: 50,
orderBy,
where
};
let entries = await client.entries.search(query);
expect(global.fetch.calls.first().args[0]).toEqual(getDefaultAuthenticateUrl());
expect(global.fetch.calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search`,
getDefaultRequest('POST', false, JSON.stringify(query))
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as Query instance and url length = 2083', async () => {
let client = Zengenti.Contensis.Client.create(getDefaultConfig());
// use string with length = 1863
// tslint:disable-next-line:max-line-length
const startsWithText = 'n123XX8OFpCGJg0OJXfKRRoOk69tWiEfnqi2y5eElXQP1ZjTo0MsozSnWSJqdAvXefl0wmmELbyRArciCS4heXVw9XvYGqKsHM0X4eOxWpP8Otz8OoRApVGiPWeL6nzxblSDcP58qh8wkgUGWPHg21WGrgduYXpvFDdKnAwF1z6YKBMv7sOaVTHowp6mpzndOqUn6caURbF3Ob4ybumG1vl8BEvfwRjpjpAuULobQLN9pt31BoosToB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1ITOP8MNnAPWrvlqvypjMtkLLtZg2r7nGEHLMD76ELxzKC3Zg269m3EW47wPKam9HuWMGjqnD0BghH5zlnRRxHVNgg5JZI5URcgGa6LfXh4zymO2xqSql1YAltvO7lHaIEnF2edze6KvEFJj1smsn57AWsEqs85zYg6MxkctOcQ0lxqv6s9y7Z7pcWbU0k8pmccUm3EDUideWwDnoftuUwIGVfnJrpZn7ihhVzEOB8ojbuGrO41mHZNa8tSlXz6cfg2LXRrRgWRFBMdkswg73HmVaDuvbF2LkwFjoPweHuh62uQb88gOg2Hbbip9212Mnx9gzed81bIRS5yvODYk50LJ7o9zkv3WPGIekAnMJgDVCBsekNxnR3XR0jMCLZx4t73Hm93vb7T8uzyylrbJz2BWyk1EpZ22uynFyIitDpAYHe483oeYwhfKfJPdKjaYsYZAM1ZKdfwK5o0vaRW3X5nlLHfe4QWcMZOAhCq8GVbQkUFcdPSqeZ2nOuPUzwAGGONpIBXm7FOITI9WPibTjCL';
let query = new Contensis.Query(Contensis.Op.startsWith('authorName', startsWithText));
query.orderBy = Contensis.OrderBy.asc('authorName');
query.pageIndex = 1;
query.pageSize = 50;
let entries = await client.entries.search(query);
let expectedQueryString = toQuery({
pageIndex: 1,
pageSize: 50,
orderBy: JSON.stringify([{
asc: 'authorName'
}]),
where: JSON.stringify([{
field: 'authorName',
startsWith: startsWithText
}])
});
let url = `http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`;
expect(url.length).toEqual(2083);
expect(global.fetch.calls.first().args[0]).toEqual(getDefaultAuthenticateUrl());
expect(global.fetch.calls.mostRecent().args).toEqual([
url,
getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as Query instance and url length > 2083', async () => {
let client = Zengenti.Contensis.Client.create(getDefaultConfig());
// use string with length = 1864
// tslint:disable-next-line:max-line-length
const startsWithText = 'n1234XX8OFpCGJg0OJXfKRRoOk69tWiEfnqi2y5eElXQP1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mvapbl3AubcOJm03HngzgHgjLUpM1UrPAyCn8kxwdx6ROw9e02ssMgAkoh9B9mecXFgl9TqxlG5jSbXQtvNiLWzSUnqeugCXcl2O6fhpnKCNpIW6PoAI1mbwBK5qxumQMKqKix964TOiCWfWUNnOBkcXVPVzzqPA1yLNn87KgVuODm9VpZnnoHSbnAzeLGb7vTZb1ITOP8MNnAPWrvlqvypjMtkLLtZg2r7nGEHLMD76ELxzKC3Zg269m3EW47wPKam9HuWMGjqnD0BghH5zlnRRxHVNgg5JZI5URcgGa6LfXh4zymO2xqSql1YAltvO7lHaIEnF2edze6KvEFJj1smsn57AWsEqs85zYg6MxkctOcQ0lxqv6s9y7Z7pcWbU0k8pmccUm3EDUideWwDnoftuUwIGVfnJrpZn7ihhVzEOB8ojbuGrO41mHZNa8tSlXz6cfg2LXRrRgWRFBMdkswg73HmVaDuvbF2LkwFjoPweHuh62uQb88gOg2Hbbip9212Mnx9gzed81bIRS5yvODYk50LJ7o9zkv3WPGIekAnMJgDVCBsekNxnR3XR0jMCLZx4t73Hm93vb7T8uzyylrbJz2BWyk1EpZ22uynFyIitDpAYHe483oeYwhfKfJPdKjaYsYZAM1ZKdfwK5o0vaRW3X5nlLHfe4QWcMZOAhCq8GVbQkUFcdPSqeZ2nOuPUzwAGGONpIBXm7FOITI9WPibTjCL';
let query = new Contensis.Query(Contensis.Op.startsWith('authorName', startsWithText));
query.orderBy = Contensis.OrderBy.asc('authorName');
query.pageIndex = 1;
query.pageSize = 50;
let entries = await client.entries.search(query);
expect(global.fetch.calls.first().args[0]).toEqual(getDefaultAuthenticateUrl());
expect(global.fetch.calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search`,
getDefaultRequest('POST', false, JSON.stringify(query))
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
});
});

@@ -9,4 +9,3 @@ import { IEntryOperations } from './IEntryOperations';

import { IComponentOperations } from './IComponentOperations';
import { IGroupOperations } from './IGroupOperations';
import { IUserOperations } from './IUserOperations';
import { ISecurityOperations } from './ISecurityOperations';
export interface ContensisClient extends IParamsProvider {

@@ -16,3 +15,2 @@ components: IComponentOperations;

entries: IEntryOperations;
groups: IGroupOperations;
nodes: INodeOperations;

@@ -22,3 +20,3 @@ permissions: IPermissionOperations;

roles: IRoleOperations;
users: IUserOperations;
security: ISecurityOperations;
getHeaders: (contentType?: string) => {

@@ -25,0 +23,0 @@ [key: string]: string;

@@ -27,2 +27,3 @@ export * from './AllowedPermissions';

export * from './IRoleOperations';
export * from './ISecurityOperations';
export * from './IUserOperations';

@@ -29,0 +30,0 @@ export * from './ManagementApiScope';

@@ -7,2 +7,7 @@ # Changelog

## [1.0.0-rc.1] - 2020-07-24
### Changed
- entries: added search via GET;
- users and groups: added *security.* namespace for *users* and *groups* methods
## [1.0.0-beta.20] - 2020-07-21

@@ -22,7 +27,7 @@ ### Changed

### Changed
- users api: use PATCH instead of PUT for *update()* , updated *User* property names
- users: use PATCH instead of PUT for *update()* , updated *User* property names
## [1.0.0-beta.15] - 2020-07-08
### Added
- users api: added *getCurrent()*
- users: added *getCurrent()*

@@ -41,3 +46,3 @@ ## [1.0.0-beta.14] - 2020-07-07

### Changed
- users api: changed *isInGroup/isinGroups* to *userIsMemberOf*, changed *getGroups* to *getUserGroups*;
- users and groups: changed *isInGroup/isinGroups* to *userIsMemberOf*, changed *getGroups* to *getUserGroups*;

@@ -44,0 +49,0 @@ ## [1.0.0-beta.11] - 2020-06-04

@@ -1,2 +0,2 @@

import { Config, ContensisClient, IContentTypeOperations, IEntryOperations, INodeOperations, IProjectOperations, IRoleOperations, IPermissionOperations, IComponentOperations, IGroupOperations, IUserOperations } from '../models';
import { Config, ContensisClient, IContentTypeOperations, IEntryOperations, INodeOperations, IProjectOperations, IRoleOperations, IPermissionOperations, IComponentOperations, ISecurityOperations } from '../models';
import { ClientConfig } from './client-config';

@@ -11,3 +11,2 @@ import { ClientParams } from 'contensis-core-api';

entries: IEntryOperations;
groups: IGroupOperations;
nodes: INodeOperations;

@@ -17,3 +16,3 @@ permissions: IPermissionOperations;

roles: IRoleOperations;
users: IUserOperations;
security: ISecurityOperations;
bearerToken: string;

@@ -20,0 +19,0 @@ bearerTokenExpiryDate: Date;

@@ -12,4 +12,3 @@ "use strict";

const component_operations_1 = require("../components/component-operations");
const group_operations_1 = require("../groups/group-operations");
const user_operations_1 = require("../users/user-operations");
const security_1 = require("../security");
const Scopes = require("./scopes");

@@ -27,3 +26,2 @@ const cross_fetch_1 = require("cross-fetch");

this.entries = new entry_operations_1.EntryOperations(this.httpClient, this);
this.groups = new group_operations_1.GroupOperations(this.httpClient, this);
this.nodes = new node_operations_1.NodeOperations(this.httpClient, this);

@@ -33,3 +31,3 @@ this.permissions = new permission_operations_1.PermissionOperations(this.httpClient, this);

this.roles = new role_operations_1.RoleOperations(this.httpClient, this);
this.users = new user_operations_1.UserOperations(this.httpClient, this);
this.security = new security_1.SecurityOperations(new security_1.UserOperations(this.httpClient, this), new security_1.GroupOperations(this.httpClient, this));
}

@@ -36,0 +34,0 @@ static create(config = null) {

@@ -17,3 +17,4 @@ import { Entry, EntryGetOptions, EntryListOptions, IEntryOperations, ContensisClient, WorkflowTrigger } from '../models';

invokeWorkflowByTrigger(entry: Entry, workflowTrigger: WorkflowTrigger): Promise<Entry>;
private searchUsingPost;
private ensureIsNode;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const contensis_core_api_1 = require("contensis-core-api");

@@ -56,12 +57,22 @@ const FormData = require("form-data");

let params = this.contensisClient.getParams();
query.pageSize = query.pageSize || params.pageSize;
query.pageIndex = query.pageIndex || 0;
let url = contensis_core_api_1.UrlBuilder.create('/api/management/projects/:projectId/entries/search')
.setParams(params)
let pageSize = query.pageSize || params.pageSize;
let pageIndex = query.pageIndex || 0;
let orderBy = (query.orderBy && (query.orderBy._items || query.orderBy));
let { clientType, clientDetails, projectId, language, responseHandler, rootUrl, versionStatus } = params, requestParams = tslib_1.__rest(params, ["clientType", "clientDetails", "projectId", "language", "responseHandler", "rootUrl", "versionStatus"]);
let payload = Object.assign({}, requestParams, { pageSize,
pageIndex, where: JSON.stringify(query.where) });
if (orderBy && orderBy.length > 0) {
payload['orderBy'] = JSON.stringify(orderBy);
}
let url = contensis_core_api_1.UrlBuilder.create('/api/management/projects/:projectId/entries/search', Object.assign({}, payload))
.setParams(Object.assign({}, payload, { projectId }))
.toUrl();
let absoluteUrl = (!params.rootUrl || params.rootUrl === '/') ? url : params.rootUrl + url;
if (contensis_core_api_1.isBrowser() && contensis_core_api_1.isIE() && absoluteUrl.length > 2083) {
return this.searchUsingPost(query);
}
return this.contensisClient.ensureBearerToken().then(() => {
return this.httpClient.request(url, {
method: 'POST',
method: 'GET',
headers: this.contensisClient.getHeaders(),
body: JSON.stringify(query)
});

@@ -239,2 +250,20 @@ });

}
searchUsingPost(query) {
if (!query) {
return new Promise((resolve) => { resolve(null); });
}
let params = this.contensisClient.getParams();
query.pageSize = query.pageSize || params.pageSize;
query.pageIndex = query.pageIndex || 0;
let url = contensis_core_api_1.UrlBuilder.create('/api/management/projects/:projectId/entries/search')
.setParams(params)
.toUrl();
return this.contensisClient.ensureBearerToken().then(() => {
return this.httpClient.request(url, {
method: 'POST',
headers: this.contensisClient.getHeaders(),
body: JSON.stringify(query)
});
});
}
ensureIsNode(functionName) {

@@ -241,0 +270,0 @@ if (!contensis_core_api_1.isNodejs()) {

@@ -7,2 +7,3 @@ "use strict";

const cross_fetch_1 = require("cross-fetch");
const contensis_core_api_1 = require("contensis-core-api");
const Zengenti = { Contensis };

@@ -131,2 +132,288 @@ const global = window || this;

});
describe('Search entries', () => {
beforeEach(() => {
specs_utils_spec_1.setDefaultSpy(global, {
pageIndex: 0,
pageSize: 25,
totalCount: 2,
items: [{
title: 'entry1'
},
{
title: 'entry2'
}
]
});
Zengenti.Contensis.Client.defaultClientConfig = null;
Zengenti.Contensis.Client.configure({
fetchFn: global.fetch
});
});
it('with query as Object', async () => {
let client = Zengenti.Contensis.Client.create(specs_utils_spec_1.getDefaultConfig());
let orderBy = [{
asc: 'name'
}, {
desc: 'brewTypeCount'
}];
let where = [{
field: 'brewTypeCount',
greaterThan: 5
}, {
field: 'Origin',
in: ['Peru', 'Columbia']
}];
let query = {
pageIndex: 1,
pageSize: 50,
orderBy,
where
};
let entries = await client.entries.search(query);
let expectedQueryString = contensis_core_api_1.toQuery(Object.assign({}, query, { orderBy: JSON.stringify(orderBy), where: JSON.stringify(where) }));
expect(global.fetch.calls.first().args[0]).toEqual(specs_utils_spec_1.getDefaultAuthenticateUrl());
expect(global.fetch.calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`,
specs_utils_spec_1.getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as the default Query instance ', async () => {
let client = Zengenti.Contensis.Client.create(specs_utils_spec_1.getDefaultConfig());
let query = new Contensis.Query();
let entries = await client.entries.search(query);
let expectedQueryString = contensis_core_api_1.toQuery({
pageIndex: 0,
pageSize: 20,
where: JSON.stringify([])
});
expect(global.fetch.calls.first().args[0]).toEqual(specs_utils_spec_1.getDefaultAuthenticateUrl());
expect(global.fetch.calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`,
specs_utils_spec_1.getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as a specific Query instance ', async () => {
let client = Zengenti.Contensis.Client.create(specs_utils_spec_1.getDefaultConfig());
let query = new Contensis.Query(Contensis.Op.startsWith('authorName', 'W'));
query.orderBy = Contensis.OrderBy.asc('authorName');
query.pageIndex = 1;
query.pageSize = 50;
let entries = await client.entries.search(query);
let expectedQueryString = contensis_core_api_1.toQuery({
pageIndex: 1,
pageSize: 50,
orderBy: JSON.stringify([{
asc: 'authorName'
}]),
where: JSON.stringify([{
field: 'authorName',
startsWith: 'W'
}])
});
expect(global.fetch.calls.first().args[0]).toEqual(specs_utils_spec_1.getDefaultAuthenticateUrl());
expect(global.fetch.calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`,
specs_utils_spec_1.getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as Object for distanceWithin operator', async () => {
let client = Zengenti.Contensis.Client.create(specs_utils_spec_1.getDefaultConfig());
let orderBy = [{
asc: 'authorName'
}];
let where = [{
field: 'authorLocation',
distanceWithin: {
lat: 52.377,
lon: -2.749,
distance: '10mi'
}
}];
let query = {
pageIndex: 1,
pageSize: 50,
orderBy,
where
};
let entries = await client.entries.search(query);
let expectedQueryString = contensis_core_api_1.toQuery(Object.assign({}, query, { orderBy: JSON.stringify(orderBy), where: JSON.stringify(where) }));
expect(global.fetch.calls.first().args[0]).toEqual(specs_utils_spec_1.getDefaultAuthenticateUrl());
expect(global.fetch.calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`,
specs_utils_spec_1.getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as Query instance for distanceWithin operator', async () => {
let client = Zengenti.Contensis.Client.create(specs_utils_spec_1.getDefaultConfig());
let query = new Contensis.Query(Contensis.Op.distanceWithin('authorLocation', 52.377, -2.749, '10mi'));
query.orderBy = Contensis.OrderBy.asc('authorName');
query.pageIndex = 1;
query.pageSize = 50;
let entries = await client.entries.search(query);
let expectedQueryString = contensis_core_api_1.toQuery({
pageIndex: 1,
pageSize: 50,
orderBy: JSON.stringify([{
asc: 'authorName'
}]),
where: JSON.stringify([{
field: 'authorLocation',
distanceWithin: {
lat: 52.377,
lon: -2.749,
distance: '10mi'
}
}])
});
expect(global.fetch.calls.first().args[0]).toEqual(specs_utils_spec_1.getDefaultAuthenticateUrl());
expect(global.fetch.calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`,
specs_utils_spec_1.getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
});
describe('Search entries in IE browser', () => {
beforeEach(() => {
specs_utils_spec_1.setDefaultSpy(global, {
pageIndex: 0,
pageSize: 25,
totalCount: 2,
items: [{
title: 'entry1'
},
{
title: 'entry2'
}
]
});
Zengenti.Contensis.Client.defaultClientConfig = null;
Zengenti.Contensis.Client.configure({
fetchFn: global.fetch
});
global.document.documentMode = 11;
});
it('with query as Object and url length = 2083', async () => {
let client = Zengenti.Contensis.Client.create(specs_utils_spec_1.getDefaultConfig());
let orderBy = [{
asc: 'authorName'
}];
// use string with length = 1863
let where = [{
field: 'authorName',
// tslint:disable-next-line:max-line-length
startsWith: 'n123XX8OFpCGJg0OJXfKRRoOk69tWiEfnqi2y5eElXQP1ZjTo0MsozSnWSJqdAvXefl0wmmELbyRArciCS4heXVw9XvYGqKsHM0X4eOxWpP8Otz8OoRApVGiPWeL6nzxblSDcP58qh8wkgUGWPHg21WGrgduYXpvFDdKnAwF1z6YKBMv7sOaVTHowp6mpzndOqUn6caURbF3Ob4ybumG1vl8BEvfwRjpjpAuULobQLN9pt31BoosToBWLdvrkDhSeNPLzltvMIBVGOVn97zWvdsuAg4wxznEz8rLvLK48hLdN4BJ3eWYkfhfk8TbUkDt82ZQwXCmdTpqP6ODPKRc4qkglAabHjUBwOzz9QCwxp7xeupfPWgDQlHCYHsKQ5X7xsWa5hl7RWpQXoajFhZoHomyvJxN9Q3kTccqeiVjzWN6BitsqCN8Kp4NJE7qFOzXSFn01NUv1Yqb8LpoxZ0lMcy1aWtOtdOtnjBLncS6iFR4IVuogl2Z8eJ7aDCdubM7OODjwtQqUSqnZGmsraC8WTxsmXDLIsTz4w2paulihOl2jaxtIR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IRS5yvODYk50LJ7o9zkv3WPGIekAnMJgDVCBsekNxnR3XR0jMCLZx4t73Hm93vb7T8uzyylrbJz2BWyk1EpZ22uynFyIitDpAYHe483oeYwhfKfJPdKjaYsYZAM1ZKdfwK5o0vaRW3X5nlLHfe4QWcMZOAhCq8GVbQkUFcdPSqeZ2nOuPUzwAGGONpIBXm7FOITI9WPibTjCL'
}];
let query = {
pageIndex: 1,
pageSize: 50,
orderBy,
where
};
let entries = await client.entries.search(query);
let expectedQueryString = contensis_core_api_1.toQuery(Object.assign({}, query, { orderBy: JSON.stringify(orderBy), where: JSON.stringify(where) }));
let url = `http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`;
expect(url.length).toEqual(2083);
expect(global.fetch.calls.first().args[0]).toEqual(specs_utils_spec_1.getDefaultAuthenticateUrl());
expect(global.fetch.calls.mostRecent().args).toEqual([
url,
specs_utils_spec_1.getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as Object and url length > 2083', async () => {
let client = Zengenti.Contensis.Client.create(specs_utils_spec_1.getDefaultConfig());
let orderBy = [{
asc: 'authorName'
}];
// use string with length = 1864
let where = [{
field: 'authorName',
// tslint:disable-next-line:max-line-length
startsWith: 'n1234XX8OFpCGJg0OJXfKRRoOk69tWiEfnqi2y5eElXQP1ZjTo0MsozSnWSJqdAvXefl0wmmELbyRArciCS4heXVw9XvYGqKsHM0X4eOxWpP8Otz8OoRApVGiPWeL6nzxblSDcP58qh8wkgUGWPHg21WGrgduYXpvFDdKnAwF1z6YKBMv7sOaVTHowp6mpzndOqUn6caURbF3Ob4ybumG1vl8BEvfwRjpjpAuULobQLN9pt31BoosToBWLdvrkDhSeNPLzltvMIBVGOVn97zWvdsuAg4wxznEz8rLvLK48hLdN4BJ3eWYkfhfk8TbUkDt82ZQwXCmdTpqP6ODPKRc4qkglAabHjUBwOzz9QCwxp7xeupfPWgDQlHCYHsKQ5X7xs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sn57AWsEqs85zYg6MxkctOcQ0lxqv6s9y7Z7pcWbU0k8pmccUm3EDUideWwDnoftuUwIGVfnJrpZn7ihhVzEOB8ojbuGrO41mHZNa8tSlXz6cfg2LXRrRgWRFBMdkswg73HmVaDuvbF2LkwFjoPweHuh62uQb88gOg2Hbbip9212Mnx9gzed81bIRS5yvODYk50LJ7o9zkv3WPGIekAnMJgDVCBsekNxnR3XR0jMCLZx4t73Hm93vb7T8uzyylrbJz2BWyk1EpZ22uynFyIitDpAYHe483oeYwhfKfJPdKjaYsYZAM1ZKdfwK5o0vaRW3X5nlLHfe4QWcMZOAhCq8GVbQkUFcdPSqeZ2nOuPUzwAGGONpIBXm7FOITI9WPibTjCL'
}];
let query = {
pageIndex: 1,
pageSize: 50,
orderBy,
where
};
let entries = await client.entries.search(query);
expect(global.fetch.calls.first().args[0]).toEqual(specs_utils_spec_1.getDefaultAuthenticateUrl());
expect(global.fetch.calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search`,
specs_utils_spec_1.getDefaultRequest('POST', false, JSON.stringify(query))
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as Query instance and url length = 2083', async () => {
let client = Zengenti.Contensis.Client.create(specs_utils_spec_1.getDefaultConfig());
// use string with length = 1863
// tslint:disable-next-line:max-line-length
const startsWithText = 'n123XX8OFpCGJg0OJXfKRRoOk69tWiEfnqi2y5eElXQP1ZjTo0MsozSnWSJqdAvXefl0wmmELbyRArciCS4heXVw9XvYGqKsHM0X4eOxWpP8Otz8OoRApVGiPWeL6nzxblSDcP58qh8wkgUGWPHg21WGrgduYXpvFDdKnAwF1z6YKBMv7sOaVTHowp6mpzndOqUn6caURbF3Ob4ybumG1vl8BEvfwRjpjpAuULobQLN9pt31BoosToBWLdvrkDhSeNPLzltvMIBVGOVn97zWvdsuAg4wxznEz8rLvLK48hLdN4BJ3eWYkfhfk8TbUkDt82ZQwXCmdTpqP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g5JZI5URcgGa6LfXh4zymO2xqSql1YAltvO7lHaIEnF2edze6KvEFJj1smsn57AWsEqs85zYg6MxkctOcQ0lxqv6s9y7Z7pcWbU0k8pmccUm3EDUideWwDnoftuUwIGVfnJrpZn7ihhVzEOB8ojbuGrO41mHZNa8tSlXz6cfg2LXRrRgWRFBMdkswg73HmVaDuvbF2LkwFjoPweHuh62uQb88gOg2Hbbip9212Mnx9gzed81bIRS5yvODYk50LJ7o9zkv3WPGIekAnMJgDVCBsekNxnR3XR0jMCLZx4t73Hm93vb7T8uzyylrbJz2BWyk1EpZ22uynFyIitDpAYHe483oeYwhfKfJPdKjaYsYZAM1ZKdfwK5o0vaRW3X5nlLHfe4QWcMZOAhCq8GVbQkUFcdPSqeZ2nOuPUzwAGGONpIBXm7FOITI9WPibTjCL';
let query = new Contensis.Query(Contensis.Op.startsWith('authorName', startsWithText));
query.orderBy = Contensis.OrderBy.asc('authorName');
query.pageIndex = 1;
query.pageSize = 50;
let entries = await client.entries.search(query);
let expectedQueryString = contensis_core_api_1.toQuery({
pageIndex: 1,
pageSize: 50,
orderBy: JSON.stringify([{
asc: 'authorName'
}]),
where: JSON.stringify([{
field: 'authorName',
startsWith: startsWithText
}])
});
let url = `http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`;
expect(url.length).toEqual(2083);
expect(global.fetch.calls.first().args[0]).toEqual(specs_utils_spec_1.getDefaultAuthenticateUrl());
expect(global.fetch.calls.mostRecent().args).toEqual([
url,
specs_utils_spec_1.getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as Query instance and url length > 2083', async () => {
let client = Zengenti.Contensis.Client.create(specs_utils_spec_1.getDefaultConfig());
// use string with length = 1864
// tslint:disable-next-line:max-line-length
const startsWithText = 'n1234XX8OFpCGJg0OJXfKRRoOk69tWiEfnqi2y5eElXQP1ZjTo0MsozSnWSJqdAvXefl0wmmELbyRArciCS4heXVw9X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ROw9e02ssMgAkoh9B9mecXFgl9TqxlG5jSbXQtvNiLWzSUnqeugCXcl2O6fhpnKCNpIW6PoAI1mbwBK5qxumQMKqKix964TOiCWfWUNnOBkcXVPVzzqPA1yLNn87KgVuODm9VpZnnoHSbnAzeLGb7vTZb1ITOP8MNnAPWrvlqvypjMtkLLtZg2r7nGEHLMD76ELxzKC3Zg269m3EW47wPKam9HuWMGjqnD0BghH5zlnRRxHVNgg5JZI5URcgGa6LfXh4zymO2xqSql1YAltvO7lHaIEnF2edze6KvEFJj1smsn57AWsEqs85zYg6MxkctOcQ0lxqv6s9y7Z7pcWbU0k8pmccUm3EDUideWwDnoftuUwIGVfnJrpZn7ihhVzEOB8ojbuGrO41mHZNa8tSlXz6cfg2LXRrRgWRFBMdkswg73HmVaDuvbF2LkwFjoPweHuh62uQb88gOg2Hbbip9212Mnx9gzed81bIRS5yvODYk50LJ7o9zkv3WPGIekAnMJgDVCBsekNxnR3XR0jMCLZx4t73Hm93vb7T8uzyylrbJz2BWyk1EpZ22uynFyIitDpAYHe483oeYwhfKfJPdKjaYsYZAM1ZKdfwK5o0vaRW3X5nlLHfe4QWcMZOAhCq8GVbQkUFcdPSqeZ2nOuPUzwAGGONpIBXm7FOITI9WPibTjCL';
let query = new Contensis.Query(Contensis.Op.startsWith('authorName', startsWithText));
query.orderBy = Contensis.OrderBy.asc('authorName');
query.pageIndex = 1;
query.pageSize = 50;
let entries = await client.entries.search(query);
expect(global.fetch.calls.first().args[0]).toEqual(specs_utils_spec_1.getDefaultAuthenticateUrl());
expect(global.fetch.calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search`,
specs_utils_spec_1.getDefaultRequest('POST', false, JSON.stringify(query))
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
});
});

@@ -9,4 +9,3 @@ import { IEntryOperations } from './IEntryOperations';

import { IComponentOperations } from './IComponentOperations';
import { IGroupOperations } from './IGroupOperations';
import { IUserOperations } from './IUserOperations';
import { ISecurityOperations } from './ISecurityOperations';
export interface ContensisClient extends IParamsProvider {

@@ -16,3 +15,2 @@ components: IComponentOperations;

entries: IEntryOperations;
groups: IGroupOperations;
nodes: INodeOperations;

@@ -22,3 +20,3 @@ permissions: IPermissionOperations;

roles: IRoleOperations;
users: IUserOperations;
security: ISecurityOperations;
getHeaders: (contentType?: string) => {

@@ -25,0 +23,0 @@ [key: string]: string;

@@ -27,2 +27,3 @@ export * from './AllowedPermissions';

export * from './IRoleOperations';
export * from './ISecurityOperations';
export * from './IUserOperations';

@@ -29,0 +30,0 @@ export * from './ManagementApiScope';

{
"name": "contensis-management-api",
"version": "1.0.0-beta.20",
"version": "1.0.0-rc.1",
"description": "Contensis Javascript Management API",

@@ -5,0 +5,0 @@ "engines": {

import {
Config, ContensisClient, IContentTypeOperations,
IEntryOperations, INodeOperations, IProjectOperations, IRoleOperations, IPermissionOperations, IComponentOperations, IGroupOperations, IUserOperations
IEntryOperations, INodeOperations, IProjectOperations, IRoleOperations, IPermissionOperations, IComponentOperations, IGroupOperations, IUserOperations, ISecurityOperations
} from '../models';

@@ -14,4 +14,3 @@ import { EntryOperations } from '../entries/entry-operations';

import { ComponentOperations } from '../components/component-operations';
import { GroupOperations } from '../groups/group-operations';
import { UserOperations } from '../users/user-operations';
import { GroupOperations, UserOperations, SecurityOperations } from '../security';
import * as Scopes from './scopes';

@@ -25,4 +24,2 @@

static defaultClientConfig: ClientConfig = null;

@@ -36,3 +33,2 @@

entries: IEntryOperations;
groups: IGroupOperations;
nodes: INodeOperations;

@@ -42,3 +38,3 @@ permissions: IPermissionOperations;

roles: IRoleOperations;
users: IUserOperations;
security: ISecurityOperations;

@@ -70,3 +66,2 @@ bearerToken: string;

this.entries = new EntryOperations(this.httpClient, this);
this.groups = new GroupOperations(this.httpClient, this);
this.nodes = new NodeOperations(this.httpClient, this);

@@ -76,3 +71,3 @@ this.permissions = new PermissionOperations(this.httpClient, this);

this.roles = new RoleOperations(this.httpClient, this);
this.users = new UserOperations(this.httpClient, this);
this.security = new SecurityOperations(new UserOperations(this.httpClient, this), new GroupOperations(this.httpClient, this));
}

@@ -79,0 +74,0 @@

@@ -6,3 +6,3 @@ import * as Contensis from '../index';

import { Entry } from '../models';
import { PagedList } from 'contensis-core-api';
import { PagedList, toQuery } from 'contensis-core-api';

@@ -166,2 +166,373 @@ const Zengenti = { Contensis };

});
describe('Search entries', () => {
beforeEach(() => {
setDefaultSpy(global, {
pageIndex: 0,
pageSize: 25,
totalCount: 2,
items: [{
title: 'entry1'
}
, {
title: 'entry2'
}
]
} as PagedList<Partial<Entry>>);
Zengenti.Contensis.Client.defaultClientConfig = null;
Zengenti.Contensis.Client.configure({
fetchFn: global.fetch
});
});
it('with query as Object', async () => {
let client = Zengenti.Contensis.Client.create(getDefaultConfig());
let orderBy = [{
asc: 'name'
}, {
desc: 'brewTypeCount'
}];
let where = [{
field: 'brewTypeCount',
greaterThan: 5
}, {
field: 'Origin',
in: ['Peru', 'Columbia']
}];
let query = {
pageIndex: 1,
pageSize: 50,
orderBy,
where
};
let entries = await client.entries.search(query);
let expectedQueryString = toQuery({
...query,
orderBy: JSON.stringify(orderBy),
where: JSON.stringify(where)
});
expect((global.fetch as any).calls.first().args[0]).toEqual(getDefaultAuthenticateUrl());
expect((global.fetch as any).calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`,
getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as the default Query instance ', async () => {
let client = Zengenti.Contensis.Client.create(getDefaultConfig());
let query = new Contensis.Query();
let entries = await client.entries.search(query);
let expectedQueryString = toQuery({
pageIndex: 0,
pageSize: 20,
where: JSON.stringify([])
});
expect((global.fetch as any).calls.first().args[0]).toEqual(getDefaultAuthenticateUrl());
expect((global.fetch as any).calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`,
getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as a specific Query instance ', async () => {
let client = Zengenti.Contensis.Client.create(getDefaultConfig());
let query = new Contensis.Query(Contensis.Op.startsWith('authorName', 'W'));
query.orderBy = Contensis.OrderBy.asc('authorName');
query.pageIndex = 1;
query.pageSize = 50;
let entries = await client.entries.search(query);
let expectedQueryString = toQuery({
pageIndex: 1,
pageSize: 50,
orderBy: JSON.stringify([{
asc: 'authorName'
}]),
where: JSON.stringify([{
field: 'authorName',
startsWith: 'W'
}])
});
expect((global.fetch as any).calls.first().args[0]).toEqual(getDefaultAuthenticateUrl());
expect((global.fetch as any).calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`,
getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as Object for distanceWithin operator', async () => {
let client = Zengenti.Contensis.Client.create(getDefaultConfig());
let orderBy = [{
asc: 'authorName'
}];
let where = [{
field: 'authorLocation',
distanceWithin: {
lat: 52.377,
lon: -2.749,
distance: '10mi'
}
}];
let query = {
pageIndex: 1,
pageSize: 50,
orderBy,
where
};
let entries = await client.entries.search(query);
let expectedQueryString = toQuery({
...query,
orderBy: JSON.stringify(orderBy),
where: JSON.stringify(where)
});
expect((global.fetch as any).calls.first().args[0]).toEqual(getDefaultAuthenticateUrl());
expect((global.fetch as any).calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`,
getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as Query instance for distanceWithin operator', async () => {
let client = Zengenti.Contensis.Client.create(getDefaultConfig());
let query = new Contensis.Query(Contensis.Op.distanceWithin('authorLocation', 52.377, -2.749, '10mi'));
query.orderBy = Contensis.OrderBy.asc('authorName');
query.pageIndex = 1;
query.pageSize = 50;
let entries = await client.entries.search(query);
let expectedQueryString = toQuery({
pageIndex: 1,
pageSize: 50,
orderBy: JSON.stringify([{
asc: 'authorName'
}]),
where: JSON.stringify([{
field: 'authorLocation',
distanceWithin: {
lat: 52.377,
lon: -2.749,
distance: '10mi'
}
}])
});
expect((global.fetch as any).calls.first().args[0]).toEqual(getDefaultAuthenticateUrl());
expect((global.fetch as any).calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`,
getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
});
describe('Search entries in IE browser', () => {
beforeEach(() => {
setDefaultSpy(global, {
pageIndex: 0,
pageSize: 25,
totalCount: 2,
items: [{
title: 'entry1'
}
, {
title: 'entry2'
}
]
} as PagedList<Partial<Entry>>);
Zengenti.Contensis.Client.defaultClientConfig = null;
Zengenti.Contensis.Client.configure({
fetchFn: global.fetch
});
global.document.documentMode = 11;
});
it('with query as Object and url length = 2083', async () => {
let client = Zengenti.Contensis.Client.create(getDefaultConfig());
let orderBy = [{
asc: 'authorName'
}];
// use string with length = 1863
let where = [{
field: 'authorName',
// tslint:disable-next-line:max-line-length
startsWith: 'n123XX8OFpCGJg0OJXfKRRoOk69tWiEfnqi2y5eElXQP1ZjTo0MsozSnWSJqdAvXefl0wmmELbyRArciCS4heXVw9XvYGqKsHM0X4eOxWpP8Otz8OoRApVGiPWeL6nzxblSDcP58qh8wkgUGWPHg21WGrgduYXpvFDdKnAwF1z6YKBMv7sOaVTHowp6mpzndOqUn6caURbF3Ob4ybumG1vl8BEvfwRjpjpAuULobQLN9pt31BoosToBWLdvrkDhSeNPLzltvMIBVGOVn97zWvdsuAg4wxznEz8rLvLK48hLdN4BJ3eWYkfhfk8TbUkDt82ZQwXCmdTpqP6ODPKRc4qkglAabHjUBwOzz9QCwxp7xeupfPWgDQlHCYHs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KvEFJj1smsn57AWsEqs85zYg6MxkctOcQ0lxqv6s9y7Z7pcWbU0k8pmccUm3EDUideWwDnoftuUwIGVfnJrpZn7ihhVzEOB8ojbuGrO41mHZNa8tSlXz6cfg2LXRrRgWRFBMdkswg73HmVaDuvbF2LkwFjoPweHuh62uQb88gOg2Hbbip9212Mnx9gzed81bIRS5yvODYk50LJ7o9zkv3WPGIekAnMJgDVCBsekNxnR3XR0jMCLZx4t73Hm93vb7T8uzyylrbJz2BWyk1EpZ22uynFyIitDpAYHe483oeYwhfKfJPdKjaYsYZAM1ZKdfwK5o0vaRW3X5nlLHfe4QWcMZOAhCq8GVbQkUFcdPSqeZ2nOuPUzwAGGONpIBXm7FOITI9WPibTjCL'
}];
let query = {
pageIndex: 1,
pageSize: 50,
orderBy,
where
};
let entries = await client.entries.search(query);
let expectedQueryString = toQuery({
...query,
orderBy: JSON.stringify(orderBy),
where: JSON.stringify(where)
});
let url = `http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`;
expect(url.length).toEqual(2083);
expect((global.fetch as any).calls.first().args[0]).toEqual(getDefaultAuthenticateUrl());
expect((global.fetch as any).calls.mostRecent().args).toEqual([
url,
getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as Object and url length > 2083', async () => {
let client = Zengenti.Contensis.Client.create(getDefaultConfig());
let orderBy = [{
asc: 'authorName'
}];
// use string with length = 1864
let where = [{
field: 'authorName',
// tslint:disable-next-line:max-line-length
startsWith: 'n1234XX8OFpCGJg0OJXfKRRoOk69tWiEfnqi2y5eElXQP1ZjTo0MsozSnWSJqdAvXefl0wmmELbyRArciCS4heXVw9XvYGqKsHM0X4eOxWpP8Otz8OoRApVGiPWeL6nzxblSDcP58qh8wkgUGWPHg21WGrgduYXpvFDdKnAwF1z6YKBMv7sOaVTHowp6mpzndOqUn6caURbF3Ob4ybumG1vl8BEvfwRjpjpAuULobQLN9pt31BoosToBW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ITOP8MNnAPWrvlqvypjMtkLLtZg2r7nGEHLMD76ELxzKC3Zg269m3EW47wPKam9HuWMGjqnD0BghH5zlnRRxHVNgg5JZI5URcgGa6LfXh4zymO2xqSql1YAltvO7lHaIEnF2edze6KvEFJj1smsn57AWsEqs85zYg6MxkctOcQ0lxqv6s9y7Z7pcWbU0k8pmccUm3EDUideWwDnoftuUwIGVfnJrpZn7ihhVzEOB8ojbuGrO41mHZNa8tSlXz6cfg2LXRrRgWRFBMdkswg73HmVaDuvbF2LkwFjoPweHuh62uQb88gOg2Hbbip9212Mnx9gzed81bIRS5yvODYk50LJ7o9zkv3WPGIekAnMJgDVCBsekNxnR3XR0jMCLZx4t73Hm93vb7T8uzyylrbJz2BWyk1EpZ22uynFyIitDpAYHe483oeYwhfKfJPdKjaYsYZAM1ZKdfwK5o0vaRW3X5nlLHfe4QWcMZOAhCq8GVbQkUFcdPSqeZ2nOuPUzwAGGONpIBXm7FOITI9WPibTjCL'
}];
let query = {
pageIndex: 1,
pageSize: 50,
orderBy,
where
};
let entries = await client.entries.search(query);
expect((global.fetch as any).calls.first().args[0]).toEqual(getDefaultAuthenticateUrl());
expect((global.fetch as any).calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search`,
getDefaultRequest('POST', false, JSON.stringify(query))
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as Query instance and url length = 2083', async () => {
let client = Zengenti.Contensis.Client.create(getDefaultConfig());
// use string with length = 1863
// tslint:disable-next-line:max-line-length
const startsWithText = 'n123XX8OFpCGJg0OJXfKRRoOk69tWiEfnqi2y5eElXQP1ZjTo0MsozSnWSJqdAvXefl0wmmELbyRArciCS4heXVw9XvYGqKsHM0X4eOxWpP8Otz8OoRApVGiPWeL6nzxblSDcP58qh8wkgUGWPHg21WGrgduYXpvFDdKnAwF1z6YKBMv7sOaVTHowp6mpzndOqUn6caURbF3Ob4ybumG1vl8BEvfw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VpZnnoHSbnAzeLGb7vTZb1ITOP8MNnAPWrvlqvypjMtkLLtZg2r7nGEHLMD76ELxzKC3Zg269m3EW47wPKam9HuWMGjqnD0BghH5zlnRRxHVNgg5JZI5URcgGa6LfXh4zymO2xqSql1YAltvO7lHaIEnF2edze6KvEFJj1smsn57AWsEqs85zYg6MxkctOcQ0lxqv6s9y7Z7pcWbU0k8pmccUm3EDUideWwDnoftuUwIGVfnJrpZn7ihhVzEOB8ojbuGrO41mHZNa8tSlXz6cfg2LXRrRgWRFBMdkswg73HmVaDuvbF2LkwFjoPweHuh62uQb88gOg2Hbbip9212Mnx9gzed81bIRS5yvODYk50LJ7o9zkv3WPGIekAnMJgDVCBsekNxnR3XR0jMCLZx4t73Hm93vb7T8uzyylrbJz2BWyk1EpZ22uynFyIitDpAYHe483oeYwhfKfJPdKjaYsYZAM1ZKdfwK5o0vaRW3X5nlLHfe4QWcMZOAhCq8GVbQkUFcdPSqeZ2nOuPUzwAGGONpIBXm7FOITI9WPibTjCL';
let query = new Contensis.Query(Contensis.Op.startsWith('authorName', startsWithText));
query.orderBy = Contensis.OrderBy.asc('authorName');
query.pageIndex = 1;
query.pageSize = 50;
let entries = await client.entries.search(query);
let expectedQueryString = toQuery({
pageIndex: 1,
pageSize: 50,
orderBy: JSON.stringify([{
asc: 'authorName'
}]),
where: JSON.stringify([{
field: 'authorName',
startsWith: startsWithText
}])
});
let url = `http://my-website.com/api/management/projects/myProject/entries/search${expectedQueryString}`;
expect(url.length).toEqual(2083);
expect((global.fetch as any).calls.first().args[0]).toEqual(getDefaultAuthenticateUrl());
expect((global.fetch as any).calls.mostRecent().args).toEqual([
url,
getDefaultRequest()
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
it('with query as Query instance and url length > 2083', async () => {
let client = Zengenti.Contensis.Client.create(getDefaultConfig());
// use string with length = 1864
// tslint:disable-next-line:max-line-length
const startsWithText = 'n1234XX8OFpCGJg0OJX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k5VKKnTimosZ4bRscGL8if1Wx0Mvapbl3AubcOJm03HngzgHgjLUpM1UrPAyCn8kxwdx6ROw9e02ssMgAkoh9B9mecXFgl9TqxlG5jSbXQtvNiLWzSUnqeugCXcl2O6fhpnKCNpIW6PoAI1mbwBK5qxumQMKqKix964TOiCWfWUNnOBkcXVPVzzqPA1yLNn87KgVuODm9VpZnnoHSbnAzeLGb7vTZb1ITOP8MNnAPWrvlqvypjMtkLLtZg2r7nGEHLMD76ELxzKC3Zg269m3EW47wPKam9HuWMGjqnD0BghH5zlnRRxHVNgg5JZI5URcgGa6LfXh4zymO2xqSql1YAltvO7lHaIEnF2edze6KvEFJj1smsn57AWsEqs85zYg6MxkctOcQ0lxqv6s9y7Z7pcWbU0k8pmccUm3EDUideWwDnoftuUwIGVfnJrpZn7ihhVzEOB8ojbuGrO41mHZNa8tSlXz6cfg2LXRrRgWRFBMdkswg73HmVaDuvbF2LkwFjoPweHuh62uQb88gOg2Hbbip9212Mnx9gzed81bIRS5yvODYk50LJ7o9zkv3WPGIekAnMJgDVCBsekNxnR3XR0jMCLZx4t73Hm93vb7T8uzyylrbJz2BWyk1EpZ22uynFyIitDpAYHe483oeYwhfKfJPdKjaYsYZAM1ZKdfwK5o0vaRW3X5nlLHfe4QWcMZOAhCq8GVbQkUFcdPSqeZ2nOuPUzwAGGONpIBXm7FOITI9WPibTjCL';
let query = new Contensis.Query(Contensis.Op.startsWith('authorName', startsWithText));
query.orderBy = Contensis.OrderBy.asc('authorName');
query.pageIndex = 1;
query.pageSize = 50;
let entries = await client.entries.search(query);
expect((global.fetch as any).calls.first().args[0]).toEqual(getDefaultAuthenticateUrl());
expect((global.fetch as any).calls.mostRecent().args).toEqual([
`http://my-website.com/api/management/projects/myProject/entries/search`,
getDefaultRequest('POST', false, JSON.stringify(query))
]);
expect(entries).not.toBeNull();
expect(entries.items.length).toEqual(2);
expect(entries.items[1].title).toEqual('entry2');
});
});
});

@@ -6,3 +6,3 @@ import {

AssetUpload, ClientParams, defaultMapperForLanguage, defaultMapperForLatestVersionStatus,
IHttpClient, MapperFn, PagedList, SysAssetFile, UrlBuilder, isNodejs, isString
IHttpClient, MapperFn, PagedList, SysAssetFile, UrlBuilder, isNodejs, isString, isBrowser, isIE
} from 'contensis-core-api';

@@ -71,14 +71,33 @@ import * as FormData from 'form-data';

let params = this.contensisClient.getParams();
query.pageSize = query.pageSize || params.pageSize;
query.pageIndex = query.pageIndex || 0;
let pageSize = query.pageSize || params.pageSize;
let pageIndex = query.pageIndex || 0;
let url = UrlBuilder.create('/api/management/projects/:projectId/entries/search')
.setParams(params)
let orderBy = (query.orderBy && (query.orderBy._items || query.orderBy));
let { clientType, clientDetails, projectId, language, responseHandler, rootUrl, versionStatus, ...requestParams } = params;
let payload = {
...requestParams,
pageSize,
pageIndex,
where: JSON.stringify(query.where),
};
if (orderBy && orderBy.length > 0) {
payload['orderBy'] = JSON.stringify(orderBy);
}
let url = UrlBuilder.create('/api/management/projects/:projectId/entries/search', { ...payload })
.setParams({ ...(payload as any), projectId })
.toUrl();
let absoluteUrl = (!params.rootUrl || params.rootUrl === '/') ? url : params.rootUrl + url;
if (isBrowser() && isIE() && absoluteUrl.length > 2083) {
return this.searchUsingPost(query);
}
return this.contensisClient.ensureBearerToken().then(() => {
return this.httpClient.request<PagedList<Entry>>(url, {
method: 'POST',
method: 'GET',
headers: this.contensisClient.getHeaders(),
body: JSON.stringify(query)
});

@@ -301,2 +320,24 @@ });

private searchUsingPost(query: any): Promise<PagedList<Entry>> {
if (!query) {
return new Promise((resolve) => { resolve(null); });
}
let params = this.contensisClient.getParams();
query.pageSize = query.pageSize || params.pageSize;
query.pageIndex = query.pageIndex || 0;
let url = UrlBuilder.create('/api/management/projects/:projectId/entries/search')
.setParams(params)
.toUrl();
return this.contensisClient.ensureBearerToken().then(() => {
return this.httpClient.request<PagedList<Entry>>(url, {
method: 'POST',
headers: this.contensisClient.getHeaders(),
body: JSON.stringify(query)
});
});
}
private ensureIsNode(functionName: string): void {

@@ -303,0 +344,0 @@ if (!isNodejs()) {

@@ -12,2 +12,3 @@ import { IEntryOperations } from './IEntryOperations';

import { IUserOperations } from './IUserOperations';
import { ISecurityOperations } from './ISecurityOperations';

@@ -19,3 +20,2 @@ export interface ContensisClient extends IParamsProvider {

entries: IEntryOperations;
groups: IGroupOperations;
nodes: INodeOperations;

@@ -25,3 +25,3 @@ permissions: IPermissionOperations;

roles: IRoleOperations;
users: IUserOperations;
security: ISecurityOperations;

@@ -28,0 +28,0 @@ getHeaders: (contentType?: string) => { [key: string]: string };

@@ -27,2 +27,3 @@ export * from './AllowedPermissions';

export * from './IRoleOperations';
export * from './ISecurityOperations';
export * from './IUserOperations';

@@ -29,0 +30,0 @@ export * from './ManagementApiScope';

@@ -5,3 +5,2 @@ require('../lib/client/client.spec');

require('../lib/entries/entry-operations.spec');
require('../lib/groups/group-operations.spec');
require('../lib/http/url-builder.spec');

@@ -12,2 +11,3 @@ require('../lib/nodes/node-operations.spec');

require('../lib/roles/role-operations.spec');
require('../lib/users/user-operations.spec');
require('../lib/security/groups/group-operations.spec');
require('../lib/security/users/user-operations.spec');

@@ -5,3 +5,2 @@ require('../src/client/client.spec');

require('../src/entries/entry-operations.spec');
require('../src/groups/group-operations.spec');
require('../src/http/url-builder.spec');

@@ -12,2 +11,3 @@ require('../src/nodes/node-operations.spec');

require('../src/roles/role-operations.spec');
require('../src/users/user-operations.spec');
require('../src/security/groups/group-operations.spec');
require('../src/security/users/user-operations.spec');
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