Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/2.0.0-RC.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
gallayl committed May 16, 2017
2 parents faf4635 + 09cef94 commit 77af644
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 86 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { Repository, ContentTypes } as SN from 'sn-client-js';

let repository = new Repository.SnRepository();

this.Repository.Contents.Create('Root/', {
this.Repository.Content.Create('Root/', {
Name: 'myFolder',
}, ContentTypes.Folder);

Expand Down Expand Up @@ -87,7 +87,7 @@ var SN = require('sn-client-js');

let myRepository = new SN.Repository.SnRepository();

myRepository.Contents.Create('Root/Path', {
myRepository.Content.Create('Root/Path', {
Name: 'MyFolderName',
}, SN.ContentTypes.Folder);

Expand All @@ -99,7 +99,7 @@ myRepository.Contents.Create('Root/Path', {
import { Repository, ContentTypes } as SN from 'sn-client-js';

let repository = new Repository.SnRepository();
myRepository.Contents.Create('Root/Path', {
myRepository.Content.Create('Root/Path', {
Name: 'MyFolderName'
}, ContentTypes.Folder)

Expand All @@ -126,7 +126,7 @@ npm t
##### Creating a Folder with the name 'Hello world'

```ts
repository.Contents.Create('Root/Path', {
repository.Content.Create('Root/Path', {
Name: 'Hello world'
}, ContentTypes.Folder)
.subscribe(newFolder=>{
Expand All @@ -143,7 +143,7 @@ let folder = new ContentTypes.Folder({
Name: 'Hello world'
}, repository);

repository.Contents.Post('Root/Path', folder, ContentTypes.Folder)
repository.Content.Post('Root/Path', folder, ContentTypes.Folder)
.subscribe(newFolder=>{
console.log('New folder created: ', newFolder)
}, err=> {
Expand Down Expand Up @@ -172,7 +172,7 @@ let schema = SN.Content.GetSchema('GenericContent');
##### Read Collection data

```ts
let collection = new SN.Collection([], repository.Contents);
let collection = new SN.Collection([], repository.Content);
var options = new SN.ODataApi.ODataParams({
select: ["DisplayName", "Lead"],
orderby: 'DisplayName',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sn-client-js",
"version": "2.0.0-RC.1",
"version": "2.0.0-RC.2",
"description": "A JavaScript client for Sense/Net ECM that makes it easy to use the REST API of the Content Repository.",
"main": "index.js",
"files": [
Expand Down
114 changes: 57 additions & 57 deletions src/Content.ts

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/Repository/BaseRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export abstract class BaseRepository<TProviderType extends HttpProviders.BaseHtt
/**
* Reference to the OData API used by the current repository
*/
public readonly Contents: ODataApi.ODataApi<TProviderType, any>;
public readonly Content: ODataApi.ODataApi<TProviderType, any>;

/**
* Reference to the Authentication Service used by the current repository
Expand All @@ -91,7 +91,7 @@ export abstract class BaseRepository<TProviderType extends HttpProviders.BaseHtt

//warning: Authentication constructor parameterization is not type-safe
this.Authentication = new authentication(this.httpProviderRef, this.Config.RepositoryUrl, this.Config.JwtTokenKeyTemplate, this.Config.JwtTokenPersist);
this.Contents = new ODataApi.ODataApi(this.httpProviderType, this);
this.Content = new ODataApi.ODataApi(this.httpProviderType, this);
}

/**
Expand All @@ -110,7 +110,7 @@ export abstract class BaseRepository<TProviderType extends HttpProviders.BaseHtt
* ```
*/
public GetVersionInfo() {
return this.Contents.CreateCustomAction({ name: 'GetVersionInfo', path: '/Root', isAction: false }, null, VersionInfo);
return this.Content.CreateCustomAction({ name: 'GetVersionInfo', path: '/Root', isAction: false }, null, VersionInfo);
}
/**
* Returns the list of all ContentTypes in the system.
Expand All @@ -127,7 +127,7 @@ export abstract class BaseRepository<TProviderType extends HttpProviders.BaseHtt
* ```
*/
public GetAllContentTypes(): Observable<ODataApi.ODataCollectionResponse<ContentTypes.ContentType>>{
return this.Contents.CreateCustomAction<ODataApi.ODataCollectionResponse<ContentTypes.ContentType>>({
return this.Content.CreateCustomAction<ODataApi.ODataCollectionResponse<ContentTypes.ContentType>>({
name: 'GetAllContentTypes',
path: '/Root',
isAction: false
Expand Down Expand Up @@ -173,6 +173,6 @@ export abstract class BaseRepository<TProviderType extends HttpProviders.BaseHtt
path: contentURL,
params: params
})
return this.Contents.Get(odataRequestOptions, returns).map(r => r.d);
return this.Content.Get(odataRequestOptions, returns).map(r => r.d);
}
}
2 changes: 1 addition & 1 deletion src/Repository/IRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface IRepository<THttpProviderType extends BaseHttpProvider, TBaseCo
/**
* public reference to the OData API used by the repository
*/
readonly Contents: IODataApi<THttpProviderType, TBaseContentType>;
readonly Content: IODataApi<THttpProviderType, TBaseContentType>;

/**
* public reference to the Authentication Service used by the reőository
Expand Down
2 changes: 1 addition & 1 deletion test/CollectionTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Collection', () => {
}, this.repo)];


collection = new Collection(children, Repo.Contents);
collection = new Collection(children, Repo.Content);
collection.Path = 'https://daily.demo.sensenet.com/lorem';
});
describe('#Items()', () => {
Expand Down
30 changes: 15 additions & 15 deletions test/ODataApiTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('ODataApi', () => {

it('request a Content and returns an Observable object', function () {
const options = new ODataRequestOptions({ path: '/workspace/project' })
expect(typeof service.Contents.Get(options)).to.be.eq('object');
expect(typeof service.Content.Get(options)).to.be.eq('object');
});
it('request a collection of Content and returns an Observable object', function (done) {
(service.Authentication as MockAuthService).stateSubject.next(LoginState.Authenticated);
Expand All @@ -29,7 +29,7 @@ describe('ODataApi', () => {
}
} as ODataCollectionResponse<Content>)
const options = new ODataRequestOptions({ path: '/workspace/project' })
service.Contents.Fetch(options).first().subscribe(result => {
service.Content.Fetch(options).first().subscribe(result => {
expect(result.d.results[0].Id).to.be.eq(1);
expect(result.d.results[0]).to.be.instanceof(Content);
done();
Expand All @@ -39,52 +39,52 @@ describe('ODataApi', () => {

});
it('requests to create a Content and returns an Observable object', function () {
let observable = service.Contents.Create('/workspace/project', { Id: 1, Type: 'Article', DisplayName: 'Article' }, Content);
let observable = service.Content.Create('/workspace/project', { Id: 1, Type: 'Article', DisplayName: 'Article' }, Content);
expect(observable).to.be.instanceof(Observable);
});
it('requests to post a created a Content and returns an Observable object', function () {
let content = new Content({ Name: 'alma' }, service);
let observable = service.Contents.Post('/workspace/project', content, Content);
let observable = service.Content.Post('/workspace/project', content, Content);
expect(observable).to.be.instanceof(Observable);
});
it('requests to delete a Content and returns an Observable object', function () {
expect(typeof service.Contents.Delete(1111, false)).to.be.eq('object');
expect(typeof service.Content.Delete(1111, false)).to.be.eq('object');
});
it('requests to patch a Content and returns an Observable object', function () {
expect(typeof service.Contents.Patch(1111, Content, { DisplayName: 'test' })).to.be.eq('object');
expect(typeof service.Content.Patch(1111, Content, { DisplayName: 'test' })).to.be.eq('object');
});
it('requests to put a Content and returns an Observable object', function () {
expect(typeof service.Contents.Put(1111, ContentType, {
expect(typeof service.Content.Put(1111, ContentType, {
DisplayName: 'test',
Type: 'testType',
Name: 'alma'
})).to.be.eq('object');
});
it('requests to create a custom action (checkout) by id, sends a request and returns an Observable object', function () {
let action = new CustomAction({ name: 'CheckOut', id: 111, isAction: true })
expect(typeof service.Contents.CreateCustomAction(action)).to.be.eq('object');
expect(typeof service.Content.CreateCustomAction(action)).to.be.eq('object');
});
it('requests to create a custom action (checkout) by path, sends a request and returns an Observable object', function () {
let action = new CustomAction({ name: 'CheckOut', path: '/workspaces/project', isAction: true })
expect(typeof service.Contents.CreateCustomAction(action)).to.be.eq('object');
expect(typeof service.Content.CreateCustomAction(action)).to.be.eq('object');
});
it('requests to create a custom action (chekcin) by id, sends a request and returns an Observable object', function () {
let action = new CustomAction({ name: 'CheckIn', id: 111, isAction: true, params: ['checkInComments'] })
expect(typeof service.Contents.CreateCustomAction(action, { data: { 'checkInComments': 'comment' } })).to.be.eq('object');
expect(typeof service.Content.CreateCustomAction(action, { data: { 'checkInComments': 'comment' } })).to.be.eq('object');
});
it('requests to create a custom action (chekcin) by id without cache, sends a request and returns an Observable object', function () {
let action = new CustomAction({ name: 'CheckIn', id: 111, isAction: true, noCache: true, params: ['checkInComments'] })
expect(typeof service.Contents.CreateCustomAction(action, { data: { 'checkInComments': 'comment' } })).to.be.eq('object');
expect(typeof service.Content.CreateCustomAction(action, { data: { 'checkInComments': 'comment' } })).to.be.eq('object');
});
it('requests to create a custom function (getpermissions) by id, sends a request and returns an Observable object', function () {
let action = new CustomAction({ name: 'GetPermission', id: 111, isAction: false, params: ['identity'] });
expect(typeof service.Contents.CreateCustomAction(action, { data: { 'identity': '/Root/Sites/Default_Site/workspaces/Project/budapestprojectworkspace/Groups/Members' } })).to.be.eq('object');
expect(typeof service.Content.CreateCustomAction(action, { data: { 'identity': '/Root/Sites/Default_Site/workspaces/Project/budapestprojectworkspace/Groups/Members' } })).to.be.eq('object');
});
it('requests to upload a Content and returns an Observable object', function () {
expect(typeof service.Contents.Upload('/workspaces/Project', {}, false)).to.be.eq('object');
expect(typeof service.Content.Upload('/workspaces/Project', {}, false)).to.be.eq('object');
});
it('requests to upload a Content and returns an Observable object', function () {
expect(typeof service.Contents.Upload('/workspaces/Project', {}, true)).to.be.eq('object');
expect(typeof service.Content.Upload('/workspaces/Project', {}, true)).to.be.eq('object');
});
it('creates a new copy of ODataParams', () => {
const params = new ODataParams({ select: 'DisplayName' });
Expand All @@ -95,7 +95,7 @@ describe('ODataApi', () => {
const params = new ODataParams({ select: 'DisplayName' });
let http = (service.httpProviderRef as MockHttpProvider);
http.setResponse({success: true});
let action = service.Contents.CreateCustomAction({
let action = service.Content.CreateCustomAction({
path: `localhost/OData.svc('Root')`,
name: 'exampleAction'
}).first().subscribe(resp => {
Expand Down

0 comments on commit 77af644

Please sign in to comment.