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

Commit 8ffdb88

Browse files
committed
Merge branch 'release/2.2.0'
2 parents e26112d + 89e7e67 commit 8ffdb88

34 files changed

+1009
-266
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ node_js:
99
- '7'
1010
- '6'
1111
before_script:
12-
- npm install -g gulp
12+
- npm --v
1313
script:
1414
- npm test
1515
after_success:

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,22 @@ There are some Event *Observables* on the **Repository** level which you can sub
173173
- OnCustomActionFailed
174174

175175

176+
### Content Queries
177+
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*
178+
```ts
179+
const query = repository.CreateQuery(q =>
180+
q.TypeIs(ContentTypes.Folder)
181+
.And
182+
.Equals('DisplayName', 'a*')
183+
.Top(10));
184+
185+
query.Exec()
186+
.subscribe(res => {
187+
console.log('Folders count: ', res.Count);
188+
console.log('Folders: ', res.Result);
189+
}
190+
```
191+
176192
### Get the Schema of the given ContentType
177193
178194
```ts

gulpfile.js

Lines changed: 0 additions & 68 deletions
This file was deleted.

package.json

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sn-client-js",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "A JavaScript client for Sense/Net ECM that makes it easy to use the REST API of the Content Repository.",
55
"main": "dist/src/SN.js",
66
"files": [
@@ -22,9 +22,8 @@
2222
"semantic-release": "semantic-release pre && semantic-release post",
2323
"prebuild": "npm run lint && npm run clean",
2424
"build": "tsc",
25-
"typedoc:md": "gulp typedoc:md",
26-
"typedoc:html": "gulp typedoc",
27-
"publish:development": "npm t && npm run typedoc:html && npm publish --tag development"
25+
"typedoc": "./node_modules/.bin/typedoc --tsconfig ./tsconfig.typedoc.json --out documentation --excludePrivate --theme default --readme readme.md",
26+
"publish:development": "npm t && npm run typedoc && npm publish --tag development"
2827
},
2928
"repository": {
3029
"type": "git",
@@ -44,7 +43,10 @@
4443
"url": "https://github.com/SenseNet/sn-client-js/issues"
4544
},
4645
"nyc": {
47-
"exclude": ["dist/test/**/*.*", "dist/src/**/I*.js"],
46+
"exclude": [
47+
"dist/test/**/*.*",
48+
"dist/src/**/I*.js"
49+
],
4850
"include": "dist/src/**/*.*",
4951
"check-coverage": true,
5052
"cache": true,
@@ -58,44 +60,22 @@
5860
"homepage": "https://sensenet.com",
5961
"dependencies": {
6062
"@reactivex/rxjs": "^5.4.2",
61-
"nyc": "^11.0.2",
62-
"ts-json-properties": "1.2.0"
63+
"nyc": "^11.0.2"
6364
},
6465
"devDependencies": {
6566
"@types/app-root-path": "1.2.4",
6667
"@types/chai": "4.0.2",
6768
"@types/mocha": "2.2.41",
6869
"@types/node": "^8.0.0",
6970
"chai": "4.1.1",
70-
"codecov.io": "0.1.6",
7171
"commitizen": "2.9.6",
72-
"cz-conventional-changelog": "2.0.0",
73-
"del": "3.0.0",
74-
"fs-then-native": "2.0.0",
75-
"gulp": "3.9.1",
76-
"gulp-rename": "^1.2.2",
77-
"gulp-run": "^1.7.1",
78-
"gulp-typedoc": "2.0.2",
79-
"highlight.js": "^9.12.0",
80-
"istanbul": "^0.4.5",
81-
"jsdoc-to-markdown": "^3.0.0",
82-
"lru-cache": "^4.1.1",
8372
"mocha": "3.5.0",
8473
"mocha-typescript": "^1.0.23",
85-
"natives": "^1.1.0",
86-
"progress": "^2.0.0",
8774
"rimraf": "^2.6.1",
88-
"semantic-release": "^6.3.6",
89-
"sigmund": "^1.0.1",
90-
"through2": "^2.0.3",
91-
"ts-json-properties": "^1.2.0",
9275
"tslint": "^5.4.3",
9376
"typedoc": "^0.8.0",
94-
"typedoc-default-themes": "^0.5.0",
95-
"typedoc-md-theme": "^1.0.1",
9677
"typedoc-plugin-external-module-name": "^1.0.9",
97-
"typescript": "2.4.2",
98-
"universalify": "^0.1.0"
78+
"typescript": "2.4.2"
9979
},
10080
"czConfig": {
10181
"path": "node_modules/cz-conventional-changelog"

src/Authentication/JwtService.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
/**
22
* @module Authentication
3-
* @preferred
4-
* @description This module that contains authentication-related classes, types and interfaces
53
*/ /** */
64

75
import { LoginState, LoginResponse, RefreshResponse, Token, TokenStore, IAuthenticationService, TokenPersist } from './';

src/Authentication/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/**
2+
* @module Authentication
3+
* @preferred
4+
* @description This module that contains authentication-related classes, types and interfaces
5+
*/ /** */
6+
17
export * from './IAuthenticationService';
28
export * from './ITokenPayload';
39
export * from './JwtService';

src/Collection.ts

Lines changed: 30 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export class Collection<T extends Content> {
2424
* @param { IODataApi<any, any> } service The service to use as API Endpoint
2525
*/
2626
constructor(private items: T[],
27-
private repository: BaseRepository,
28-
private readonly contentType: {new(...args: any[]): T} = Content.constructor as {new(...args: any[]): any}) {
27+
private repository: BaseRepository,
28+
private readonly contentType: { new(...args: any[]): T } = Content as { new(...args: any[]): any }) {
2929
this.odata = repository.GetODataApi();
3030
}
3131

@@ -115,7 +115,6 @@ export class Collection<T extends Content> {
115115
* });
116116
* ```
117117
*/
118-
public Remove(index: number, permanently?: boolean): Observable<any>;
119118
/**
120119
* Method to remove an item from a local collection and from the Content Repository through OData REST API at the same time.
121120
*
@@ -135,11 +134,10 @@ export class Collection<T extends Content> {
135134
* });
136135
* ```
137136
*/
138-
public Remove(items: number[], permanently?: boolean): Observable<any>;
139-
public Remove(arg: any, permanently: boolean = false): Observable<any> {
137+
public Remove(arg: number | number[], permanently: boolean = false): Observable<any> {
140138
if (typeof arg === 'number') {
141139
let content = this.items[arg];
142-
if (content && content.Id){
140+
if (content && content.Id) {
143141
this.items =
144142
this.items.slice(0, arg)
145143
.concat(this.items.slice(arg + 1));
@@ -181,18 +179,16 @@ export class Collection<T extends Content> {
181179
*/
182180
public Read(path: string, options?: IODataParams): Observable<any> {
183181
this.Path = path;
184-
let o = {};
182+
let o: any = {};
185183
if (typeof options !== 'undefined') {
186184
o['params'] = options;
187185
}
188186
o['path'] = path;
189187
let optionList = new ODataRequestOptions(o as ODataRequestOptions);
190-
const children = this.odata.Fetch<T>(optionList);
191-
children
192-
.subscribe(
193-
(items) => {
194-
this.items = items.d.results.map(c => this.repository.HandleLoadedContent(c, this.contentType));
195-
}
188+
const children = this.odata.Fetch<T>(optionList)
189+
.map(items => {
190+
return items.d.results.map(c => this.repository.HandleLoadedContent(c, this.contentType));
191+
}
196192
);
197193
return children;
198194
}
@@ -213,7 +209,6 @@ export class Collection<T extends Content> {
213209
* });
214210
* ```
215211
*/
216-
public Move(index: number, targetPath: string): Observable<any>;
217212
/**
218213
* Method to move multiple content to another container.
219214
* @param items {number[]} number array of content indexes.
@@ -231,8 +226,7 @@ export class Collection<T extends Content> {
231226
* });
232227
* ```
233228
*/
234-
public Move(items: number[], targetPath: string): Observable<any>;
235-
public Move(arg: any, targetPath: string): Observable<any> {
229+
public Move(arg: number | number[], targetPath: string): Observable<any> {
236230
if (typeof arg === 'number') {
237231
this.items =
238232
this.items.slice(0, arg)
@@ -265,26 +259,25 @@ export class Collection<T extends Content> {
265259
* });
266260
* ```
267261
*/
268-
public Copy(index: number, targetPath: string): Observable<any>;
262+
269263
/**
270-
* Method to copy multiple content to another container.
271-
* @param items {number[]} number array of content indexes.
272-
* @params targetPath {string} Path of the target container.
273-
* @returns {Observable} Returns an RxJS observable that you can subscribe of in your code.
274-
* ```
275-
* let copy = myCollection.Copy([3, 5], '/Root/MyContent/MyFolder');
276-
* copy
277-
* .subscribe({
278-
* next: response => {
279-
* //do something after copy
280-
* },
281-
* error: error => console.error('something wrong occurred: ' + error),
282-
* complete: () => console.log('done'),
283-
* });
284-
* ```
285-
*/
286-
public Copy(items: number[], targetPath: string): Observable<any>;
287-
public Copy(arg: any, targetPath: string): Observable<any> {
264+
* Method to copy multiple content to another container.
265+
* @param items {number[]} number array of content indexes.
266+
* @params targetPath {string} Path of the target container.
267+
* @returns {Observable} Returns an RxJS observable that you can subscribe of in your code.
268+
* ```
269+
* let copy = myCollection.Copy([3, 5], '/Root/MyContent/MyFolder');
270+
* copy
271+
* .subscribe({
272+
* next: response => {
273+
* //do something after copy
274+
* },
275+
* error: error => console.error('something wrong occurred: ' + error),
276+
* complete: () => console.log('done'),
277+
* });
278+
* ```
279+
*/
280+
public Copy(arg: number | number[], targetPath: string): Observable<any> {
288281
if (typeof arg === 'number') {
289282
let action = new CustomAction({ name: 'Copy', id: arg, isAction: true, requiredParams: ['targetPath'] });
290283
return this.odata.CreateCustomAction(action, { data: [{ 'targetPath': targetPath }] });
@@ -311,7 +304,7 @@ export class Collection<T extends Content> {
311304
* ```
312305
*/
313306
public AllowedChildTypes(options?: Object): Observable<any> {
314-
let o = {};
307+
let o: any = {};
315308
if (options) {
316309
o['params'] = options;
317310
}
@@ -335,7 +328,7 @@ export class Collection<T extends Content> {
335328
* @returns {Observable} Returns an RxJS observable that you can subscribe of in your code.
336329
*/
337330
public Upload(contentType: string, fileName: string, overwrite: boolean = true, useChunk: boolean = false, propertyName?: string, fileText?: string): Observable<any> {
338-
const data = {
331+
const data: any = {
339332
ContentType: contentType,
340333
FileName: fileName,
341334
Overwrite: overwrite,

src/Config/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* @module Config
3+
* @preferred
4+
* @description Library module for storing configuration related classes and interfaces.
5+
*//** */
16
export * from './snconfigbehavior';
27
export * from './snconfigfielddecorator';
38
export * from './snconfigfieldmodel';

src/Config/snconfigbehavior.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
/**
22
* @module Config
3-
* @preferred
4-
* @description Library module for storing configuration related classes and interfaces.
53
*//** */
64

75

0 commit comments

Comments
 (0)