Skip to content

Commit

Permalink
Remove JSDoc and switch to Angular 14 RC.0 (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
henryruhs authored May 15, 2022
1 parent 66b0844 commit d987c59
Show file tree
Hide file tree
Showing 19 changed files with 27 additions and 977 deletions.
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ngx-crud",
"description": "CRUD services in Angular with effortless aborting, caching and observing",
"version": "11.0.0-next.3",
"version": "11.0.0-next.4",
"homepage": "https://ngx-crud.com",
"license": "MIT",
"type": "module",
Expand Down Expand Up @@ -30,31 +30,31 @@
},
"peerDependencies":
{
"@angular/common": "14.0.0-next.14",
"@angular/core": "14.0.0-next.14",
"@angular/common": "14.0.0-rc.0",
"@angular/core": "14.0.0-rc.0",
"rxjs": "^7"
},
"devDependencies":
{
"@angular/common": "14.0.0-next.14",
"@angular/compiler": "14.0.0-next.14",
"@angular/compiler-cli": "14.0.0-next.14",
"@angular/core": "14.0.0-next.14",
"@angular/platform-browser": "14.0.0-next.14",
"@angular/platform-browser-dynamic": "14.0.0-next.14",
"@isnotdefined/eslint-config": "4.7.0",
"@angular/common": "14.0.0-rc.0",
"@angular/compiler": "14.0.0-rc.0",
"@angular/compiler-cli": "14.0.0-rc.0",
"@angular/core": "14.0.0-rc.0",
"@angular/platform-browser": "14.0.0-rc.0",
"@angular/platform-browser-dynamic": "14.0.0-rc.0",
"@isnotdefined/eslint-config": "5.0.0",
"@types/chai": "4.3.1",
"@types/mocha": "9.1.1",
"chai": "4.3.6",
"core-js": "3.22.2",
"eslint": "8.13.0",
"core-js": "3.22.5",
"eslint": "8.15.0",
"jsdom": "19.0.0",
"jsdom-global": "3.0.2",
"mocha": "9.2.2",
"ng-packagr": "14.0.0-next.5",
"mocha": "10.0.0",
"ng-packagr": "14.0.0-rc.0",
"rxjs": "7.5.5",
"ts-node": "10.7.0",
"typescript": "4.6.3",
"typescript": "4.6.4",
"zone.js": "0.11.5"
},
"scripts":
Expand Down
22 changes: 0 additions & 22 deletions src/abort/abort.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@ export class AbortInterceptor implements HttpInterceptor
{
}

/**
* intercept the request
*
* @since 4.0.0
*
* @param {HttpRequest<T>} request instance of the http request
* @param {HttpHandler} next instance of the http handler
*
* @return {Observable<HttpEvent<T>>} http event
*/

intercept<T>(request : HttpRequest<T>, next : HttpHandler) : Observable<HttpEvent<T>>
{
const context : Context = request.context.get(this.abortService.getToken());
Expand All @@ -37,17 +26,6 @@ export class AbortInterceptor implements HttpInterceptor
return enableAbort ? this.handle(request, next) : next.handle(request);
}

/**
* handle the request
*
* @since 4.0.0
*
* @param {HttpRequest<T>} request instance of the http request
* @param {HttpHandler} next instance of the http handler
*
* @return {Observable<HttpEvent<T>>} http event
*/

handle<T>(request : HttpRequest<T>, next : HttpHandler) : Observable<HttpEvent<T>>
{
return next
Expand Down
74 changes: 0 additions & 74 deletions src/abort/abort.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,11 @@ export class AbortService
protected token : HttpContextToken<Context> = new HttpContextToken<Context>(() => this.defaultContext);
protected store : Map<string, Store> = new Map();

/**
* get the token of the context
*
* @since 6.0.0
*
* @return {HttpContextToken<Context>} token of the context
*/

getToken() : HttpContextToken<Context>
{
return this.token;
}

/**
* get the signal of the request
*
* @since 4.0.0
*
* @param {HttpRequest<T>} request instance of the http request
*
* @return {Observable<boolean>} signal of the request
*/

get<T>(request : HttpRequest<T>) : Observable<boolean>
{
if (!this.has(request))
Expand All @@ -47,16 +29,6 @@ export class AbortService
return this.store.get(request.urlWithParams).signal;
}

/**
* set the signal and timer for the request
*
* @since 4.0.0
*
* @param {HttpRequest<T>} request instance of the http request
*
* @return {this} instance of the service
*/

set<T>(request : HttpRequest<T>) : this
{
const context : Context = request.context.get(this.getToken());
Expand All @@ -74,31 +46,11 @@ export class AbortService
return this;
}

/**
* has a signal and timer for the request
*
* @since 4.0.0
*
* @param {HttpRequest<T>} request instance of the http request
*
* @return {boolean}
*/

has<T>(request : HttpRequest<T>) : boolean
{
return this.store.has(request.urlWithParams);
}

/**
* abort a single request for enabled services
*
* @since 4.0.0
*
* @param {string} urlWithParams url with parameters
*
* @return {this} instance of the service
*/

abort(urlWithParams : string) : this
{
if (this.store.has(urlWithParams))
Expand All @@ -110,44 +62,18 @@ export class AbortService
return this;
}

/**
* abort many requests for enabled services
*
* @since 4.1.0
*
* @param {string} url url of the request
*
* @return {this} instance of the service
*/

abortMany(url : string) : this
{
this.store.forEach((value, urlWithParams) => urlWithParams.startsWith(url) ? this.abort(urlWithParams) : null);
return this;
}

/**
* abort all requests for enabled services
*
* @since 4.0.0
*
* @return {this} instance of the service
*/

abortAll() : this
{
this.store.forEach((value, urlWithParams) => this.abort(urlWithParams));
return this;
}

/**
* observe all requests for enabled services
*
* @since 4.1.0
*
* @return {Observable<[string, Store]>} collection of signal and timer
*/

observeAll() : Observable<[string, Store]>
{
return from(this.store);
Expand Down
33 changes: 0 additions & 33 deletions src/cache/cache.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,6 @@ export class CacheInterceptor implements HttpInterceptor
{
}

/**
* intercept the request
*
* @since 3.0.0
*
* @param {HttpRequest<T>} request instance of the http request
* @param {HttpHandler} next instance of the http handler
*
* @return {Observable<HttpEvent<T>>} http event
*/

intercept<T>(request : HttpRequest<T>, next : HttpHandler) : Observable<HttpEvent<T>>
{
const context : Context = request.context.get(this.cacheService.getToken());
Expand All @@ -38,33 +27,11 @@ export class CacheInterceptor implements HttpInterceptor
return enableCache ? this.handle(request, next) : next.handle(request);
}

/**
* handle the request
*
* @since 3.0.0
*
* @param {HttpRequest<T>} request instance of the http request
* @param {HttpHandler} next instance of the http handler
*
* @return {Observable<HttpEvent<T>>} http event
*/

protected handle<T>(request : HttpRequest<T>, next : HttpHandler) : Observable<HttpEvent<T>>
{
return this.cacheService.has(request) ? this.cacheService.get(request) : this.store(request, next);
}

/**
* store the request
*
* @since 3.0.0
*
* @param {HttpRequest<T>} request instance of the http request
* @param {HttpHandler} next instance of the http handler
*
* @return {Observable<HttpResponse<T>>} http response
*/

protected store<T>(request : HttpRequest<T>, next : HttpHandler) : Observable<HttpResponse<T>>
{
const nextHandler : Observable<HttpResponse<T>> = next
Expand Down
75 changes: 0 additions & 75 deletions src/cache/cache.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,11 @@ export class CacheService
protected token : HttpContextToken<Context> = new HttpContextToken<Context>(() => this.defaultContext);
protected store : Map<string, Store> = new Map();

/**
* get the token of the context
*
* @since 6.0.0
*
* @return {HttpContextToken<Context>} token of the context
*/

getToken() : HttpContextToken<Context>
{
return this.token;
}

/**
* get the response of the request
*
* @since 3.0.0
*
* @param {HttpRequest<T>} request instance of the http request
*
* @return {Observable<HttpResponse<T>>} http response
*/

get<T>(request : HttpRequest<T>) : Observable<HttpResponse<T>>
{
if (!this.has(request))
Expand All @@ -47,17 +29,6 @@ export class CacheService
return this.store.get(request.urlWithParams).response;
}

/**
* set the response and timer for the request
*
* @since 3.0.0
*
* @param {HttpRequest<T>} request instance of the http request
* @param {Observable<HttpResponse<T>>} response instance of the http response
*
* @return {this} instance of the service
*/

set<T>(request : HttpRequest<T>, response : Observable<HttpResponse<T>>) : this
{
const context : Context = request.context.get(this.getToken());
Expand All @@ -74,31 +45,11 @@ export class CacheService
return this;
}

/**
* has a response and timer for the request
*
* @since 3.0.0
*
* @param {HttpRequest<T>} request instance of the http request
*
* @return {boolean}
*/

has<T>(request : HttpRequest<T>) : boolean
{
return this.store.has(request.urlWithParams);
}

/**
* flush a single cache for enabled services
*
* @since 3.0.0
*
* @param {string} urlWithParams url with parameters
*
* @return {this} instance of the service
*/

flush(urlWithParams : string) : this
{
if (this.store.has(urlWithParams))
Expand All @@ -109,44 +60,18 @@ export class CacheService
return this;
}

/**
* flush many caches for enabled services
*
* @since 4.1.0
*
* @param {string} url url of the request
*
* @return {this} instance of the service
*/

flushMany(url : string) : this
{
this.store.forEach((value, urlWithParams) => urlWithParams.startsWith(url) ? this.flush(urlWithParams) : null);
return this;
}

/**
* flush all caches for enabled services
*
* @since 3.0.0
*
* @return {this} instance of the service
*/

flushAll() : this
{
this.store.forEach((value, urlWithParams) => this.flush(urlWithParams));
return this;
}

/**
* observe all caches for enabled services
*
* @since 4.1.0
*
* @return {Observable<[string, Store]>} collection of response and timer
*/

observeAll() : Observable<[string, Store]>
{
return from(this.store);
Expand Down
Loading

0 comments on commit d987c59

Please sign in to comment.