Commit 29ac22b3 authored by Eduardo Sanz García's avatar Eduardo Sanz García
Browse files

docs: produce documentation from code

chore: updated to ng-packagr 2 (no need to add rxjs)
parent 1bca3bcf
......@@ -27,7 +27,6 @@ test:
artifacts:
paths:
- coverage/
expire_in: 1 week
lint:
stage: test
......@@ -36,6 +35,15 @@ lint:
- yarn lint
allow_failure: true
test:
stage: test
image: node:alpine
script:
- yarn docs
artifacts:
paths:
- docs/
build:
stage: build
image: node:alpine
......
......@@ -3,9 +3,10 @@
"lib": {
"entryFile": "public_api.ts",
"externals" :{
"@auth0/angular-jwt": "angular-jwt",
"rxjs/operators": "Rx.operators"
"@auth0/angular-jwt": "angularJwt"
},
"umdModuleIds": {
"@auth0/angular-jwt" : "angularJwt"
},
"licensePath": "LICENSE"
},
......
......@@ -10,6 +10,7 @@
"test:sr": "ng test --code-coverage=true --progress=false",
"test:sr:chromium": "ng test --code-coverage=true --progress=false --config=karma_chromium.conf.js",
"lint": "ng lint --type-check",
"docs": "typedoc --module amd --out docs/ public_api.ts",
"e2e": "ng e2e",
"packagr": "ng-packagr -p ng-package.json"
},
......@@ -18,9 +19,9 @@
"angular",
"jwt",
"authentication",
"elixir",
"ebi",
"aap",
"elixir",
"aai"
],
"repository": {
......@@ -38,20 +39,20 @@
"rxjs": ">=5.5.0 <6.0.0"
},
"devDependencies": {
"@angular/cli": "1.6.6",
"@angular/common": "^5.2.2",
"@angular/compiler": "^5.2.2",
"@angular/compiler-cli": "^5.2.2",
"@angular/core": "^5.2.2",
"@angular/language-service": "^5.2.2",
"@angular/platform-browser": "^5.2.2",
"@angular/platform-browser-dynamic": "^5.2.2",
"@angular/cli": "1.7.0",
"@angular/common": "^5.2.5",
"@angular/compiler": "^5.2.5",
"@angular/compiler-cli": "^5.2.5",
"@angular/core": "^5.2.5",
"@angular/language-service": "^5.2.5",
"@angular/platform-browser": "^5.2.5",
"@angular/platform-browser-dynamic": "^5.2.5",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~9.4.0",
"@types/node": "~9.4.6",
"codelyzer": "^4.1.0",
"core-js": "^2.5.3",
"jasmine-core": "~2.9.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
......@@ -59,12 +60,13 @@
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"ncu": "^0.2.1",
"ng-packagr": "^1.6.0",
"ng-packagr": "^2.0.0",
"protractor": "~5.3.0",
"rxjs": ">=5.5.0 <6.0.0",
"rxjs-tslint-rules": "^3.10.0",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typedoc": "^0.10.0",
"typescript": ">=2.4.2 <2.7.0",
"zone.js": "^0.8.20"
}
......
......@@ -40,7 +40,7 @@ export class AuthService {
private _loginCallbacks: Function[] = [];
private _logoutCallbacks: Function[] = [];
private _timeoutID: number;
private _timeoutID: number | undefined = undefined;
// Configuration
readonly domain: string;
......@@ -71,7 +71,7 @@ export class AuthService {
this._listenLoginMessage(renderer);
this._listenChangesFromOtherWindows(renderer);
this._updateCredentials();
this._updateCredentials(); // TODO: experiment with setTimeOut
}
public isAuthenticated(): Observable < boolean > {
......@@ -108,12 +108,12 @@ export class AuthService {
* See method _filterLoginOptions regarding security risks of certain
* LoginOptions.
*
* @param {LoginOptions} loginOptions Options passed as URL parameters to the SSO.
* @param {number} width Pixel width of the login window.
* @param {number} height Pixel height of the login window.
* @param {number} top Position of the top corners. If it is a negative
* @param loginOptions Options passed as URL parameters to the SSO.
* @param width Pixel width of the login window.
* @param height Pixel height of the login window.
* @param top Position of the top corners. If it is a negative
* number it centres the login window on the screen.
* @param {number} left Position of the left corners. If it is a negative
* @param left Position of the left corners. If it is a negative
* number it centres the login window on the screen.
*/
public windowOpen(loginOptions?: LoginOptions, width = 650, height = 1000, top = -1, left = -1) {
......@@ -158,7 +158,7 @@ export class AuthService {
* See method _filterLoginOptions regarding security risks of certain
* LoginOptions.
*
* @param {LoginOptions} loginOptions Options passed as URL parameters to the SSO.
* @param loginOptions Options passed as URL parameters to the SSO.
*/
public tabOpen(loginOptions?: LoginOptions) {
const loginWindow = window.open(this.getSSOURL(loginOptions), 'Sign in to Elixir');
......@@ -175,9 +175,9 @@ export class AuthService {
* See method _filterLoginOptions regarding security risks of certain
* LoginOptions.
*
* @param {LoginOptions} loginOptions Options passed as URL parameters to the SSO.
* @param loginOptions Options passed as URL parameters to the SSO.
*
* @returnType { string } The SSO URL.
* @returns The SSO URL.
*
*/
public getSSOURL(options?: LoginOptions): string {
......@@ -202,9 +202,8 @@ export class AuthService {
* such token, means that they could use it for a day, week, year
* (essentially, like having the username/password).
*
* @param {LoginOptions} loginOptions Options passed as URL parameters to the SSO.
* @param loginOptions Options passed as URL parameters to the SSO.
*
* @returnType { void }
*
*/
public _filterLoginOptions(options: LoginOptions) {
......@@ -239,10 +238,10 @@ export class AuthService {
/**
* Add a callback to the LogIn event.
*
* @param {Function} callback The Function called when the login event is triggered and the
* @param callback The Function called when the login event is triggered and the
* JWT token is received and accepted.
*
* @returnType { number } The event registration id (necessary to unregister the event).
* @returns The event registration id (necessary to unregister the event).
*/
public addLogInEventListener(callback: Function): number {
return this._loginCallbacks.push(callback);
......@@ -251,21 +250,21 @@ export class AuthService {
/**
* Remove a callback from the LogIn event.
*
* @param {number} The id given when event listener was added.
* @param id The id given when event listener was added.
*
* @returnType { boolean } true when remove successfully, false otherwise.
* @returns true when remove successfully, false otherwise.
*/
public removeLogInEventListener(index: number): boolean {
return delete this._loginCallbacks[index - 1];
public removeLogInEventListener(id: number): boolean {
return delete this._loginCallbacks[id - 1];
}
/**
* Add a callback to the LogOut event.
*
* @param {Function} callback The Function called when the logout event is triggered and the
* @param callback The Function called when the logout event is triggered and the
* JWT token is received and accepted.
*
* @returnType { number } The registration id (necessary to unregister the event).
* @returns The registration id (necessary to unregister the event).
*/
public addLogOutEventListener(callback: Function): number {
return this._logoutCallbacks.push(callback);
......@@ -274,12 +273,12 @@ export class AuthService {
/**
* Remove a callback from the LogOut event.
*
* @param {number} The id given when event listener was added.
* @param id The id given when event listener was added.
*
* @returnType { boolean } true when remove successfully, false otherwise.
* @returns true when remove successfully, false otherwise.
*/
public removeLogOutEventListener(index: number): boolean {
return delete this._logoutCallbacks[index - 1];
public removeLogOutEventListener(id: number): boolean {
return delete this._logoutCallbacks[id - 1];
}
/**
......@@ -355,8 +354,8 @@ export class AuthService {
/**
* Check if there's a user logging on and whether the token is still valid.
* @returnType { boolean } Whether the application is able to send
* authenticated requests or not.
*
* @returns Whether the user user is authenticated or not.
*/
private _loggedIn(): boolean {
return this._tokenService.isTokenValid();
......
......@@ -42,10 +42,10 @@ export class TokenService {
/**
* Get claims from the token.
*
* @param {string} The name of the claim
* @param {any} The default value in case of error
* @param claim The name of the claim
* @param defaultValue The default value returned in case of error
*
* @returnType { any } Claim
* @returns claim or default value
*/
public getClaim < T, C > (claim: string, defaultValue: C): T | C {
try {
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment