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

Commit

Permalink
Merge branch 'release/2.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
gallayl committed Aug 8, 2017
2 parents e26112d + 89e7e67 commit 8ffdb88
Show file tree
Hide file tree
Showing 34 changed files with 1,009 additions and 266 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ node_js:
- '7'
- '6'
before_script:
- npm install -g gulp
- npm --v
script:
- npm test
after_success:
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,22 @@ There are some Event *Observables* on the **Repository** level which you can sub
- OnCustomActionFailed


### Content Queries
You can run queries from a *repository instance* or from a *content instance*. There is a fluent API for creating type safe and valid *Content Queries*
```ts
const query = repository.CreateQuery(q =>
q.TypeIs(ContentTypes.Folder)
.And
.Equals('DisplayName', 'a*')
.Top(10));

query.Exec()
.subscribe(res => {
console.log('Folders count: ', res.Count);
console.log('Folders: ', res.Result);
}
```
### Get the Schema of the given ContentType
```ts
Expand Down
68 changes: 0 additions & 68 deletions gulpfile.js

This file was deleted.

38 changes: 9 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sn-client-js",
"version": "2.1.0",
"version": "2.2.0",
"description": "A JavaScript client for Sense/Net ECM that makes it easy to use the REST API of the Content Repository.",
"main": "dist/src/SN.js",
"files": [
Expand All @@ -22,9 +22,8 @@
"semantic-release": "semantic-release pre && semantic-release post",
"prebuild": "npm run lint && npm run clean",
"build": "tsc",
"typedoc:md": "gulp typedoc:md",
"typedoc:html": "gulp typedoc",
"publish:development": "npm t && npm run typedoc:html && npm publish --tag development"
"typedoc": "./node_modules/.bin/typedoc --tsconfig ./tsconfig.typedoc.json --out documentation --excludePrivate --theme default --readme readme.md",
"publish:development": "npm t && npm run typedoc && npm publish --tag development"
},
"repository": {
"type": "git",
Expand All @@ -44,7 +43,10 @@
"url": "https://github.com/SenseNet/sn-client-js/issues"
},
"nyc": {
"exclude": ["dist/test/**/*.*", "dist/src/**/I*.js"],
"exclude": [
"dist/test/**/*.*",
"dist/src/**/I*.js"
],
"include": "dist/src/**/*.*",
"check-coverage": true,
"cache": true,
Expand All @@ -58,44 +60,22 @@
"homepage": "https://sensenet.com",
"dependencies": {
"@reactivex/rxjs": "^5.4.2",
"nyc": "^11.0.2",
"ts-json-properties": "1.2.0"
"nyc": "^11.0.2"
},
"devDependencies": {
"@types/app-root-path": "1.2.4",
"@types/chai": "4.0.2",
"@types/mocha": "2.2.41",
"@types/node": "^8.0.0",
"chai": "4.1.1",
"codecov.io": "0.1.6",
"commitizen": "2.9.6",
"cz-conventional-changelog": "2.0.0",
"del": "3.0.0",
"fs-then-native": "2.0.0",
"gulp": "3.9.1",
"gulp-rename": "^1.2.2",
"gulp-run": "^1.7.1",
"gulp-typedoc": "2.0.2",
"highlight.js": "^9.12.0",
"istanbul": "^0.4.5",
"jsdoc-to-markdown": "^3.0.0",
"lru-cache": "^4.1.1",
"mocha": "3.5.0",
"mocha-typescript": "^1.0.23",
"natives": "^1.1.0",
"progress": "^2.0.0",
"rimraf": "^2.6.1",
"semantic-release": "^6.3.6",
"sigmund": "^1.0.1",
"through2": "^2.0.3",
"ts-json-properties": "^1.2.0",
"tslint": "^5.4.3",
"typedoc": "^0.8.0",
"typedoc-default-themes": "^0.5.0",
"typedoc-md-theme": "^1.0.1",
"typedoc-plugin-external-module-name": "^1.0.9",
"typescript": "2.4.2",
"universalify": "^0.1.0"
"typescript": "2.4.2"
},
"czConfig": {
"path": "node_modules/cz-conventional-changelog"
Expand Down
2 changes: 0 additions & 2 deletions src/Authentication/JwtService.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/**
* @module Authentication
* @preferred
* @description This module that contains authentication-related classes, types and interfaces
*/ /** */

import { LoginState, LoginResponse, RefreshResponse, Token, TokenStore, IAuthenticationService, TokenPersist } from './';
Expand Down
6 changes: 6 additions & 0 deletions src/Authentication/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* @module Authentication
* @preferred
* @description This module that contains authentication-related classes, types and interfaces
*/ /** */

export * from './IAuthenticationService';
export * from './ITokenPayload';
export * from './JwtService';
Expand Down
67 changes: 30 additions & 37 deletions src/Collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export class Collection<T extends Content> {
* @param { IODataApi<any, any> } service The service to use as API Endpoint
*/
constructor(private items: T[],
private repository: BaseRepository,
private readonly contentType: {new(...args: any[]): T} = Content.constructor as {new(...args: any[]): any}) {
private repository: BaseRepository,
private readonly contentType: { new(...args: any[]): T } = Content as { new(...args: any[]): any }) {
this.odata = repository.GetODataApi();
}

Expand Down Expand Up @@ -115,7 +115,6 @@ export class Collection<T extends Content> {
* });
* ```
*/
public Remove(index: number, permanently?: boolean): Observable<any>;
/**
* Method to remove an item from a local collection and from the Content Repository through OData REST API at the same time.
*
Expand All @@ -135,11 +134,10 @@ export class Collection<T extends Content> {
* });
* ```
*/
public Remove(items: number[], permanently?: boolean): Observable<any>;
public Remove(arg: any, permanently: boolean = false): Observable<any> {
public Remove(arg: number | number[], permanently: boolean = false): Observable<any> {
if (typeof arg === 'number') {
let content = this.items[arg];
if (content && content.Id){
if (content && content.Id) {
this.items =
this.items.slice(0, arg)
.concat(this.items.slice(arg + 1));
Expand Down Expand Up @@ -181,18 +179,16 @@ export class Collection<T extends Content> {
*/
public Read(path: string, options?: IODataParams): Observable<any> {
this.Path = path;
let o = {};
let o: any = {};
if (typeof options !== 'undefined') {
o['params'] = options;
}
o['path'] = path;
let optionList = new ODataRequestOptions(o as ODataRequestOptions);
const children = this.odata.Fetch<T>(optionList);
children
.subscribe(
(items) => {
this.items = items.d.results.map(c => this.repository.HandleLoadedContent(c, this.contentType));
}
const children = this.odata.Fetch<T>(optionList)
.map(items => {
return items.d.results.map(c => this.repository.HandleLoadedContent(c, this.contentType));
}
);
return children;
}
Expand All @@ -213,7 +209,6 @@ export class Collection<T extends Content> {
* });
* ```
*/
public Move(index: number, targetPath: string): Observable<any>;
/**
* Method to move multiple content to another container.
* @param items {number[]} number array of content indexes.
Expand All @@ -231,8 +226,7 @@ export class Collection<T extends Content> {
* });
* ```
*/
public Move(items: number[], targetPath: string): Observable<any>;
public Move(arg: any, targetPath: string): Observable<any> {
public Move(arg: number | number[], targetPath: string): Observable<any> {
if (typeof arg === 'number') {
this.items =
this.items.slice(0, arg)
Expand Down Expand Up @@ -265,26 +259,25 @@ export class Collection<T extends Content> {
* });
* ```
*/
public Copy(index: number, targetPath: string): Observable<any>;

/**
* Method to copy multiple content to another container.
* @param items {number[]} number array of content indexes.
* @params targetPath {string} Path of the target container.
* @returns {Observable} Returns an RxJS observable that you can subscribe of in your code.
* ```
* let copy = myCollection.Copy([3, 5], '/Root/MyContent/MyFolder');
* copy
* .subscribe({
* next: response => {
* //do something after copy
* },
* error: error => console.error('something wrong occurred: ' + error),
* complete: () => console.log('done'),
* });
* ```
*/
public Copy(items: number[], targetPath: string): Observable<any>;
public Copy(arg: any, targetPath: string): Observable<any> {
* Method to copy multiple content to another container.
* @param items {number[]} number array of content indexes.
* @params targetPath {string} Path of the target container.
* @returns {Observable} Returns an RxJS observable that you can subscribe of in your code.
* ```
* let copy = myCollection.Copy([3, 5], '/Root/MyContent/MyFolder');
* copy
* .subscribe({
* next: response => {
* //do something after copy
* },
* error: error => console.error('something wrong occurred: ' + error),
* complete: () => console.log('done'),
* });
* ```
*/
public Copy(arg: number | number[], targetPath: string): Observable<any> {
if (typeof arg === 'number') {
let action = new CustomAction({ name: 'Copy', id: arg, isAction: true, requiredParams: ['targetPath'] });
return this.odata.CreateCustomAction(action, { data: [{ 'targetPath': targetPath }] });
Expand All @@ -311,7 +304,7 @@ export class Collection<T extends Content> {
* ```
*/
public AllowedChildTypes(options?: Object): Observable<any> {
let o = {};
let o: any = {};
if (options) {
o['params'] = options;
}
Expand All @@ -335,7 +328,7 @@ export class Collection<T extends Content> {
* @returns {Observable} Returns an RxJS observable that you can subscribe of in your code.
*/
public Upload(contentType: string, fileName: string, overwrite: boolean = true, useChunk: boolean = false, propertyName?: string, fileText?: string): Observable<any> {
const data = {
const data: any = {
ContentType: contentType,
FileName: fileName,
Overwrite: overwrite,
Expand Down
5 changes: 5 additions & 0 deletions src/Config/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module Config
* @preferred
* @description Library module for storing configuration related classes and interfaces.
*//** */
export * from './snconfigbehavior';
export * from './snconfigfielddecorator';
export * from './snconfigfieldmodel';
Expand Down
2 changes: 0 additions & 2 deletions src/Config/snconfigbehavior.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/**
* @module Config
* @preferred
* @description Library module for storing configuration related classes and interfaces.
*//** */


Expand Down
Loading

0 comments on commit 8ffdb88

Please sign in to comment.