Add documentation to the helpers module.
This commit is contained in:
parent
c9f73899c3
commit
e0c045cdfa
@ -63,6 +63,13 @@
|
|||||||
<code>src/app/_helpers/custom-error-state-matcher.ts</code>
|
<code>src/app/_helpers/custom-error-state-matcher.ts</code>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p class="comment">
|
||||||
|
<h3>Description</h3>
|
||||||
|
</p>
|
||||||
|
<p class="comment">
|
||||||
|
<p>Custom provider that defines how form controls behave with regards to displaying error messages.</p>
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<p class="comment">
|
<p class="comment">
|
||||||
@ -72,6 +79,11 @@
|
|||||||
<code>ErrorStateMatcher</code>
|
<code>ErrorStateMatcher</code>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p class="comment">
|
||||||
|
<h3>Example</h3>
|
||||||
|
</p>
|
||||||
|
<div class="io-description">
|
||||||
|
</div>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h3 id="index">Index</h3>
|
<h3 id="index">Index</h3>
|
||||||
@ -130,14 +142,16 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
<div class="io-line">Defined in <a href="" data-line="5"
|
<div class="io-line">Defined in <a href="" data-line="18"
|
||||||
class="link-to-prism">src/app/_helpers/custom-error-state-matcher.ts:5</a></div>
|
class="link-to-prism">src/app/_helpers/custom-error-state-matcher.ts:18</a></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>Checks whether an invalid input has been made and an error should be made.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
<b>Parameters :</b>
|
<b>Parameters :</b>
|
||||||
@ -147,6 +161,7 @@
|
|||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
<td>Type</td>
|
<td>Type</td>
|
||||||
<td>Optional</td>
|
<td>Optional</td>
|
||||||
|
<td>Description</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -161,6 +176,12 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>Tracks the value and validation status of an individual form control.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>form</td>
|
<td>form</td>
|
||||||
@ -173,6 +194,12 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>Binding of an existing FormGroup to a DOM element.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -184,6 +211,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
|
<p>true - If an invalid input has been made to the form control.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -200,10 +228,22 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {ErrorStateMatcher} from '@angular/material/core';
|
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {FormControl, FormGroupDirective, NgForm} from '@angular/forms';
|
||||||
import {FormControl, FormGroupDirective, NgForm} from '@angular/forms';
|
import {ErrorStateMatcher} from '@angular/material/core';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom provider that defines how form controls behave with regards to displaying error messages.
|
||||||
|
*
|
||||||
|
* @implements ErrorStateMatcher
|
||||||
|
*/
|
||||||
export class CustomErrorStateMatcher implements ErrorStateMatcher{
|
export class CustomErrorStateMatcher implements ErrorStateMatcher{
|
||||||
|
/**
|
||||||
|
* Checks whether an invalid input has been made and an error should be made.
|
||||||
|
*
|
||||||
|
* @param control - Tracks the value and validation status of an individual form control.
|
||||||
|
* @param form - Binding of an existing FormGroup to a DOM element.
|
||||||
|
* @returns true - If an invalid input has been made to the form control.
|
||||||
|
*/
|
||||||
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
|
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
|
||||||
const isSubmitted: boolean = form && form.submitted;
|
const isSubmitted: boolean = form && form.submitted;
|
||||||
return !!(control && control.invalid && (control.dirty || control.touched || isSubmitted));
|
return !!(control && control.invalid && (control.dirty || control.touched || isSubmitted));
|
||||||
|
@ -63,6 +63,13 @@
|
|||||||
<code>src/app/_helpers/custom.validator.ts</code>
|
<code>src/app/_helpers/custom.validator.ts</code>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p class="comment">
|
||||||
|
<h3>Description</h3>
|
||||||
|
</p>
|
||||||
|
<p class="comment">
|
||||||
|
<p>Provides methods to perform custom validation to form inputs.</p>
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -131,14 +138,16 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
<div class="io-line">Defined in <a href="" data-line="4"
|
<div class="io-line">Defined in <a href="" data-line="13"
|
||||||
class="link-to-prism">src/app/_helpers/custom.validator.ts:4</a></div>
|
class="link-to-prism">src/app/_helpers/custom.validator.ts:13</a></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>Sets errors to the confirm password input field if it does not match with the value in the password input field.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
<b>Parameters :</b>
|
<b>Parameters :</b>
|
||||||
@ -148,6 +157,7 @@
|
|||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
<td>Type</td>
|
<td>Type</td>
|
||||||
<td>Optional</td>
|
<td>Optional</td>
|
||||||
|
<td>Description</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -162,6 +172,12 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>The control object of the form being validated.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -203,14 +219,16 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
<div class="io-line">Defined in <a href="" data-line="12"
|
<div class="io-line">Defined in <a href="" data-line="28"
|
||||||
class="link-to-prism">src/app/_helpers/custom.validator.ts:12</a></div>
|
class="link-to-prism">src/app/_helpers/custom.validator.ts:28</a></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>Sets errors to a form field if it does not match with the regular expression given.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
<b>Parameters :</b>
|
<b>Parameters :</b>
|
||||||
@ -220,6 +238,7 @@
|
|||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
<td>Type</td>
|
<td>Type</td>
|
||||||
<td>Optional</td>
|
<td>Optional</td>
|
||||||
|
<td>Description</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -234,6 +253,12 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>The regular expression to match with the form field.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>error</td>
|
<td>error</td>
|
||||||
@ -246,6 +271,12 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>Defines the map of errors to return from failed validation checks.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -257,6 +288,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
|
<p>The map of errors returned from failed validation checks.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -275,7 +307,15 @@
|
|||||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {AbstractControl, ValidationErrors} from '@angular/forms';
|
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {AbstractControl, ValidationErrors} from '@angular/forms';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides methods to perform custom validation to form inputs.
|
||||||
|
*/
|
||||||
export class CustomValidator {
|
export class CustomValidator {
|
||||||
|
/**
|
||||||
|
* Sets errors to the confirm password input field if it does not match with the value in the password input field.
|
||||||
|
*
|
||||||
|
* @param control - The control object of the form being validated.
|
||||||
|
*/
|
||||||
static passwordMatchValidator(control: AbstractControl): void {
|
static passwordMatchValidator(control: AbstractControl): void {
|
||||||
const password: string = control.get('password').value;
|
const password: string = control.get('password').value;
|
||||||
const confirmPassword: string = control.get('confirmPassword').value;
|
const confirmPassword: string = control.get('confirmPassword').value;
|
||||||
@ -284,6 +324,13 @@ export class CustomValidator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets errors to a form field if it does not match with the regular expression given.
|
||||||
|
*
|
||||||
|
* @param regex - The regular expression to match with the form field.
|
||||||
|
* @param error - Defines the map of errors to return from failed validation checks.
|
||||||
|
* @returns The map of errors returned from failed validation checks.
|
||||||
|
*/
|
||||||
static patternValidator(regex: RegExp, error: ValidationErrors): ValidationErrors | null {
|
static patternValidator(regex: RegExp, error: ValidationErrors): ValidationErrors | null {
|
||||||
return (control: AbstractControl): { [key: string]: any } => {
|
return (control: AbstractControl): { [key: string]: any } => {
|
||||||
if (!control.value) {
|
if (!control.value) {
|
||||||
|
@ -63,6 +63,13 @@
|
|||||||
<code>src/app/_helpers/global-error-handler.ts</code>
|
<code>src/app/_helpers/global-error-handler.ts</code>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p class="comment">
|
||||||
|
<h3>Description</h3>
|
||||||
|
</p>
|
||||||
|
<p class="comment">
|
||||||
|
<p>A generalized http response error.</p>
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
<p class="comment">
|
<p class="comment">
|
||||||
<h3>Extends</h3>
|
<h3>Extends</h3>
|
||||||
@ -72,6 +79,11 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p class="comment">
|
||||||
|
<h3>Example</h3>
|
||||||
|
</p>
|
||||||
|
<div class="io-description">
|
||||||
|
</div>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h3 id="index">Index</h3>
|
<h3 id="index">Index</h3>
|
||||||
@ -113,12 +125,14 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
<div class="io-line">Defined in <a href="" data-line="8" class="link-to-prism">src/app/_helpers/global-error-handler.ts:8</a></div>
|
<div class="io-line">Defined in <a href="" data-line="16" class="link-to-prism">src/app/_helpers/global-error-handler.ts:16</a></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>Initialize the HttpError class.</p>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<b>Parameters :</b>
|
<b>Parameters :</b>
|
||||||
<table class="params">
|
<table class="params">
|
||||||
@ -127,6 +141,7 @@
|
|||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
<td>Type</td>
|
<td>Type</td>
|
||||||
<td>Optional</td>
|
<td>Optional</td>
|
||||||
|
<td>Description</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -141,6 +156,12 @@
|
|||||||
No
|
No
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<code><ul>
|
||||||
|
<li>The message given by the error.</li>
|
||||||
|
</ul>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>status</td>
|
<td>status</td>
|
||||||
@ -153,6 +174,12 @@
|
|||||||
No
|
No
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<code><ul>
|
||||||
|
<li>The status code given by the error.</li>
|
||||||
|
</ul>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -189,10 +216,16 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
<div class="io-line">Defined in <a href="" data-line="8" class="link-to-prism">src/app/_helpers/global-error-handler.ts:8</a></div>
|
<div class="io-line">Defined in <a href="" data-line="16" class="link-to-prism">src/app/_helpers/global-error-handler.ts:16</a></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>The error's status code. </p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -208,14 +241,28 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {ErrorHandler, Injectable} from '@angular/core';
|
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {HttpErrorResponse} from '@angular/common/http';
|
||||||
import {LoggingService} from '@app/_services/logging.service';
|
import {ErrorHandler, Injectable} from '@angular/core';
|
||||||
import {HttpErrorResponse} from '@angular/common/http';
|
|
||||||
import {Router} from '@angular/router';
|
import {Router} from '@angular/router';
|
||||||
|
|
||||||
// A generalized http response error
|
// Application imports
|
||||||
|
import {LoggingService} from '@app/_services/logging.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A generalized http response error.
|
||||||
|
*
|
||||||
|
* @extends Error
|
||||||
|
*/
|
||||||
export class HttpError extends Error {
|
export class HttpError extends Error {
|
||||||
|
/** The error's status code. */
|
||||||
public status: number;
|
public status: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the HttpError class.
|
||||||
|
*
|
||||||
|
* @param message - The message given by the error.
|
||||||
|
* @param status - The status code given by the error.
|
||||||
|
*/
|
||||||
constructor(message: string, status: number) {
|
constructor(message: string, status: number) {
|
||||||
super(message);
|
super(message);
|
||||||
this.status = status;
|
this.status = status;
|
||||||
@ -223,10 +270,25 @@ export class HttpError extends Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a hook for centralized exception handling.
|
||||||
|
*
|
||||||
|
* @extends ErrorHandler
|
||||||
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GlobalErrorHandler extends ErrorHandler {
|
export class GlobalErrorHandler extends ErrorHandler {
|
||||||
|
/**
|
||||||
|
* An array of sentence sections that denote warnings.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
private sentencesForWarningLogging: Array<string> = [];
|
private sentencesForWarningLogging: Array<string> = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of the Global Error Handler.
|
||||||
|
*
|
||||||
|
* @param loggingService - A service that provides logging capabilities.
|
||||||
|
* @param router - A service that provides navigation among views and URL manipulation capabilities.
|
||||||
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private loggingService: LoggingService,
|
private loggingService: LoggingService,
|
||||||
private router: Router
|
private router: Router
|
||||||
@ -234,6 +296,11 @@ export class GlobalErrorHandler extends ErrorHandler {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles different types of errors.
|
||||||
|
*
|
||||||
|
* @param error - An error objects thrown when a runtime errors occurs.
|
||||||
|
*/
|
||||||
handleError(error: Error): void {
|
handleError(error: Error): void {
|
||||||
this.logError(error);
|
this.logError(error);
|
||||||
const message: string = error.message ? error.message : error.toString();
|
const message: string = error.message ? error.message : error.toString();
|
||||||
@ -254,24 +321,11 @@ export class GlobalErrorHandler extends ErrorHandler {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
logError(error: any): void {
|
|
||||||
const route: string = this.router.url;
|
|
||||||
if (error instanceof HttpErrorResponse) {
|
|
||||||
this.loggingService.sendErrorLevelMessage(
|
|
||||||
`There was an HTTP error on route ${route}.\n${error.message}.\nStatus code: ${(error as HttpErrorResponse).status}`,
|
|
||||||
this, {error});
|
|
||||||
} else if (error instanceof TypeError) {
|
|
||||||
this.loggingService.sendErrorLevelMessage(`There was a Type error on route ${route}.\n${error.message}`, this, {error});
|
|
||||||
} else if (error instanceof Error) {
|
|
||||||
this.loggingService.sendErrorLevelMessage(`There was a general error on route ${route}.\n${error.message}`, this, {error});
|
|
||||||
} else {
|
|
||||||
this.loggingService.sendErrorLevelMessage(`Nobody threw an error but something happened on route ${route}!`, this, {error});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if an error is of type warning.
|
||||||
*
|
*
|
||||||
* @param errorTraceString
|
* @param errorTraceString - A description of the error and it's stack trace.
|
||||||
|
* @returns true - If the error is of type warning.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
private isWarning(errorTraceString: string): boolean {
|
private isWarning(errorTraceString: string): boolean {
|
||||||
@ -288,6 +342,26 @@ export class GlobalErrorHandler extends ErrorHandler {
|
|||||||
|
|
||||||
return isWarning;
|
return isWarning;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write appropriate logs according to the type of error.
|
||||||
|
*
|
||||||
|
* @param error - An error objects thrown when a runtime errors occurs.
|
||||||
|
*/
|
||||||
|
logError(error: any): void {
|
||||||
|
const route: string = this.router.url;
|
||||||
|
if (error instanceof HttpErrorResponse) {
|
||||||
|
this.loggingService.sendErrorLevelMessage(
|
||||||
|
`There was an HTTP error on route ${route}.\n${error.message}.\nStatus code: ${(error as HttpErrorResponse).status}`,
|
||||||
|
this, {error});
|
||||||
|
} else if (error instanceof TypeError) {
|
||||||
|
this.loggingService.sendErrorLevelMessage(`There was a Type error on route ${route}.\n${error.message}`, this, {error});
|
||||||
|
} else if (error instanceof Error) {
|
||||||
|
this.loggingService.sendErrorLevelMessage(`There was a general error on route ${route}.\n${error.message}`, this, {error});
|
||||||
|
} else {
|
||||||
|
this.loggingService.sendErrorLevelMessage(`Nobody threw an error but something happened on route ${route}!`, this, {error});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</code></pre>
|
</code></pre>
|
||||||
</div>
|
</div>
|
||||||
|
@ -160,292 +160,280 @@
|
|||||||
<span class="coverage-count">(3/3)</span>
|
<span class="coverage-count">(3/3)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href=".//functions.html#arraySum">src/app/_helpers/array-sum.ts</a>
|
<a href=".//functions.html#arraySum">src/app/_helpers/array-sum.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>function</td>
|
<td>function</td>
|
||||||
<td>arraySum</td>
|
<td>arraySum</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/1)</span>
|
<span class="coverage-count">(1/1)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href=".//functions.html#copyToClipboard">src/app/_helpers/clipboard-copy.ts</a>
|
<a href=".//functions.html#copyToClipboard">src/app/_helpers/clipboard-copy.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>function</td>
|
<td>function</td>
|
||||||
<td>copyToClipboard</td>
|
<td>copyToClipboard</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/1)</span>
|
<span class="coverage-count">(1/1)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href="./classes/CustomErrorStateMatcher.html">src/app/_helpers/custom-error-state-matcher.ts</a>
|
<a href="./classes/CustomErrorStateMatcher.html">src/app/_helpers/custom-error-state-matcher.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>class</td>
|
<td>class</td>
|
||||||
<td>CustomErrorStateMatcher</td>
|
<td>CustomErrorStateMatcher</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/2)</span>
|
<span class="coverage-count">(2/2)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href="./classes/CustomValidator.html">src/app/_helpers/custom.validator.ts</a>
|
<a href="./classes/CustomValidator.html">src/app/_helpers/custom.validator.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>class</td>
|
<td>class</td>
|
||||||
<td>CustomValidator</td>
|
<td>CustomValidator</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/3)</span>
|
<span class="coverage-count">(3/3)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href=".//functions.html#exportCsv">src/app/_helpers/export-csv.ts</a>
|
<a href=".//functions.html#exportCsv">src/app/_helpers/export-csv.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>function</td>
|
<td>function</td>
|
||||||
<td>exportCsv</td>
|
<td>exportCsv</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/1)</span>
|
<span class="coverage-count">(1/1)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
|
||||||
<!-- miscellaneous -->
|
|
||||||
<a href=".//functions.html#removeSpecialChar">src/app/_helpers/export-csv.ts</a>
|
|
||||||
</td>
|
|
||||||
<td>function</td>
|
|
||||||
<td>removeSpecialChar</td>
|
|
||||||
<td align="right" data-sort="0">
|
|
||||||
<span class="coverage-percent">0 %</span>
|
|
||||||
<span class="coverage-count">(0/1)</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="low">
|
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href="./classes/HttpError.html">src/app/_helpers/global-error-handler.ts</a>
|
<a href="./classes/HttpError.html">src/app/_helpers/global-error-handler.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>class</td>
|
<td>class</td>
|
||||||
<td>HttpError</td>
|
<td>HttpError</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/3)</span>
|
<span class="coverage-count">(3/3)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href="./injectables/GlobalErrorHandler.html">src/app/_helpers/global-error-handler.ts</a>
|
<a href="./injectables/GlobalErrorHandler.html">src/app/_helpers/global-error-handler.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>injectable</td>
|
<td>injectable</td>
|
||||||
<td>GlobalErrorHandler</td>
|
<td>GlobalErrorHandler</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/6)</span>
|
<span class="coverage-count">(6/6)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href=".//functions.html#HttpGetter">src/app/_helpers/http-getter.ts</a>
|
<a href=".//functions.html#HttpGetter">src/app/_helpers/http-getter.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>function</td>
|
<td>function</td>
|
||||||
<td>HttpGetter</td>
|
<td>HttpGetter</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/1)</span>
|
<span class="coverage-count">(1/1)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href="./interceptors/MockBackendInterceptor.html">src/app/_helpers/mock-backend.ts</a>
|
<a href="./interceptors/MockBackendInterceptor.html">src/app/_helpers/mock-backend.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>interceptor</td>
|
<td>interceptor</td>
|
||||||
<td>MockBackendInterceptor</td>
|
<td>MockBackendInterceptor</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/2)</span>
|
<span class="coverage-count">(2/2)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href="./miscellaneous/variables.html#accountTypes">src/app/_helpers/mock-backend.ts</a>
|
<a href="./miscellaneous/variables.html#accountTypes">src/app/_helpers/mock-backend.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>variable</td>
|
<td>variable</td>
|
||||||
<td>accountTypes</td>
|
<td>accountTypes</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/1)</span>
|
<span class="coverage-count">(1/1)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href="./miscellaneous/variables.html#actions">src/app/_helpers/mock-backend.ts</a>
|
<a href="./miscellaneous/variables.html#actions">src/app/_helpers/mock-backend.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>variable</td>
|
<td>variable</td>
|
||||||
<td>actions</td>
|
<td>actions</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/1)</span>
|
<span class="coverage-count">(1/1)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href="./miscellaneous/variables.html#areaNames">src/app/_helpers/mock-backend.ts</a>
|
<a href="./miscellaneous/variables.html#areaNames">src/app/_helpers/mock-backend.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>variable</td>
|
<td>variable</td>
|
||||||
<td>areaNames</td>
|
<td>areaNames</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/1)</span>
|
<span class="coverage-count">(1/1)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href="./miscellaneous/variables.html#areaTypes">src/app/_helpers/mock-backend.ts</a>
|
<a href="./miscellaneous/variables.html#areaTypes">src/app/_helpers/mock-backend.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>variable</td>
|
<td>variable</td>
|
||||||
<td>areaTypes</td>
|
<td>areaTypes</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/1)</span>
|
<span class="coverage-count">(1/1)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href="./miscellaneous/variables.html#categories">src/app/_helpers/mock-backend.ts</a>
|
<a href="./miscellaneous/variables.html#categories">src/app/_helpers/mock-backend.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>variable</td>
|
<td>variable</td>
|
||||||
<td>categories</td>
|
<td>categories</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/1)</span>
|
<span class="coverage-count">(1/1)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href="./miscellaneous/variables.html#genders">src/app/_helpers/mock-backend.ts</a>
|
<a href="./miscellaneous/variables.html#genders">src/app/_helpers/mock-backend.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>variable</td>
|
<td>variable</td>
|
||||||
<td>genders</td>
|
<td>genders</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/1)</span>
|
<span class="coverage-count">(1/1)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href="./miscellaneous/variables.html#MockBackendProvider">src/app/_helpers/mock-backend.ts</a>
|
<a href="./miscellaneous/variables.html#MockBackendProvider">src/app/_helpers/mock-backend.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>variable</td>
|
<td>variable</td>
|
||||||
<td>MockBackendProvider</td>
|
<td>MockBackendProvider</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/1)</span>
|
<span class="coverage-count">(1/1)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href="./miscellaneous/variables.html#tokens">src/app/_helpers/mock-backend.ts</a>
|
<a href="./miscellaneous/variables.html#tokens">src/app/_helpers/mock-backend.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>variable</td>
|
<td>variable</td>
|
||||||
<td>tokens</td>
|
<td>tokens</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/1)</span>
|
<span class="coverage-count">(1/1)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href="./miscellaneous/variables.html#transactionTypes">src/app/_helpers/mock-backend.ts</a>
|
<a href="./miscellaneous/variables.html#transactionTypes">src/app/_helpers/mock-backend.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>variable</td>
|
<td>variable</td>
|
||||||
<td>transactionTypes</td>
|
<td>transactionTypes</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/1)</span>
|
<span class="coverage-count">(1/1)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href=".//functions.html#parseData">src/app/_helpers/read-csv.ts</a>
|
<a href=".//functions.html#parseData">src/app/_helpers/read-csv.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>function</td>
|
<td>function</td>
|
||||||
<td>parseData</td>
|
<td>parseData</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/1)</span>
|
<span class="coverage-count">(1/1)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href=".//functions.html#readCsv">src/app/_helpers/read-csv.ts</a>
|
<a href=".//functions.html#readCsv">src/app/_helpers/read-csv.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>function</td>
|
<td>function</td>
|
||||||
<td>readCsv</td>
|
<td>readCsv</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/1)</span>
|
<span class="coverage-count">(1/1)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href="./miscellaneous/variables.html#objCsv">src/app/_helpers/read-csv.ts</a>
|
<a href="./miscellaneous/variables.html#objCsv">src/app/_helpers/read-csv.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>variable</td>
|
<td>variable</td>
|
||||||
<td>objCsv</td>
|
<td>objCsv</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/1)</span>
|
<span class="coverage-count">(1/1)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href=".//functions.html#personValidation">src/app/_helpers/schema-validation.ts</a>
|
<a href=".//functions.html#personValidation">src/app/_helpers/schema-validation.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>function</td>
|
<td>function</td>
|
||||||
<td>personValidation</td>
|
<td>personValidation</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/1)</span>
|
<span class="coverage-count">(1/1)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="very-good">
|
||||||
<td>
|
<td>
|
||||||
<!-- miscellaneous -->
|
<!-- miscellaneous -->
|
||||||
<a href=".//functions.html#vcardValidation">src/app/_helpers/schema-validation.ts</a>
|
<a href=".//functions.html#vcardValidation">src/app/_helpers/schema-validation.ts</a>
|
||||||
</td>
|
</td>
|
||||||
<td>function</td>
|
<td>function</td>
|
||||||
<td>vcardValidation</td>
|
<td>vcardValidation</td>
|
||||||
<td align="right" data-sort="0">
|
<td align="right" data-sort="100">
|
||||||
<span class="coverage-percent">0 %</span>
|
<span class="coverage-percent">100 %</span>
|
||||||
<span class="coverage-count">(0/1)</span>
|
<span class="coverage-count">(1/1)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="low">
|
<tr class="low">
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<svg width="135" height="20" xmlns="http://www.w3.org/2000/svg">
|
<svg width="135" height="20" xmlns="http://www.w3.org/2000/svg">
|
||||||
<g>
|
<g>
|
||||||
<rect id="svg_1" height="20" width="130" y="0" x="0" stroke-width="1.5" stroke="#5d5d5d" fill="#5d5d5d" rx="7" ry="7"/>
|
<rect id="svg_1" height="20" width="130" y="0" x="0" stroke-width="1.5" stroke="#5d5d5d" fill="#5d5d5d" rx="7" ry="7"/>
|
||||||
<rect id="svg_2" height="20" width="40" y="0" x="92" stroke-width="1.5" stroke="#d8604b" fill="#d8604b" rx="7" ry="7"/>
|
<rect id="svg_2" height="20" width="40" y="0" x="92" stroke-width="1.5" stroke="#dab226" fill="#dab226" rx="7" ry="7"/>
|
||||||
<rect id="svg_3" height="20" width="22" y="0" x="92" stroke-width="1.5" stroke="#d8604b" fill="#d8604b"/>
|
<rect id="svg_3" height="20" width="22" y="0" x="92" stroke-width="1.5" stroke="#dab226" fill="#dab226"/>
|
||||||
<text xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="12" id="svg_4" y="14" x="6" stroke-width="0" stroke="#5d5d5d" fill="#ffffff">documentation</text>
|
<text xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="12" id="svg_4" y="14" x="6" stroke-width="0" stroke="#5d5d5d" fill="#ffffff">documentation</text>
|
||||||
<text xml:space="preserve" text-anchor="middle" font-family="Helvetica, Arial, sans-serif" font-size="12" id="svg_5" y="14" x="112" stroke-width="0" stroke="#5d5d5d" fill="#ffffff" style="text-anchor: middle">8%</text>
|
<text xml:space="preserve" text-anchor="middle" font-family="Helvetica, Arial, sans-serif" font-size="12" id="svg_5" y="14" x="112" stroke-width="0" stroke="#5d5d5d" fill="#ffffff" style="text-anchor: middle">30%</text>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 893 B After Width: | Height: | Size: 894 B |
@ -59,6 +59,13 @@
|
|||||||
<code>src/app/_helpers/global-error-handler.ts</code>
|
<code>src/app/_helpers/global-error-handler.ts</code>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p class="comment">
|
||||||
|
<h3>Description</h3>
|
||||||
|
</p>
|
||||||
|
<p class="comment">
|
||||||
|
<p>Provides a hook for centralized exception handling.</p>
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
<p class="comment">
|
<p class="comment">
|
||||||
<h3>Extends</h3>
|
<h3>Extends</h3>
|
||||||
@ -67,6 +74,11 @@
|
|||||||
<code><a href="https://angular.io/api/core/ErrorHandler" target="_blank" >ErrorHandler</a></code>
|
<code><a href="https://angular.io/api/core/ErrorHandler" target="_blank" >ErrorHandler</a></code>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p class="comment">
|
||||||
|
<h3>Example</h3>
|
||||||
|
</p>
|
||||||
|
<div class="io-description">
|
||||||
|
</div>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h3 id="index">Index</h3>
|
<h3 id="index">Index</h3>
|
||||||
@ -129,12 +141,14 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
<div class="io-line">Defined in <a href="" data-line="18" class="link-to-prism">src/app/_helpers/global-error-handler.ts:18</a></div>
|
<div class="io-line">Defined in <a href="" data-line="42" class="link-to-prism">src/app/_helpers/global-error-handler.ts:42</a></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>Initialization of the Global Error Handler.</p>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<b>Parameters :</b>
|
<b>Parameters :</b>
|
||||||
<table class="params">
|
<table class="params">
|
||||||
@ -143,6 +157,7 @@
|
|||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
<td>Type</td>
|
<td>Type</td>
|
||||||
<td>Optional</td>
|
<td>Optional</td>
|
||||||
|
<td>Description</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -157,6 +172,12 @@
|
|||||||
No
|
No
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<code><ul>
|
||||||
|
<li>A service that provides logging capabilities.</li>
|
||||||
|
</ul>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>router</td>
|
<td>router</td>
|
||||||
@ -169,6 +190,12 @@
|
|||||||
No
|
No
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<code><ul>
|
||||||
|
<li>A service that provides navigation among views and URL manipulation capabilities.</li>
|
||||||
|
</ul>
|
||||||
|
</code>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -206,14 +233,16 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
<div class="io-line">Defined in <a href="" data-line="27"
|
<div class="io-line">Defined in <a href="" data-line="62"
|
||||||
class="link-to-prism">src/app/_helpers/global-error-handler.ts:27</a></div>
|
class="link-to-prism">src/app/_helpers/global-error-handler.ts:62</a></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>Handles different types of errors.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
<b>Parameters :</b>
|
<b>Parameters :</b>
|
||||||
@ -223,6 +252,7 @@
|
|||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
<td>Type</td>
|
<td>Type</td>
|
||||||
<td>Optional</td>
|
<td>Optional</td>
|
||||||
|
<td>Description</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -237,6 +267,12 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>An error objects thrown when a runtime errors occurs.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -278,14 +314,16 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
<div class="io-line">Defined in <a href="" data-line="67"
|
<div class="io-line">Defined in <a href="" data-line="89"
|
||||||
class="link-to-prism">src/app/_helpers/global-error-handler.ts:67</a></div>
|
class="link-to-prism">src/app/_helpers/global-error-handler.ts:89</a></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>Checks if an error is of type warning.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
<b>Parameters :</b>
|
<b>Parameters :</b>
|
||||||
@ -295,6 +333,7 @@
|
|||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
<td>Type</td>
|
<td>Type</td>
|
||||||
<td>Optional</td>
|
<td>Optional</td>
|
||||||
|
<td>Description</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -309,6 +348,12 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>A description of the error and it's stack trace.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -320,6 +365,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
|
<p>true - If the error is of type warning.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -348,14 +394,16 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
<div class="io-line">Defined in <a href="" data-line="47"
|
<div class="io-line">Defined in <a href="" data-line="109"
|
||||||
class="link-to-prism">src/app/_helpers/global-error-handler.ts:47</a></div>
|
class="link-to-prism">src/app/_helpers/global-error-handler.ts:109</a></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>Write appropriate logs according to the type of error.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
<b>Parameters :</b>
|
<b>Parameters :</b>
|
||||||
@ -365,6 +413,7 @@
|
|||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
<td>Type</td>
|
<td>Type</td>
|
||||||
<td>Optional</td>
|
<td>Optional</td>
|
||||||
|
<td>Description</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -379,6 +428,12 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>An error objects thrown when a runtime errors occurs.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -428,10 +483,16 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
<div class="io-line">Defined in <a href="" data-line="18" class="link-to-prism">src/app/_helpers/global-error-handler.ts:18</a></div>
|
<div class="io-line">Defined in <a href="" data-line="42" class="link-to-prism">src/app/_helpers/global-error-handler.ts:42</a></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>An array of sentence sections that denote warnings.</p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -441,14 +502,28 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {ErrorHandler, Injectable} from '@angular/core';
|
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {HttpErrorResponse} from '@angular/common/http';
|
||||||
import {LoggingService} from '@app/_services/logging.service';
|
import {ErrorHandler, Injectable} from '@angular/core';
|
||||||
import {HttpErrorResponse} from '@angular/common/http';
|
|
||||||
import {Router} from '@angular/router';
|
import {Router} from '@angular/router';
|
||||||
|
|
||||||
// A generalized http response error
|
// Application imports
|
||||||
|
import {LoggingService} from '@app/_services/logging.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A generalized http response error.
|
||||||
|
*
|
||||||
|
* @extends Error
|
||||||
|
*/
|
||||||
export class HttpError extends Error {
|
export class HttpError extends Error {
|
||||||
|
/** The error's status code. */
|
||||||
public status: number;
|
public status: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the HttpError class.
|
||||||
|
*
|
||||||
|
* @param message - The message given by the error.
|
||||||
|
* @param status - The status code given by the error.
|
||||||
|
*/
|
||||||
constructor(message: string, status: number) {
|
constructor(message: string, status: number) {
|
||||||
super(message);
|
super(message);
|
||||||
this.status = status;
|
this.status = status;
|
||||||
@ -456,10 +531,25 @@ export class HttpError extends Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a hook for centralized exception handling.
|
||||||
|
*
|
||||||
|
* @extends ErrorHandler
|
||||||
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GlobalErrorHandler extends ErrorHandler {
|
export class GlobalErrorHandler extends ErrorHandler {
|
||||||
|
/**
|
||||||
|
* An array of sentence sections that denote warnings.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
private sentencesForWarningLogging: Array<string> = [];
|
private sentencesForWarningLogging: Array<string> = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of the Global Error Handler.
|
||||||
|
*
|
||||||
|
* @param loggingService - A service that provides logging capabilities.
|
||||||
|
* @param router - A service that provides navigation among views and URL manipulation capabilities.
|
||||||
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private loggingService: LoggingService,
|
private loggingService: LoggingService,
|
||||||
private router: Router
|
private router: Router
|
||||||
@ -467,6 +557,11 @@ export class GlobalErrorHandler extends ErrorHandler {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles different types of errors.
|
||||||
|
*
|
||||||
|
* @param error - An error objects thrown when a runtime errors occurs.
|
||||||
|
*/
|
||||||
handleError(error: Error): void {
|
handleError(error: Error): void {
|
||||||
this.logError(error);
|
this.logError(error);
|
||||||
const message: string = error.message ? error.message : error.toString();
|
const message: string = error.message ? error.message : error.toString();
|
||||||
@ -487,24 +582,11 @@ export class GlobalErrorHandler extends ErrorHandler {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
logError(error: any): void {
|
|
||||||
const route: string = this.router.url;
|
|
||||||
if (error instanceof HttpErrorResponse) {
|
|
||||||
this.loggingService.sendErrorLevelMessage(
|
|
||||||
`There was an HTTP error on route ${route}.\n${error.message}.\nStatus code: ${(error as HttpErrorResponse).status}`,
|
|
||||||
this, {error});
|
|
||||||
} else if (error instanceof TypeError) {
|
|
||||||
this.loggingService.sendErrorLevelMessage(`There was a Type error on route ${route}.\n${error.message}`, this, {error});
|
|
||||||
} else if (error instanceof Error) {
|
|
||||||
this.loggingService.sendErrorLevelMessage(`There was a general error on route ${route}.\n${error.message}`, this, {error});
|
|
||||||
} else {
|
|
||||||
this.loggingService.sendErrorLevelMessage(`Nobody threw an error but something happened on route ${route}!`, this, {error});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Checks if an error is of type warning.
|
||||||
*
|
*
|
||||||
* @param errorTraceString
|
* @param errorTraceString - A description of the error and it's stack trace.
|
||||||
|
* @returns true - If the error is of type warning.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
private isWarning(errorTraceString: string): boolean {
|
private isWarning(errorTraceString: string): boolean {
|
||||||
@ -521,6 +603,26 @@ export class GlobalErrorHandler extends ErrorHandler {
|
|||||||
|
|
||||||
return isWarning;
|
return isWarning;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write appropriate logs according to the type of error.
|
||||||
|
*
|
||||||
|
* @param error - An error objects thrown when a runtime errors occurs.
|
||||||
|
*/
|
||||||
|
logError(error: any): void {
|
||||||
|
const route: string = this.router.url;
|
||||||
|
if (error instanceof HttpErrorResponse) {
|
||||||
|
this.loggingService.sendErrorLevelMessage(
|
||||||
|
`There was an HTTP error on route ${route}.\n${error.message}.\nStatus code: ${(error as HttpErrorResponse).status}`,
|
||||||
|
this, {error});
|
||||||
|
} else if (error instanceof TypeError) {
|
||||||
|
this.loggingService.sendErrorLevelMessage(`There was a Type error on route ${route}.\n${error.message}`, this, {error});
|
||||||
|
} else if (error instanceof Error) {
|
||||||
|
this.loggingService.sendErrorLevelMessage(`There was a general error on route ${route}.\n${error.message}`, this, {error});
|
||||||
|
} else {
|
||||||
|
this.loggingService.sendErrorLevelMessage(`Nobody threw an error but something happened on route ${route}!`, this, {error});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</code></pre>
|
</code></pre>
|
||||||
</div>
|
</div>
|
||||||
|
@ -60,7 +60,20 @@
|
|||||||
<code>src/app/_helpers/mock-backend.ts</code>
|
<code>src/app/_helpers/mock-backend.ts</code>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p class="comment">
|
||||||
|
<h3>Description</h3>
|
||||||
|
</p>
|
||||||
|
<p class="comment">
|
||||||
|
<p>Intercepts HTTP requests and handles some specified requests internally.
|
||||||
|
Provides a backend that can handle requests for certain data items.</p>
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class="comment">
|
||||||
|
<h3>Example</h3>
|
||||||
|
</p>
|
||||||
|
<div class="io-description">
|
||||||
|
</div>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h3 id="index">Index</h3>
|
<h3 id="index">Index</h3>
|
||||||
@ -118,14 +131,16 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
<div class="io-line">Defined in <a href="" data-line="240"
|
<div class="io-line">Defined in <a href="" data-line="268"
|
||||||
class="link-to-prism">src/app/_helpers/mock-backend.ts:240</a></div>
|
class="link-to-prism">src/app/_helpers/mock-backend.ts:268</a></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>Intercepts HTTP requests.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
<b>Parameters :</b>
|
<b>Parameters :</b>
|
||||||
@ -135,6 +150,7 @@
|
|||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
<td>Type</td>
|
<td>Type</td>
|
||||||
<td>Optional</td>
|
<td>Optional</td>
|
||||||
|
<td>Description</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -149,6 +165,12 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>An outgoing HTTP request with an optional typed body.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>next</td>
|
<td>next</td>
|
||||||
@ -161,6 +183,12 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>The next HTTP handler or the outgoing request dispatcher.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -172,6 +200,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
|
<p>The response from the resolved request.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -186,10 +215,18 @@
|
|||||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {HTTP_INTERCEPTORS, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse} from '@angular/common/http';
|
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {HTTP_INTERCEPTORS, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse} from '@angular/common/http';
|
||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
|
|
||||||
|
// Third party imports
|
||||||
import {Observable, of, throwError} from 'rxjs';
|
import {Observable, of, throwError} from 'rxjs';
|
||||||
import {delay, dematerialize, materialize, mergeMap} from 'rxjs/operators';
|
import {delay, dematerialize, materialize, mergeMap} from 'rxjs/operators';
|
||||||
|
|
||||||
|
// Application imports
|
||||||
import {Action, AreaName, AreaType, Category, Token} from '@app/_models';
|
import {Action, AreaName, AreaType, Category, Token} from '@app/_models';
|
||||||
|
|
||||||
|
/** A mock of the curated account types. */
|
||||||
|
const accountTypes: Array<string> = ['user', 'cashier', 'vendor', 'tokenagent', 'group'];
|
||||||
|
|
||||||
|
/** A mock of actions made by the admin staff. */
|
||||||
const actions: Array<Action> = [
|
const actions: Array<Action> = [
|
||||||
{ id: 1, user: 'Tom', role: 'enroller', action: 'Disburse RSV 100', approval: false },
|
{ id: 1, user: 'Tom', role: 'enroller', action: 'Disburse RSV 100', approval: false },
|
||||||
{ id: 2, user: 'Christine', role: 'admin', action: 'Change user phone number', approval: true },
|
{ id: 2, user: 'Christine', role: 'admin', action: 'Change user phone number', approval: true },
|
||||||
@ -199,38 +236,93 @@ const actions: Array<Action> = [
|
|||||||
{ id: 6, user: 'Patience', role: 'enroller', action: 'Change user information', approval: false }
|
{ id: 6, user: 'Patience', role: 'enroller', action: 'Change user information', approval: false }
|
||||||
];
|
];
|
||||||
|
|
||||||
const tokens: Array<Token> = [
|
/** A mock of curated area names. */
|
||||||
|
const areaNames: Array<AreaName> = [
|
||||||
{
|
{
|
||||||
name: 'Giftable Reserve', symbol: 'GRZ', address: '0xa686005CE37Dce7738436256982C3903f2E4ea8E', supply: '1000000001000000000000000000',
|
name: 'Mukuru Nairobi',
|
||||||
decimals: '18', reserves: {}
|
locations: ['kayaba', 'kayba', 'kambi', 'mukuru', 'masai', 'hazina', 'south', 'tetra', 'tetrapak', 'ruben', 'rueben', 'kingston',
|
||||||
|
'korokocho', 'kingstone', 'kamongo', 'lungalunga', 'sinai', 'sigei', 'lungu', 'lunga lunga', 'owino road', 'seigei']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Demo Token', symbol: 'DEMO', address: '0xc80D6aFF8194114c52AEcD84c9f15fd5c8abb187', supply: '99999999999999998976',
|
name: 'Kinango Kwale',
|
||||||
decimals: '18', reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '99999999999999998976'}},
|
locations: ['amani', 'bofu', 'chibuga', 'chikomani', 'chilongoni', 'chigojoni', 'chinguluni', 'chigato', 'chigale', 'chikole',
|
||||||
reserveRatio: '1000000', owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
'chilongoni', 'chilumani', 'chigojoni', 'chikomani', 'chizini', 'chikomeni', 'chidzuvini', 'chidzivuni', 'chikuyu', 'chizingo',
|
||||||
|
'doti', 'dzugwe', 'dzivani', 'dzovuni', 'hanje', 'kasemeni', 'katundani', 'kibandaogo', 'kibandaongo', 'kwale', 'kinango',
|
||||||
|
'kidzuvini', 'kalalani', 'kafuduni', 'kaloleni', 'kilibole', 'lutsangani', 'peku', 'gona', 'guro', 'gandini', 'mkanyeni', 'myenzeni',
|
||||||
|
'miyenzeni', 'miatsiani', 'mienzeni', 'mnyenzeni', 'minyenzeni', 'miyani', 'mioleni', 'makuluni', 'mariakani', 'makobeni', 'madewani',
|
||||||
|
'mwangaraba', 'mwashanga', 'miloeni', 'mabesheni', 'mazeras', 'mazera', 'mlola', 'muugano', 'mulunguni', 'mabesheni', 'miatsani',
|
||||||
|
'miatsiani', 'mwache', 'mwangani', 'mwehavikonje', 'miguneni', 'nzora', 'nzovuni', 'vikinduni', 'vikolani', 'vitangani', 'viogato',
|
||||||
|
'vyogato', 'vistangani', 'yapha', 'yava', 'yowani', 'ziwani', 'majengo', 'matuga', 'vigungani', 'vidziweni', 'vinyunduni', 'ukunda',
|
||||||
|
'kokotoni', 'mikindani']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Foo Token', symbol: 'FOO', address: '0x9ceD86089f7aBB5A97B40eb0E7521e7aa308d354', supply: '1000000000000000001014',
|
name: 'Misc Nairobi',
|
||||||
decimals: '18', reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '1000000000000000001014'}},
|
locations: ['nairobi', 'west', 'lindi', 'kibera', 'kibira', 'kibra', 'makina', 'soweto', 'olympic', 'kangemi', 'ruiru', 'congo',
|
||||||
reserveRatio: '1000000', owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
'kawangware', 'kwangware', 'donholm', 'dagoreti', 'dandora', 'kabete', 'sinai', 'donhom', 'donholm', 'huruma', 'kitengela',
|
||||||
|
'makadara', ',mlolongo', 'kenyatta', 'mlolongo', 'tassia', 'tasia', 'gatina', '56', 'industrial', 'kariobangi', 'kasarani', 'kayole',
|
||||||
|
'mathare', 'pipe', 'juja', 'uchumi', 'jogoo', 'umoja', 'thika', 'kikuyu', 'stadium', 'buru buru', 'ngong', 'starehe', 'mwiki',
|
||||||
|
'fuata', 'kware', 'kabiro', 'embakassi', 'embakasi', 'kmoja', 'east', 'githurai', 'landi', 'langata', 'limuru', 'mathere',
|
||||||
|
'dagoretti', 'kirembe', 'muugano', 'mwiki', 'toi market']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'testb', symbol: 'tstb', address: '0xC63cFA91A3BFf41cE31Ff436f67D3ACBC977DB95', supply: '99000', decimals: '18',
|
name: 'Misc Mombasa',
|
||||||
reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '99000'}}, reserveRatio: '1000000',
|
locations: ['mombasa', 'likoni', 'bangla', 'bangladesh', 'kizingo', 'old town', 'makupa', 'mvita', 'ngombeni', 'ngómbeni', 'ombeni',
|
||||||
owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
'magongo', 'miritini', 'changamwe', 'jomvu', 'ohuru', 'tudor', 'diani']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'testa', symbol: 'tsta', address: '0x8fA4101ef19D0a078239d035659e92b278bD083C', supply: '9981', decimals: '18',
|
name: 'Kisauni',
|
||||||
reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '9981'}}, reserveRatio: '1000000',
|
locations: ['bamburi', 'kisauni', 'mworoni', 'nyali', 'shanzu', 'bombolulu', 'mtopanga', 'mjambere', 'majaoni', 'manyani', 'magogoni',
|
||||||
owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
'junda', 'mwakirunge', 'mshomoroni']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'testc', symbol: 'tstc', address: '0x4A6fA6bc3BfE4C9661bC692D9798425350C9e3D4', supply: '100990', decimals: '18',
|
name: 'Kilifi',
|
||||||
reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '100990'}}, reserveRatio: '1000000',
|
locations: ['kilfi', 'kilifi', 'mtwapa', 'takaungu', 'makongeni', 'mnarani', 'mnarani', 'office', 'g.e', 'ge', 'raibai', 'ribe']
|
||||||
owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
},
|
||||||
|
{
|
||||||
|
name: 'Kakuma',
|
||||||
|
locations: ['kakuma']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Kitui',
|
||||||
|
locations: ['kitui', 'mwingi']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Nyanza',
|
||||||
|
locations: ['busia', 'nyalgunga', 'mbita', 'siaya', 'kisumu', 'nyalenda', 'hawinga', 'rangala', 'uyoma', 'mumias', 'homabay', 'homaboy',
|
||||||
|
'migori', 'kusumu']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Misc Rural Counties',
|
||||||
|
locations: ['makueni', 'meru', 'kisii', 'bomet', 'machakos', 'bungoma', 'eldoret', 'kakamega', 'kericho', 'kajiado', 'nandi', 'nyeri',
|
||||||
|
'wote', 'kiambu', 'mwea', 'nakuru', 'narok']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'other',
|
||||||
|
locations: ['other', 'none', 'unknown']
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/** A mock of curated area types. */
|
||||||
|
const areaTypes: Array<AreaType> = [
|
||||||
|
{
|
||||||
|
name: 'urban',
|
||||||
|
area: ['urban', 'nairobi', 'mombasa']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'rural',
|
||||||
|
area: ['rural', 'kakuma', 'kwale', 'kinango', 'kitui', 'nyanza']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'periurban',
|
||||||
|
area: ['kilifi', 'periurban']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'other',
|
||||||
|
area: ['other']
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
/** A mock of the user's business categories */
|
||||||
const categories: Array<Category> = [
|
const categories: Array<Category> = [
|
||||||
{
|
{
|
||||||
name: 'system',
|
name: 'system',
|
||||||
@ -333,96 +425,60 @@ const categories: Array<Category> = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const areaNames: Array<AreaName> = [
|
/** A mock of curated genders */
|
||||||
{
|
|
||||||
name: 'Mukuru Nairobi',
|
|
||||||
locations: ['kayaba', 'kayba', 'kambi', 'mukuru', 'masai', 'hazina', 'south', 'tetra', 'tetrapak', 'ruben', 'rueben', 'kingston',
|
|
||||||
'korokocho', 'kingstone', 'kamongo', 'lungalunga', 'sinai', 'sigei', 'lungu', 'lunga lunga', 'owino road', 'seigei']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Kinango Kwale',
|
|
||||||
locations: ['amani', 'bofu', 'chibuga', 'chikomani', 'chilongoni', 'chigojoni', 'chinguluni', 'chigato', 'chigale', 'chikole',
|
|
||||||
'chilongoni', 'chilumani', 'chigojoni', 'chikomani', 'chizini', 'chikomeni', 'chidzuvini', 'chidzivuni', 'chikuyu', 'chizingo',
|
|
||||||
'doti', 'dzugwe', 'dzivani', 'dzovuni', 'hanje', 'kasemeni', 'katundani', 'kibandaogo', 'kibandaongo', 'kwale', 'kinango',
|
|
||||||
'kidzuvini', 'kalalani', 'kafuduni', 'kaloleni', 'kilibole', 'lutsangani', 'peku', 'gona', 'guro', 'gandini', 'mkanyeni', 'myenzeni',
|
|
||||||
'miyenzeni', 'miatsiani', 'mienzeni', 'mnyenzeni', 'minyenzeni', 'miyani', 'mioleni', 'makuluni', 'mariakani', 'makobeni', 'madewani',
|
|
||||||
'mwangaraba', 'mwashanga', 'miloeni', 'mabesheni', 'mazeras', 'mazera', 'mlola', 'muugano', 'mulunguni', 'mabesheni', 'miatsani',
|
|
||||||
'miatsiani', 'mwache', 'mwangani', 'mwehavikonje', 'miguneni', 'nzora', 'nzovuni', 'vikinduni', 'vikolani', 'vitangani', 'viogato',
|
|
||||||
'vyogato', 'vistangani', 'yapha', 'yava', 'yowani', 'ziwani', 'majengo', 'matuga', 'vigungani', 'vidziweni', 'vinyunduni', 'ukunda',
|
|
||||||
'kokotoni', 'mikindani']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Misc Nairobi',
|
|
||||||
locations: ['nairobi', 'west', 'lindi', 'kibera', 'kibira', 'kibra', 'makina', 'soweto', 'olympic', 'kangemi', 'ruiru', 'congo',
|
|
||||||
'kawangware', 'kwangware', 'donholm', 'dagoreti', 'dandora', 'kabete', 'sinai', 'donhom', 'donholm', 'huruma', 'kitengela',
|
|
||||||
'makadara', ',mlolongo', 'kenyatta', 'mlolongo', 'tassia', 'tasia', 'gatina', '56', 'industrial', 'kariobangi', 'kasarani', 'kayole',
|
|
||||||
'mathare', 'pipe', 'juja', 'uchumi', 'jogoo', 'umoja', 'thika', 'kikuyu', 'stadium', 'buru buru', 'ngong', 'starehe', 'mwiki',
|
|
||||||
'fuata', 'kware', 'kabiro', 'embakassi', 'embakasi', 'kmoja', 'east', 'githurai', 'landi', 'langata', 'limuru', 'mathere',
|
|
||||||
'dagoretti', 'kirembe', 'muugano', 'mwiki', 'toi market']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Misc Mombasa',
|
|
||||||
locations: ['mombasa', 'likoni', 'bangla', 'bangladesh', 'kizingo', 'old town', 'makupa', 'mvita', 'ngombeni', 'ngómbeni', 'ombeni',
|
|
||||||
'magongo', 'miritini', 'changamwe', 'jomvu', 'ohuru', 'tudor', 'diani']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Kisauni',
|
|
||||||
locations: ['bamburi', 'kisauni', 'mworoni', 'nyali', 'shanzu', 'bombolulu', 'mtopanga', 'mjambere', 'majaoni', 'manyani', 'magogoni',
|
|
||||||
'junda', 'mwakirunge', 'mshomoroni']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Kilifi',
|
|
||||||
locations: ['kilfi', 'kilifi', 'mtwapa', 'takaungu', 'makongeni', 'mnarani', 'mnarani', 'office', 'g.e', 'ge', 'raibai', 'ribe']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Kakuma',
|
|
||||||
locations: ['kakuma']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Kitui',
|
|
||||||
locations: ['kitui', 'mwingi']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Nyanza',
|
|
||||||
locations: ['busia', 'nyalgunga', 'mbita', 'siaya', 'kisumu', 'nyalenda', 'hawinga', 'rangala', 'uyoma', 'mumias', 'homabay', 'homaboy',
|
|
||||||
'migori', 'kusumu']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Misc Rural Counties',
|
|
||||||
locations: ['makueni', 'meru', 'kisii', 'bomet', 'machakos', 'bungoma', 'eldoret', 'kakamega', 'kericho', 'kajiado', 'nandi', 'nyeri',
|
|
||||||
'wote', 'kiambu', 'mwea', 'nakuru', 'narok']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'other',
|
|
||||||
locations: ['other', 'none', 'unknown']
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
const areaTypes: Array<AreaType> = [
|
|
||||||
{
|
|
||||||
name: 'urban',
|
|
||||||
area: ['urban', 'nairobi', 'mombasa']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'rural',
|
|
||||||
area: ['rural', 'kakuma', 'kwale', 'kinango', 'kitui', 'nyanza']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'periurban',
|
|
||||||
area: ['kilifi', 'periurban']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'other',
|
|
||||||
area: ['other']
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
const accountTypes: Array<string> = ['user', 'cashier', 'vendor', 'tokenagent', 'group'];
|
|
||||||
const transactionTypes: Array<string> = ['transactions', 'conversions', 'disbursements', 'rewards', 'reclamation'];
|
|
||||||
const genders: Array<string> = ['male', 'female', 'other'];
|
const genders: Array<string> = ['male', 'female', 'other'];
|
||||||
|
|
||||||
|
/** A mock of the tokens in the system. */
|
||||||
|
const tokens: Array<Token> = [
|
||||||
|
{
|
||||||
|
name: 'Giftable Reserve', symbol: 'GRZ', address: '0xa686005CE37Dce7738436256982C3903f2E4ea8E', supply: '1000000001000000000000000000',
|
||||||
|
decimals: '18', reserves: {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Demo Token', symbol: 'DEMO', address: '0xc80D6aFF8194114c52AEcD84c9f15fd5c8abb187', supply: '99999999999999998976',
|
||||||
|
decimals: '18', reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '99999999999999998976'}},
|
||||||
|
reserveRatio: '1000000', owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Foo Token', symbol: 'FOO', address: '0x9ceD86089f7aBB5A97B40eb0E7521e7aa308d354', supply: '1000000000000000001014',
|
||||||
|
decimals: '18', reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '1000000000000000001014'}},
|
||||||
|
reserveRatio: '1000000', owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'testb', symbol: 'tstb', address: '0xC63cFA91A3BFf41cE31Ff436f67D3ACBC977DB95', supply: '99000', decimals: '18',
|
||||||
|
reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '99000'}}, reserveRatio: '1000000',
|
||||||
|
owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'testa', symbol: 'tsta', address: '0x8fA4101ef19D0a078239d035659e92b278bD083C', supply: '9981', decimals: '18',
|
||||||
|
reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '9981'}}, reserveRatio: '1000000',
|
||||||
|
owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'testc', symbol: 'tstc', address: '0x4A6fA6bc3BfE4C9661bC692D9798425350C9e3D4', supply: '100990', decimals: '18',
|
||||||
|
reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '100990'}}, reserveRatio: '1000000',
|
||||||
|
owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
/** A mock of curated transaction types. */
|
||||||
|
const transactionTypes: Array<string> = ['transactions', 'conversions', 'disbursements', 'rewards', 'reclamation'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Intercepts HTTP requests and handles some specified requests internally.
|
||||||
|
* Provides a backend that can handle requests for certain data items.
|
||||||
|
*
|
||||||
|
* @implements HttpInterceptor
|
||||||
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MockBackendInterceptor implements HttpInterceptor {
|
export class MockBackendInterceptor implements HttpInterceptor {
|
||||||
|
/**
|
||||||
|
* Intercepts HTTP requests.
|
||||||
|
*
|
||||||
|
* @param request - An outgoing HTTP request with an optional typed body.
|
||||||
|
* @param next - The next HTTP handler or the outgoing request dispatcher.
|
||||||
|
* @returns The response from the resolved request.
|
||||||
|
*/
|
||||||
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
||||||
const { url, method, headers, body } = request;
|
const { url, method, headers, body } = request;
|
||||||
|
|
||||||
@ -434,22 +490,17 @@ export class MockBackendInterceptor implements HttpInterceptor {
|
|||||||
.pipe(delay(500))
|
.pipe(delay(500))
|
||||||
.pipe(dematerialize());
|
.pipe(dematerialize());
|
||||||
|
|
||||||
|
/** Forward requests from select routes to their internal handlers. */
|
||||||
function handleRoute(): Observable<any> {
|
function handleRoute(): Observable<any> {
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
case url.endsWith('/accounttypes') && method === 'GET':
|
||||||
|
return getAccountTypes();
|
||||||
case url.endsWith('/actions') && method === 'GET':
|
case url.endsWith('/actions') && method === 'GET':
|
||||||
return getActions();
|
return getActions();
|
||||||
case url.match(/\/actions\/\d+$/) && method === 'GET':
|
case url.match(/\/actions\/\d+$/) && method === 'GET':
|
||||||
return getActionById();
|
return getActionById();
|
||||||
case url.match(/\/actions\/\d+$/) && method === 'POST':
|
case url.match(/\/actions\/\d+$/) && method === 'POST':
|
||||||
return approveAction();
|
return approveAction();
|
||||||
case url.endsWith('/tokens') && method === 'GET':
|
|
||||||
return getTokens();
|
|
||||||
case url.match(/\/tokens\/\w+$/) && method === 'GET':
|
|
||||||
return getTokenBySymbol();
|
|
||||||
case url.endsWith('/categories') && method === 'GET':
|
|
||||||
return getCategories();
|
|
||||||
case url.match(/\/categories\/\w+$/) && method === 'GET':
|
|
||||||
return getCategoryByProduct();
|
|
||||||
case url.endsWith('/areanames') && method === 'GET':
|
case url.endsWith('/areanames') && method === 'GET':
|
||||||
return getAreaNames();
|
return getAreaNames();
|
||||||
case url.match(/\/areanames\/\w+$/) && method === 'GET':
|
case url.match(/\/areanames\/\w+$/) && method === 'GET':
|
||||||
@ -458,12 +509,18 @@ export class MockBackendInterceptor implements HttpInterceptor {
|
|||||||
return getAreaTypes();
|
return getAreaTypes();
|
||||||
case url.match(/\/areatypes\/\w+$/) && method === 'GET':
|
case url.match(/\/areatypes\/\w+$/) && method === 'GET':
|
||||||
return getAreaTypeByArea();
|
return getAreaTypeByArea();
|
||||||
case url.endsWith('/accounttypes') && method === 'GET':
|
case url.endsWith('/categories') && method === 'GET':
|
||||||
return getAccountTypes();
|
return getCategories();
|
||||||
case url.endsWith('/transactiontypes') && method === 'GET':
|
case url.match(/\/categories\/\w+$/) && method === 'GET':
|
||||||
return getTransactionTypes();
|
return getCategoryByProduct();
|
||||||
case url.endsWith('/genders') && method === 'GET':
|
case url.endsWith('/genders') && method === 'GET':
|
||||||
return getGenders();
|
return getGenders();
|
||||||
|
case url.endsWith('/tokens') && method === 'GET':
|
||||||
|
return getTokens();
|
||||||
|
case url.match(/\/tokens\/\w+$/) && method === 'GET':
|
||||||
|
return getTokenBySymbol();
|
||||||
|
case url.endsWith('/transactiontypes') && method === 'GET':
|
||||||
|
return getTransactionTypes();
|
||||||
default:
|
default:
|
||||||
// pass through any requests not handled above
|
// pass through any requests not handled above
|
||||||
return next.handle(request);
|
return next.handle(request);
|
||||||
@ -472,15 +529,6 @@ export class MockBackendInterceptor implements HttpInterceptor {
|
|||||||
|
|
||||||
// route functions
|
// route functions
|
||||||
|
|
||||||
function getActions(): Observable<HttpResponse<any>> {
|
|
||||||
return ok(actions);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getActionById(): Observable<HttpResponse<any>> {
|
|
||||||
const queriedAction: Action = actions.find(action => action.id === idFromUrl());
|
|
||||||
return ok(queriedAction);
|
|
||||||
}
|
|
||||||
|
|
||||||
function approveAction(): Observable<HttpResponse<any>> {
|
function approveAction(): Observable<HttpResponse<any>> {
|
||||||
const queriedAction: Action = actions.find(action => action.id === idFromUrl());
|
const queriedAction: Action = actions.find(action => action.id === idFromUrl());
|
||||||
queriedAction.approval = body.approval;
|
queriedAction.approval = body.approval;
|
||||||
@ -488,23 +536,17 @@ export class MockBackendInterceptor implements HttpInterceptor {
|
|||||||
return ok(message);
|
return ok(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTokens(): Observable<HttpResponse<any>> {
|
function getAccountTypes(): Observable<HttpResponse<any>> {
|
||||||
return ok(tokens);
|
return ok(accountTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTokenBySymbol(): Observable<HttpResponse<any>> {
|
function getActions(): Observable<HttpResponse<any>> {
|
||||||
const queriedToken: Token = tokens.find(token => token.symbol === stringFromUrl());
|
return ok(actions);
|
||||||
return ok(queriedToken);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCategories(): Observable<HttpResponse<any>> {
|
function getActionById(): Observable<HttpResponse<any>> {
|
||||||
const categoryList: Array<string> = categories.map(category => category.name);
|
const queriedAction: Action = actions.find(action => action.id === idFromUrl());
|
||||||
return ok(categoryList);
|
return ok(queriedAction);
|
||||||
}
|
|
||||||
|
|
||||||
function getCategoryByProduct(): Observable<HttpResponse<any>> {
|
|
||||||
const queriedCategory: Category = categories.find(category => category.products.includes(stringFromUrl()));
|
|
||||||
return ok(queriedCategory.name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAreaNames(): Observable<HttpResponse<any>> {
|
function getAreaNames(): Observable<HttpResponse<any>> {
|
||||||
@ -527,24 +569,35 @@ export class MockBackendInterceptor implements HttpInterceptor {
|
|||||||
return ok(queriedAreaType.name);
|
return ok(queriedAreaType.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAccountTypes(): Observable<HttpResponse<any>> {
|
function getCategories(): Observable<HttpResponse<any>> {
|
||||||
return ok(accountTypes);
|
const categoryList: Array<string> = categories.map(category => category.name);
|
||||||
|
return ok(categoryList);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTransactionTypes(): Observable<HttpResponse<any>> {
|
function getCategoryByProduct(): Observable<HttpResponse<any>> {
|
||||||
return ok(transactionTypes);
|
const queriedCategory: Category = categories.find(category => category.products.includes(stringFromUrl()));
|
||||||
|
return ok(queriedCategory.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGenders(): Observable<HttpResponse<any>> {
|
function getGenders(): Observable<HttpResponse<any>> {
|
||||||
return ok(genders);
|
return ok(genders);
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper functions
|
function getTokens(): Observable<HttpResponse<any>> {
|
||||||
|
return ok(tokens);
|
||||||
function ok(responseBody: any): Observable<HttpResponse<any>> {
|
|
||||||
return of(new HttpResponse({ status: 200, body: responseBody }));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTokenBySymbol(): Observable<HttpResponse<any>> {
|
||||||
|
const queriedToken: Token = tokens.find(token => token.symbol === stringFromUrl());
|
||||||
|
return ok(queriedToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTransactionTypes(): Observable<HttpResponse<any>> {
|
||||||
|
return ok(transactionTypes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// helper functions
|
||||||
|
|
||||||
function error(message): Observable<any> {
|
function error(message): Observable<any> {
|
||||||
return throwError({ status: 400, error: { message } });
|
return throwError({ status: 400, error: { message } });
|
||||||
}
|
}
|
||||||
@ -554,6 +607,10 @@ export class MockBackendInterceptor implements HttpInterceptor {
|
|||||||
return parseInt(urlParts[urlParts.length - 1], 10);
|
return parseInt(urlParts[urlParts.length - 1], 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ok(responseBody: any): Observable<HttpResponse<any>> {
|
||||||
|
return of(new HttpResponse({ status: 200, body: responseBody }));
|
||||||
|
}
|
||||||
|
|
||||||
function stringFromUrl(): string {
|
function stringFromUrl(): string {
|
||||||
const urlParts: Array<string> = url.split('/');
|
const urlParts: Array<string> = url.split('/');
|
||||||
return urlParts[urlParts.length - 1];
|
return urlParts[urlParts.length - 1];
|
||||||
@ -561,6 +618,11 @@ export class MockBackendInterceptor implements HttpInterceptor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exports the MockBackendInterceptor as an Angular provider.
|
||||||
|
*
|
||||||
|
* @exports
|
||||||
|
*/
|
||||||
export const MockBackendProvider = {
|
export const MockBackendProvider = {
|
||||||
provide: HTTP_INTERCEPTORS,
|
provide: HTTP_INTERCEPTORS,
|
||||||
useClass: MockBackendInterceptor,
|
useClass: MockBackendInterceptor,
|
||||||
|
File diff suppressed because one or more lines are too long
@ -78,9 +78,6 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="#readCsv" title="src/app/_helpers/read-csv.ts"><b>readCsv</b> (src/.../read-csv.ts)</a>
|
<a href="#readCsv" title="src/app/_helpers/read-csv.ts"><b>readCsv</b> (src/.../read-csv.ts)</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<a href="#removeSpecialChar" title="src/app/_helpers/export-csv.ts"><b>removeSpecialChar</b> (src/.../export-csv.ts)</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href="#vcardValidation" title="src/app/_helpers/schema-validation.ts"><b>vcardValidation</b> (src/.../schema-validation.ts)</a>
|
<a href="#vcardValidation" title="src/app/_helpers/schema-validation.ts"><b>vcardValidation</b> (src/.../schema-validation.ts)</a>
|
||||||
</li>
|
</li>
|
||||||
@ -117,6 +114,8 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>Returns the sum of all values in an array.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
<b>Parameters :</b>
|
<b>Parameters :</b>
|
||||||
@ -125,6 +124,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
<td>Optional</td>
|
<td>Optional</td>
|
||||||
|
<td>Description</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -136,17 +136,33 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>An array of numbers.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
<b>Example :</b>
|
||||||
|
<div>
|
||||||
|
<pre class="line-numbers"><code class="language-html">Prints 6 for the array [1, 2, 3]:</p>
|
||||||
|
<p>```typescript</p>
|
||||||
|
<ul>
|
||||||
|
<li>console.log(arraySum([1, 2, 3]));</li>
|
||||||
|
<li>```</li>
|
||||||
|
</ul></code></pre>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
<b>Returns : </b> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
|
<b>Returns : </b> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
|
<p>The sum of all values in the array.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -179,6 +195,8 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>Copies set text to clipboard.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
<b>Parameters :</b>
|
<b>Parameters :</b>
|
||||||
@ -188,6 +206,7 @@
|
|||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
<td>Type</td>
|
<td>Type</td>
|
||||||
<td>Optional</td>
|
<td>Optional</td>
|
||||||
|
<td>Description</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -202,17 +221,33 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>The text to be copied to the clipboard.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
<b>Example :</b>
|
||||||
|
<div>
|
||||||
|
<pre class="line-numbers"><code class="language-html">copies &#39;Hello World!&#39; to the clipboard and prints &quot;true&quot;:</p>
|
||||||
|
<p>```typescript</p>
|
||||||
|
<ul>
|
||||||
|
<li>console.log(copyToClipboard(&#39;Hello World!&#39;));</li>
|
||||||
|
<li>```</li>
|
||||||
|
</ul></code></pre>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
<b>Returns : </b> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code>
|
<b>Returns : </b> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
|
<p>true - If the copy operation is successful.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -245,6 +280,8 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>Exports data to a CSV format and provides a download file.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
<b>Parameters :</b>
|
<b>Parameters :</b>
|
||||||
@ -253,6 +290,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
<td>Optional</td>
|
<td>Optional</td>
|
||||||
|
<td>Description</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -264,6 +302,12 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>An array of data to be converted to CSV format.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>filename</td>
|
<td>filename</td>
|
||||||
@ -273,6 +317,12 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>The name of the file to be downloaded.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>delimiter</td>
|
<td>delimiter</td>
|
||||||
@ -282,6 +332,13 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>The delimiter to be used when converting to CSV format.
|
||||||
|
Defaults to commas.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -294,66 +351,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<table class="table table-sm table-bordered">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td class="col-md-4">
|
|
||||||
<a name="removeSpecialChar"></a>
|
|
||||||
<span class="name">
|
|
||||||
<b>
|
|
||||||
removeSpecialChar
|
|
||||||
</b>
|
|
||||||
<a href="#removeSpecialChar"><span class="icon ion-ios-link"></span></a>
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="col-md-4">
|
|
||||||
<code>removeSpecialChar(str)</code>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td class="col-md-4">
|
|
||||||
|
|
||||||
<div class="io-description">
|
|
||||||
<b>Parameters :</b>
|
|
||||||
<table class="params">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td>Name</td>
|
|
||||||
<td>Optional</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>str</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
No
|
|
||||||
</td>
|
|
||||||
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
</div>
|
|
||||||
<div class="io-description">
|
|
||||||
<b>Returns : </b> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="io-description">
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -385,6 +382,8 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>Provides an avenue of fetching resources via HTTP calls. </p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
<b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
|
<b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
|
||||||
@ -420,6 +419,8 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>Parses data to CSV format.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
<b>Parameters :</b>
|
<b>Parameters :</b>
|
||||||
@ -429,6 +430,7 @@
|
|||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
<td>Type</td>
|
<td>Type</td>
|
||||||
<td>Optional</td>
|
<td>Optional</td>
|
||||||
|
<td>Description</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -443,6 +445,12 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>The data to be parsed.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -454,6 +462,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
|
<p>An array of the parsed data.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -484,6 +493,8 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>Reads a csv file and converts it to an array.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
<b>Parameters :</b>
|
<b>Parameters :</b>
|
||||||
@ -493,6 +504,7 @@
|
|||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
<td>Type</td>
|
<td>Type</td>
|
||||||
<td>Optional</td>
|
<td>Optional</td>
|
||||||
|
<td>Description</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -507,6 +519,12 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>The file to be read.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -518,6 +536,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
|
<p>An array of the read data.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -550,6 +569,8 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>Validates a person object against the defined Person schema.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
<b>Parameters :</b>
|
<b>Parameters :</b>
|
||||||
@ -559,6 +580,7 @@
|
|||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
<td>Type</td>
|
<td>Type</td>
|
||||||
<td>Optional</td>
|
<td>Optional</td>
|
||||||
|
<td>Description</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -573,6 +595,12 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>A person object to be validated.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -614,6 +642,8 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-md-4">
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>Validates a vcard object against the defined Vcard schema.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="io-description">
|
<div class="io-description">
|
||||||
<b>Parameters :</b>
|
<b>Parameters :</b>
|
||||||
@ -623,6 +653,7 @@
|
|||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
<td>Type</td>
|
<td>Type</td>
|
||||||
<td>Optional</td>
|
<td>Optional</td>
|
||||||
|
<td>Description</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -637,6 +668,12 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>A vcard object to be validated.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -294,6 +294,12 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>A mock of the curated account types. </p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -328,6 +334,12 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>A mock of actions made by the admin staff. </p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -418,6 +430,12 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>A mock of curated area names. </p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -462,6 +480,12 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>A mock of curated area types. </p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -589,6 +613,12 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>A mock of the user's business categories </p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -616,6 +646,12 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>A mock of curated genders </p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -647,6 +683,12 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>Exports the MockBackendInterceptor as an Angular provider.</p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -704,6 +746,12 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>A mock of the tokens in the system. </p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -731,6 +779,12 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>A mock of curated transaction types. </p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -982,6 +1036,12 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="col-md-4">
|
||||||
|
<div class="io-description"><p>An object defining the properties of the data read. </p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
File diff suppressed because one or more lines are too long
@ -68,6 +68,18 @@
|
|||||||
<div class="container container-main">
|
<div class="container container-main">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8 col-content">
|
<div class="col-8 col-content">
|
||||||
|
<section class="tsd-panel tsd-comment">
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Custom provider that defines how form controls behave with regards to displaying error messages.</p>
|
||||||
|
</div>
|
||||||
|
<dl class="tsd-comment-tags">
|
||||||
|
<dt>implements</dt>
|
||||||
|
<dd><p>ErrorStateMatcher</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
<section class="tsd-panel tsd-hierarchy">
|
<section class="tsd-panel tsd-hierarchy">
|
||||||
<h3>Hierarchy</h3>
|
<h3>Hierarchy</h3>
|
||||||
<ul class="tsd-hierarchy">
|
<ul class="tsd-hierarchy">
|
||||||
@ -131,19 +143,31 @@
|
|||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<p>Implementation of ErrorStateMatcher.isErrorState</p>
|
<p>Implementation of ErrorStateMatcher.isErrorState</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in src/app/_helpers/custom-error-state-matcher.ts:5</li>
|
<li>Defined in src/app/_helpers/custom-error-state-matcher.ts:18</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Checks whether an invalid input has been made and an error should be made.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
<ul class="tsd-parameters">
|
<ul class="tsd-parameters">
|
||||||
<li>
|
<li>
|
||||||
<h5>control: <span class="tsd-signature-type">FormControl</span></h5>
|
<h5>control: <span class="tsd-signature-type">FormControl</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>Tracks the value and validation status of an individual form control.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<h5>form: <span class="tsd-signature-type">FormGroupDirective</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">NgForm</span></h5>
|
<h5>form: <span class="tsd-signature-type">FormGroupDirective</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">NgForm</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>Binding of an existing FormGroup to a DOM element.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
|
||||||
|
<p>true - If an invalid input has been made to the form control.</p>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
@ -68,6 +68,13 @@
|
|||||||
<div class="container container-main">
|
<div class="container container-main">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8 col-content">
|
<div class="col-8 col-content">
|
||||||
|
<section class="tsd-panel tsd-comment">
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Provides methods to perform custom validation to form inputs.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
<section class="tsd-panel tsd-hierarchy">
|
<section class="tsd-panel tsd-hierarchy">
|
||||||
<h3>Hierarchy</h3>
|
<h3>Hierarchy</h3>
|
||||||
<ul class="tsd-hierarchy">
|
<ul class="tsd-hierarchy">
|
||||||
@ -125,13 +132,21 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in src/app/_helpers/custom.validator.ts:4</li>
|
<li>Defined in src/app/_helpers/custom.validator.ts:13</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Sets errors to the confirm password input field if it does not match with the value in the password input field.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
<ul class="tsd-parameters">
|
<ul class="tsd-parameters">
|
||||||
<li>
|
<li>
|
||||||
<h5>control: <span class="tsd-signature-type">AbstractControl</span></h5>
|
<h5>control: <span class="tsd-signature-type">AbstractControl</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>The control object of the form being validated.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
|
||||||
@ -148,19 +163,31 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in src/app/_helpers/custom.validator.ts:12</li>
|
<li>Defined in src/app/_helpers/custom.validator.ts:28</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Sets errors to a form field if it does not match with the regular expression given.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
<ul class="tsd-parameters">
|
<ul class="tsd-parameters">
|
||||||
<li>
|
<li>
|
||||||
<h5>regex: <span class="tsd-signature-type">RegExp</span></h5>
|
<h5>regex: <span class="tsd-signature-type">RegExp</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>The regular expression to match with the form field.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<h5>error: <span class="tsd-signature-type">ValidationErrors</span></h5>
|
<h5>error: <span class="tsd-signature-type">ValidationErrors</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>Defines the map of errors to return from failed validation checks.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">ValidationErrors</span></h4>
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">ValidationErrors</span></h4>
|
||||||
|
<p>The map of errors returned from failed validation checks.</p>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
@ -68,6 +68,13 @@
|
|||||||
<div class="container container-main">
|
<div class="container container-main">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8 col-content">
|
<div class="col-8 col-content">
|
||||||
|
<section class="tsd-panel tsd-comment">
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Provides a hook for centralized exception handling.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
<section class="tsd-panel tsd-hierarchy">
|
<section class="tsd-panel tsd-hierarchy">
|
||||||
<h3>Hierarchy</h3>
|
<h3>Hierarchy</h3>
|
||||||
<ul class="tsd-hierarchy">
|
<ul class="tsd-hierarchy">
|
||||||
@ -121,16 +128,27 @@
|
|||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<p>Overrides ErrorHandler.constructor</p>
|
<p>Overrides ErrorHandler.constructor</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in src/app/_helpers/global-error-handler.ts:18</li>
|
<li>Defined in src/app/_helpers/global-error-handler.ts:42</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Initialization of the Global Error Handler.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
<ul class="tsd-parameters">
|
<ul class="tsd-parameters">
|
||||||
<li>
|
<li>
|
||||||
<h5>loggingService: <a href="app__services_logging_service.loggingservice.html" class="tsd-signature-type" data-tsd-kind="Class">LoggingService</a></h5>
|
<h5>loggingService: <a href="app__services_logging_service.loggingservice.html" class="tsd-signature-type" data-tsd-kind="Class">LoggingService</a></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>A service that provides logging capabilities.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<h5>router: <span class="tsd-signature-type">Router</span></h5>
|
<h5>router: <span class="tsd-signature-type">Router</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>A service that provides navigation among views and URL manipulation capabilities.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h4 class="tsd-returns-title">Returns <a href="app__helpers_global_error_handler.globalerrorhandler.html" class="tsd-signature-type" data-tsd-kind="Class">GlobalErrorHandler</a></h4>
|
<h4 class="tsd-returns-title">Returns <a href="app__helpers_global_error_handler.globalerrorhandler.html" class="tsd-signature-type" data-tsd-kind="Class">GlobalErrorHandler</a></h4>
|
||||||
@ -146,9 +164,14 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">sentences<wbr>For<wbr>Warning<wbr>Logging<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> = []</span></div>
|
<div class="tsd-signature tsd-kind-icon">sentences<wbr>For<wbr>Warning<wbr>Logging<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> = []</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in src/app/_helpers/global-error-handler.ts:18</li>
|
<li>Defined in src/app/_helpers/global-error-handler.ts:42</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>An array of sentence sections that denote warnings.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
<section class="tsd-panel-group tsd-member-group ">
|
<section class="tsd-panel-group tsd-member-group ">
|
||||||
@ -164,13 +187,21 @@
|
|||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<p>Overrides ErrorHandler.handleError</p>
|
<p>Overrides ErrorHandler.handleError</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in src/app/_helpers/global-error-handler.ts:27</li>
|
<li>Defined in src/app/_helpers/global-error-handler.ts:62</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Handles different types of errors.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
<ul class="tsd-parameters">
|
<ul class="tsd-parameters">
|
||||||
<li>
|
<li>
|
||||||
<h5>error: <span class="tsd-signature-type">Error</span></h5>
|
<h5>error: <span class="tsd-signature-type">Error</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>An error objects thrown when a runtime errors occurs.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
|
||||||
@ -187,16 +218,25 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in src/app/_helpers/global-error-handler.ts:67</li>
|
<li>Defined in src/app/_helpers/global-error-handler.ts:89</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Checks if an error is of type warning.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
<ul class="tsd-parameters">
|
<ul class="tsd-parameters">
|
||||||
<li>
|
<li>
|
||||||
<h5>errorTraceString: <span class="tsd-signature-type">string</span></h5>
|
<h5>errorTraceString: <span class="tsd-signature-type">string</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>A description of the error and it's stack trace.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
|
||||||
|
<p>true - If the error is of type warning.</p>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
@ -210,13 +250,21 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in src/app/_helpers/global-error-handler.ts:47</li>
|
<li>Defined in src/app/_helpers/global-error-handler.ts:109</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Write appropriate logs according to the type of error.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
<ul class="tsd-parameters">
|
<ul class="tsd-parameters">
|
||||||
<li>
|
<li>
|
||||||
<h5>error: <span class="tsd-signature-type">any</span></h5>
|
<h5>error: <span class="tsd-signature-type">any</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>An error objects thrown when a runtime errors occurs.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
|
||||||
|
@ -68,6 +68,13 @@
|
|||||||
<div class="container container-main">
|
<div class="container container-main">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8 col-content">
|
<div class="col-8 col-content">
|
||||||
|
<section class="tsd-panel tsd-comment">
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>A generalized http response error.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
<section class="tsd-panel tsd-hierarchy">
|
<section class="tsd-panel tsd-hierarchy">
|
||||||
<h3>Hierarchy</h3>
|
<h3>Hierarchy</h3>
|
||||||
<ul class="tsd-hierarchy">
|
<ul class="tsd-hierarchy">
|
||||||
@ -124,16 +131,27 @@
|
|||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<p>Overrides Error.constructor</p>
|
<p>Overrides Error.constructor</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in src/app/_helpers/global-error-handler.ts:8</li>
|
<li>Defined in src/app/_helpers/global-error-handler.ts:16</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Initialize the HttpError class.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
<ul class="tsd-parameters">
|
<ul class="tsd-parameters">
|
||||||
<li>
|
<li>
|
||||||
<h5>message: <span class="tsd-signature-type">string</span></h5>
|
<h5>message: <span class="tsd-signature-type">string</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>The message given by the error.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<h5>status: <span class="tsd-signature-type">number</span></h5>
|
<h5>status: <span class="tsd-signature-type">number</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>The status code given by the error.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h4 class="tsd-returns-title">Returns <a href="app__helpers_global_error_handler.httperror.html" class="tsd-signature-type" data-tsd-kind="Class">HttpError</a></h4>
|
<h4 class="tsd-returns-title">Returns <a href="app__helpers_global_error_handler.httperror.html" class="tsd-signature-type" data-tsd-kind="Class">HttpError</a></h4>
|
||||||
@ -182,9 +200,14 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">status<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
<div class="tsd-signature tsd-kind-icon">status<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in src/app/_helpers/global-error-handler.ts:8</li>
|
<li>Defined in src/app/_helpers/global-error-handler.ts:16</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>The error's status code.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external">
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external">
|
||||||
<a name="preparestacktrace" class="tsd-anchor"></a>
|
<a name="preparestacktrace" class="tsd-anchor"></a>
|
||||||
|
@ -68,6 +68,19 @@
|
|||||||
<div class="container container-main">
|
<div class="container container-main">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8 col-content">
|
<div class="col-8 col-content">
|
||||||
|
<section class="tsd-panel tsd-comment">
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Intercepts HTTP requests and handles some specified requests internally.
|
||||||
|
Provides a backend that can handle requests for certain data items.</p>
|
||||||
|
</div>
|
||||||
|
<dl class="tsd-comment-tags">
|
||||||
|
<dt>implements</dt>
|
||||||
|
<dd><p>HttpInterceptor</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
<section class="tsd-panel tsd-hierarchy">
|
<section class="tsd-panel tsd-hierarchy">
|
||||||
<h3>Hierarchy</h3>
|
<h3>Hierarchy</h3>
|
||||||
<ul class="tsd-hierarchy">
|
<ul class="tsd-hierarchy">
|
||||||
@ -131,19 +144,31 @@
|
|||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<p>Implementation of HttpInterceptor.intercept</p>
|
<p>Implementation of HttpInterceptor.intercept</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in src/app/_helpers/mock-backend.ts:240</li>
|
<li>Defined in src/app/_helpers/mock-backend.ts:268</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Intercepts HTTP requests.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
<ul class="tsd-parameters">
|
<ul class="tsd-parameters">
|
||||||
<li>
|
<li>
|
||||||
<h5>request: <span class="tsd-signature-type">HttpRequest</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></h5>
|
<h5>request: <span class="tsd-signature-type">HttpRequest</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>An outgoing HTTP request with an optional typed body.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<h5>next: <span class="tsd-signature-type">HttpHandler</span></h5>
|
<h5>next: <span class="tsd-signature-type">HttpHandler</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>The next HTTP handler or the outgoing request dispatcher.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Observable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">HttpEvent</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4>
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Observable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">HttpEvent</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4>
|
||||||
|
<p>The response from the resolved request.</p>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
@ -90,16 +90,32 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in src/app/_helpers/array-sum.ts:1</li>
|
<li>Defined in src/app/_helpers/array-sum.ts:13</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Returns the sum of all values in an array.</p>
|
||||||
|
</div>
|
||||||
|
<dl class="tsd-comment-tags">
|
||||||
|
<dt>example</dt>
|
||||||
|
<dd><p>Prints 6 for the array [1, 2, 3]:</p>
|
||||||
|
<pre><code class="language-typescript"><span style="color: #001080">console</span><span style="color: #000000">.</span><span style="color: #795E26">log</span><span style="color: #000000">(</span><span style="color: #795E26">arraySum</span><span style="color: #000000">([</span><span style="color: #098658">1</span><span style="color: #000000">, </span><span style="color: #098658">2</span><span style="color: #000000">, </span><span style="color: #098658">3</span><span style="color: #000000">]));</span>
|
||||||
|
</code></pre>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
<ul class="tsd-parameters">
|
<ul class="tsd-parameters">
|
||||||
<li>
|
<li>
|
||||||
<h5>arr: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h5>
|
<h5>arr: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>An array of numbers.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4>
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4>
|
||||||
|
<p>The sum of all values in the array.</p>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
@ -90,16 +90,32 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in src/app/_helpers/clipboard-copy.ts:1</li>
|
<li>Defined in src/app/_helpers/clipboard-copy.ts:13</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Copies set text to clipboard.</p>
|
||||||
|
</div>
|
||||||
|
<dl class="tsd-comment-tags">
|
||||||
|
<dt>example</dt>
|
||||||
|
<dd><p>copies 'Hello World!' to the clipboard and prints "true":</p>
|
||||||
|
<pre><code class="language-typescript"><span style="color: #001080">console</span><span style="color: #000000">.</span><span style="color: #795E26">log</span><span style="color: #000000">(</span><span style="color: #795E26">copyToClipboard</span><span style="color: #000000">(</span><span style="color: #A31515">'Hello World!'</span><span style="color: #000000">));</span>
|
||||||
|
</code></pre>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
<ul class="tsd-parameters">
|
<ul class="tsd-parameters">
|
||||||
<li>
|
<li>
|
||||||
<h5>text: <span class="tsd-signature-type">any</span></h5>
|
<h5>text: <span class="tsd-signature-type">any</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>The text to be copied to the clipboard.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
|
||||||
|
<p>true - If the copy operation is successful.</p>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
@ -90,19 +90,34 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in src/app/_helpers/export-csv.ts:1</li>
|
<li>Defined in src/app/_helpers/export-csv.ts:9</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Exports data to a CSV format and provides a download file.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
<ul class="tsd-parameters">
|
<ul class="tsd-parameters">
|
||||||
<li>
|
<li>
|
||||||
<h5>arrayData: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h5>
|
<h5>arrayData: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>An array of data to be converted to CSV format.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<h5>filename: <span class="tsd-signature-type">string</span></h5>
|
<h5>filename: <span class="tsd-signature-type">string</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>The name of the file to be downloaded.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<h5>delimiter: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = ','</span></h5>
|
<h5>delimiter: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = ','</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>The delimiter to be used when converting to CSV format.
|
||||||
|
Defaults to commas.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
|
||||||
|
@ -90,9 +90,14 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in src/app/_helpers/http-getter.ts:1</li>
|
<li>Defined in src/app/_helpers/http-getter.ts:2</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Provides an avenue of fetching resources via HTTP calls.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -92,9 +92,18 @@
|
|||||||
<div class="tsd-signature tsd-kind-icon">Mock<wbr>Backend<wbr>Provider<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>multi<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>provide<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">InjectionToken</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">HttpInterceptor</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">; </span>useClass<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">typeof </span><a href="../classes/app__helpers_mock_backend.mockbackendinterceptor.html" class="tsd-signature-type" data-tsd-kind="Class">MockBackendInterceptor</a><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> = ...</span></div>
|
<div class="tsd-signature tsd-kind-icon">Mock<wbr>Backend<wbr>Provider<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>multi<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span>provide<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">InjectionToken</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">HttpInterceptor</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">; </span>useClass<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">typeof </span><a href="../classes/app__helpers_mock_backend.mockbackendinterceptor.html" class="tsd-signature-type" data-tsd-kind="Class">MockBackendInterceptor</a><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> = ...</span></div>
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in src/app/_helpers/mock-backend.ts:378</li>
|
<li>Defined in src/app/_helpers/mock-backend.ts:412</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Exports the MockBackendInterceptor as an Angular provider.</p>
|
||||||
|
</div>
|
||||||
|
<dl class="tsd-comment-tags">
|
||||||
|
<dt>exports</dt>
|
||||||
|
<dd></dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
<div class="tsd-type-declaration">
|
<div class="tsd-type-declaration">
|
||||||
<h4>Type declaration</h4>
|
<h4>Type declaration</h4>
|
||||||
<ul class="tsd-parameters">
|
<ul class="tsd-parameters">
|
||||||
|
@ -90,16 +90,25 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in src/app/_helpers/read-csv.ts:6</li>
|
<li>Defined in src/app/_helpers/read-csv.ts:13</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Reads a csv file and converts it to an array.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
<ul class="tsd-parameters">
|
<ul class="tsd-parameters">
|
||||||
<li>
|
<li>
|
||||||
<h5>input: <span class="tsd-signature-type">any</span></h5>
|
<h5>input: <span class="tsd-signature-type">any</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>The file to be read.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">void</span></h4>
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">void</span></h4>
|
||||||
|
<p>An array of the read data.</p>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
@ -91,13 +91,21 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in src/app/_helpers/schema-validation.ts:3</li>
|
<li>Defined in src/app/_helpers/schema-validation.ts:9</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Validates a person object against the defined Person schema.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
<ul class="tsd-parameters">
|
<ul class="tsd-parameters">
|
||||||
<li>
|
<li>
|
||||||
<h5>person: <span class="tsd-signature-type">any</span></h5>
|
<h5>person: <span class="tsd-signature-type">any</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>A person object to be validated.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4>
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4>
|
||||||
@ -114,13 +122,21 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in src/app/_helpers/schema-validation.ts:11</li>
|
<li>Defined in src/app/_helpers/schema-validation.ts:22</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<div class="lead">
|
||||||
|
<p>Validates a vcard object against the defined Vcard schema.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||||
<ul class="tsd-parameters">
|
<ul class="tsd-parameters">
|
||||||
<li>
|
<li>
|
||||||
<h5>vcard: <span class="tsd-signature-type">any</span></h5>
|
<h5>vcard: <span class="tsd-signature-type">any</span></h5>
|
||||||
|
<div class="tsd-comment tsd-typography">
|
||||||
|
<p>A vcard object to be validated.</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4>
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4>
|
||||||
|
@ -1,7 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* Returns the sum of all values in an array.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* Prints 6 for the array [1, 2, 3]:
|
||||||
|
* ```typescript
|
||||||
|
* console.log(arraySum([1, 2, 3]));
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param arr - An array of numbers.
|
||||||
|
* @return The sum of all values in the array.
|
||||||
|
*/
|
||||||
function arraySum(arr: Array<number>): number {
|
function arraySum(arr: Array<number>): number {
|
||||||
return arr.reduce((accumulator, current) => accumulator + current, 0);
|
return arr.reduce((accumulator, current) => accumulator + current, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @exports */
|
||||||
export {
|
export {
|
||||||
arraySum
|
arraySum
|
||||||
};
|
};
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* Copies set text to clipboard.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* copies 'Hello World!' to the clipboard and prints "true":
|
||||||
|
* ```typescript
|
||||||
|
* console.log(copyToClipboard('Hello World!'));
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param text - The text to be copied to the clipboard.
|
||||||
|
* @returns true - If the copy operation is successful.
|
||||||
|
*/
|
||||||
function copyToClipboard(text: any): boolean {
|
function copyToClipboard(text: any): boolean {
|
||||||
// create our hidden div element
|
// create our hidden div element
|
||||||
const hiddenCopy: HTMLDivElement = document.createElement('div');
|
const hiddenCopy: HTMLDivElement = document.createElement('div');
|
||||||
@ -48,6 +60,7 @@ function copyToClipboard(text: any): boolean {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @exports */
|
||||||
export {
|
export {
|
||||||
copyToClipboard
|
copyToClipboard
|
||||||
};
|
};
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// Application imports
|
||||||
import { CustomErrorStateMatcher } from '@app/_helpers/custom-error-state-matcher';
|
import { CustomErrorStateMatcher } from '@app/_helpers/custom-error-state-matcher';
|
||||||
|
|
||||||
describe('CustomErrorStateMatcher', () => {
|
describe('CustomErrorStateMatcher', () => {
|
||||||
|
@ -1,7 +1,20 @@
|
|||||||
import {ErrorStateMatcher} from '@angular/material/core';
|
// Core imports
|
||||||
import {FormControl, FormGroupDirective, NgForm} from '@angular/forms';
|
import {FormControl, FormGroupDirective, NgForm} from '@angular/forms';
|
||||||
|
import {ErrorStateMatcher} from '@angular/material/core';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom provider that defines how form controls behave with regards to displaying error messages.
|
||||||
|
*
|
||||||
|
* @implements ErrorStateMatcher
|
||||||
|
*/
|
||||||
export class CustomErrorStateMatcher implements ErrorStateMatcher{
|
export class CustomErrorStateMatcher implements ErrorStateMatcher{
|
||||||
|
/**
|
||||||
|
* Checks whether an invalid input has been made and an error should be made.
|
||||||
|
*
|
||||||
|
* @param control - Tracks the value and validation status of an individual form control.
|
||||||
|
* @param form - Binding of an existing FormGroup to a DOM element.
|
||||||
|
* @returns true - If an invalid input has been made to the form control.
|
||||||
|
*/
|
||||||
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
|
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
|
||||||
const isSubmitted: boolean = form && form.submitted;
|
const isSubmitted: boolean = form && form.submitted;
|
||||||
return !!(control && control.invalid && (control.dirty || control.touched || isSubmitted));
|
return !!(control && control.invalid && (control.dirty || control.touched || isSubmitted));
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// Application imports
|
||||||
import { CustomValidator } from '@app/_helpers/custom.validator';
|
import { CustomValidator } from '@app/_helpers/custom.validator';
|
||||||
|
|
||||||
describe('Custom.Validator', () => {
|
describe('Custom.Validator', () => {
|
||||||
|
@ -1,6 +1,15 @@
|
|||||||
|
// Core imports
|
||||||
import {AbstractControl, ValidationErrors} from '@angular/forms';
|
import {AbstractControl, ValidationErrors} from '@angular/forms';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides methods to perform custom validation to form inputs.
|
||||||
|
*/
|
||||||
export class CustomValidator {
|
export class CustomValidator {
|
||||||
|
/**
|
||||||
|
* Sets errors to the confirm password input field if it does not match with the value in the password input field.
|
||||||
|
*
|
||||||
|
* @param control - The control object of the form being validated.
|
||||||
|
*/
|
||||||
static passwordMatchValidator(control: AbstractControl): void {
|
static passwordMatchValidator(control: AbstractControl): void {
|
||||||
const password: string = control.get('password').value;
|
const password: string = control.get('password').value;
|
||||||
const confirmPassword: string = control.get('confirmPassword').value;
|
const confirmPassword: string = control.get('confirmPassword').value;
|
||||||
@ -9,6 +18,13 @@ export class CustomValidator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets errors to a form field if it does not match with the regular expression given.
|
||||||
|
*
|
||||||
|
* @param regex - The regular expression to match with the form field.
|
||||||
|
* @param error - Defines the map of errors to return from failed validation checks.
|
||||||
|
* @returns The map of errors returned from failed validation checks.
|
||||||
|
*/
|
||||||
static patternValidator(regex: RegExp, error: ValidationErrors): ValidationErrors | null {
|
static patternValidator(regex: RegExp, error: ValidationErrors): ValidationErrors | null {
|
||||||
return (control: AbstractControl): { [key: string]: any } => {
|
return (control: AbstractControl): { [key: string]: any } => {
|
||||||
if (!control.value) {
|
if (!control.value) {
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* Exports data to a CSV format and provides a download file.
|
||||||
|
*
|
||||||
|
* @param arrayData - An array of data to be converted to CSV format.
|
||||||
|
* @param filename - The name of the file to be downloaded.
|
||||||
|
* @param delimiter - The delimiter to be used when converting to CSV format.
|
||||||
|
* Defaults to commas.
|
||||||
|
*/
|
||||||
function exportCsv(arrayData: Array<any>, filename: string, delimiter: string = ','): void {
|
function exportCsv(arrayData: Array<any>, filename: string, delimiter: string = ','): void {
|
||||||
if (arrayData === undefined || arrayData.length === 0) {
|
if (arrayData === undefined || arrayData.length === 0) {
|
||||||
alert('No data to be exported!');
|
alert('No data to be exported!');
|
||||||
@ -26,13 +34,7 @@ function exportCsv(arrayData: Array<any>, filename: string, delimiter: string =
|
|||||||
downloadLink.click();
|
downloadLink.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeSpecialChar(str: string): string {
|
/** @exports */
|
||||||
if (str === null || str === '') {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
return str.replace(/[^a-zA-Z0-9 ]/g, '');
|
|
||||||
}
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
exportCsv
|
exportCsv
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { GlobalErrorHandler } from './global-error-handler';
|
// Application imports
|
||||||
|
import { GlobalErrorHandler } from '@app/_helpers/global-error-handler';
|
||||||
|
|
||||||
describe('GlobalErrorHandler', () => {
|
describe('GlobalErrorHandler', () => {
|
||||||
it('should create an instance', () => {
|
it('should create an instance', () => {
|
||||||
|
@ -1,11 +1,26 @@
|
|||||||
import {ErrorHandler, Injectable} from '@angular/core';
|
// Core imports
|
||||||
import {LoggingService} from '@app/_services/logging.service';
|
|
||||||
import {HttpErrorResponse} from '@angular/common/http';
|
import {HttpErrorResponse} from '@angular/common/http';
|
||||||
|
import {ErrorHandler, Injectable} from '@angular/core';
|
||||||
import {Router} from '@angular/router';
|
import {Router} from '@angular/router';
|
||||||
|
|
||||||
// A generalized http response error
|
// Application imports
|
||||||
|
import {LoggingService} from '@app/_services/logging.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A generalized http response error.
|
||||||
|
*
|
||||||
|
* @extends Error
|
||||||
|
*/
|
||||||
export class HttpError extends Error {
|
export class HttpError extends Error {
|
||||||
|
/** The error's status code. */
|
||||||
public status: number;
|
public status: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the HttpError class.
|
||||||
|
*
|
||||||
|
* @param message - The message given by the error.
|
||||||
|
* @param status - The status code given by the error.
|
||||||
|
*/
|
||||||
constructor(message: string, status: number) {
|
constructor(message: string, status: number) {
|
||||||
super(message);
|
super(message);
|
||||||
this.status = status;
|
this.status = status;
|
||||||
@ -13,10 +28,25 @@ export class HttpError extends Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a hook for centralized exception handling.
|
||||||
|
*
|
||||||
|
* @extends ErrorHandler
|
||||||
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GlobalErrorHandler extends ErrorHandler {
|
export class GlobalErrorHandler extends ErrorHandler {
|
||||||
|
/**
|
||||||
|
* An array of sentence sections that denote warnings.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
private sentencesForWarningLogging: Array<string> = [];
|
private sentencesForWarningLogging: Array<string> = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of the Global Error Handler.
|
||||||
|
*
|
||||||
|
* @param loggingService - A service that provides logging capabilities.
|
||||||
|
* @param router - A service that provides navigation among views and URL manipulation capabilities.
|
||||||
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private loggingService: LoggingService,
|
private loggingService: LoggingService,
|
||||||
private router: Router
|
private router: Router
|
||||||
@ -24,6 +54,11 @@ export class GlobalErrorHandler extends ErrorHandler {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles different types of errors.
|
||||||
|
*
|
||||||
|
* @param error - An error objects thrown when a runtime errors occurs.
|
||||||
|
*/
|
||||||
handleError(error: Error): void {
|
handleError(error: Error): void {
|
||||||
this.logError(error);
|
this.logError(error);
|
||||||
const message: string = error.message ? error.message : error.toString();
|
const message: string = error.message ? error.message : error.toString();
|
||||||
@ -44,21 +79,13 @@ export class GlobalErrorHandler extends ErrorHandler {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
logError(error: any): void {
|
/**
|
||||||
const route: string = this.router.url;
|
* Checks if an error is of type warning.
|
||||||
if (error instanceof HttpErrorResponse) {
|
*
|
||||||
this.loggingService.sendErrorLevelMessage(
|
* @param errorTraceString - A description of the error and it's stack trace.
|
||||||
`There was an HTTP error on route ${route}.\n${error.message}.\nStatus code: ${(error as HttpErrorResponse).status}`,
|
* @returns true - If the error is of type warning.
|
||||||
this, {error});
|
* @private
|
||||||
} else if (error instanceof TypeError) {
|
*/
|
||||||
this.loggingService.sendErrorLevelMessage(`There was a Type error on route ${route}.\n${error.message}`, this, {error});
|
|
||||||
} else if (error instanceof Error) {
|
|
||||||
this.loggingService.sendErrorLevelMessage(`There was a general error on route ${route}.\n${error.message}`, this, {error});
|
|
||||||
} else {
|
|
||||||
this.loggingService.sendErrorLevelMessage(`Nobody threw an error but something happened on route ${route}!`, this, {error});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private isWarning(errorTraceString: string): boolean {
|
private isWarning(errorTraceString: string): boolean {
|
||||||
let isWarning: boolean = true;
|
let isWarning: boolean = true;
|
||||||
if (errorTraceString.includes('/src/app/')) {
|
if (errorTraceString.includes('/src/app/')) {
|
||||||
@ -73,4 +100,24 @@ export class GlobalErrorHandler extends ErrorHandler {
|
|||||||
|
|
||||||
return isWarning;
|
return isWarning;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write appropriate logs according to the type of error.
|
||||||
|
*
|
||||||
|
* @param error - An error objects thrown when a runtime errors occurs.
|
||||||
|
*/
|
||||||
|
logError(error: any): void {
|
||||||
|
const route: string = this.router.url;
|
||||||
|
if (error instanceof HttpErrorResponse) {
|
||||||
|
this.loggingService.sendErrorLevelMessage(
|
||||||
|
`There was an HTTP error on route ${route}.\n${error.message}.\nStatus code: ${(error as HttpErrorResponse).status}`,
|
||||||
|
this, {error});
|
||||||
|
} else if (error instanceof TypeError) {
|
||||||
|
this.loggingService.sendErrorLevelMessage(`There was a Type error on route ${route}.\n${error.message}`, this, {error});
|
||||||
|
} else if (error instanceof Error) {
|
||||||
|
this.loggingService.sendErrorLevelMessage(`There was a general error on route ${route}.\n${error.message}`, this, {error});
|
||||||
|
} else {
|
||||||
|
this.loggingService.sendErrorLevelMessage(`Nobody threw an error but something happened on route ${route}!`, this, {error});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
|
/** Provides an avenue of fetching resources via HTTP calls. */
|
||||||
function HttpGetter(): void {}
|
function HttpGetter(): void {}
|
||||||
|
|
||||||
HttpGetter.prototype.get = filename => new Promise((resolve, reject) => {
|
/**
|
||||||
|
* Fetches files using HTTP get requests.
|
||||||
|
*
|
||||||
|
* @param filename - The filename to fetch.
|
||||||
|
* @returns The HTTP response text.
|
||||||
|
*/
|
||||||
|
HttpGetter.prototype.get = (filename: string) => new Promise((resolve, reject) => {
|
||||||
const xhr: XMLHttpRequest = new XMLHttpRequest();
|
const xhr: XMLHttpRequest = new XMLHttpRequest();
|
||||||
xhr.addEventListener('load', (e) => {
|
xhr.addEventListener('load', (e) => {
|
||||||
if (xhr.status === 200) {
|
if (xhr.status === 200) {
|
||||||
@ -13,6 +20,7 @@ HttpGetter.prototype.get = filename => new Promise((resolve, reject) => {
|
|||||||
xhr.send();
|
xhr.send();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** @exports */
|
||||||
export {
|
export {
|
||||||
HttpGetter
|
HttpGetter
|
||||||
};
|
};
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
export * from '@app/_helpers/array-sum';
|
||||||
|
export * from '@app/_helpers/clipboard-copy';
|
||||||
export * from '@app/_helpers/custom.validator';
|
export * from '@app/_helpers/custom.validator';
|
||||||
export * from '@app/_helpers/custom-error-state-matcher';
|
export * from '@app/_helpers/custom-error-state-matcher';
|
||||||
export * from '@app/_helpers/mock-backend';
|
|
||||||
export * from '@app/_helpers/array-sum';
|
|
||||||
export * from '@app/_helpers/http-getter';
|
|
||||||
export * from '@app/_helpers/global-error-handler';
|
|
||||||
export * from '@app/_helpers/export-csv';
|
export * from '@app/_helpers/export-csv';
|
||||||
|
export * from '@app/_helpers/global-error-handler';
|
||||||
|
export * from '@app/_helpers/http-getter';
|
||||||
|
export * from '@app/_helpers/mock-backend';
|
||||||
export * from '@app/_helpers/read-csv';
|
export * from '@app/_helpers/read-csv';
|
||||||
export * from '@app/_helpers/clipboard-copy';
|
|
||||||
export * from '@app/_helpers/schema-validation';
|
export * from '@app/_helpers/schema-validation';
|
||||||
|
@ -1,9 +1,18 @@
|
|||||||
|
// Core imports
|
||||||
import {HTTP_INTERCEPTORS, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse} from '@angular/common/http';
|
import {HTTP_INTERCEPTORS, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse} from '@angular/common/http';
|
||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
|
|
||||||
|
// Third party imports
|
||||||
import {Observable, of, throwError} from 'rxjs';
|
import {Observable, of, throwError} from 'rxjs';
|
||||||
import {delay, dematerialize, materialize, mergeMap} from 'rxjs/operators';
|
import {delay, dematerialize, materialize, mergeMap} from 'rxjs/operators';
|
||||||
|
|
||||||
|
// Application imports
|
||||||
import {Action, AreaName, AreaType, Category, Token} from '@app/_models';
|
import {Action, AreaName, AreaType, Category, Token} from '@app/_models';
|
||||||
|
|
||||||
|
/** A mock of the curated account types. */
|
||||||
|
const accountTypes: Array<string> = ['user', 'cashier', 'vendor', 'tokenagent', 'group'];
|
||||||
|
|
||||||
|
/** A mock of actions made by the admin staff. */
|
||||||
const actions: Array<Action> = [
|
const actions: Array<Action> = [
|
||||||
{ id: 1, user: 'Tom', role: 'enroller', action: 'Disburse RSV 100', approval: false },
|
{ id: 1, user: 'Tom', role: 'enroller', action: 'Disburse RSV 100', approval: false },
|
||||||
{ id: 2, user: 'Christine', role: 'admin', action: 'Change user phone number', approval: true },
|
{ id: 2, user: 'Christine', role: 'admin', action: 'Change user phone number', approval: true },
|
||||||
@ -13,38 +22,93 @@ const actions: Array<Action> = [
|
|||||||
{ id: 6, user: 'Patience', role: 'enroller', action: 'Change user information', approval: false }
|
{ id: 6, user: 'Patience', role: 'enroller', action: 'Change user information', approval: false }
|
||||||
];
|
];
|
||||||
|
|
||||||
const tokens: Array<Token> = [
|
/** A mock of curated area names. */
|
||||||
|
const areaNames: Array<AreaName> = [
|
||||||
{
|
{
|
||||||
name: 'Giftable Reserve', symbol: 'GRZ', address: '0xa686005CE37Dce7738436256982C3903f2E4ea8E', supply: '1000000001000000000000000000',
|
name: 'Mukuru Nairobi',
|
||||||
decimals: '18', reserves: {}
|
locations: ['kayaba', 'kayba', 'kambi', 'mukuru', 'masai', 'hazina', 'south', 'tetra', 'tetrapak', 'ruben', 'rueben', 'kingston',
|
||||||
|
'korokocho', 'kingstone', 'kamongo', 'lungalunga', 'sinai', 'sigei', 'lungu', 'lunga lunga', 'owino road', 'seigei']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Demo Token', symbol: 'DEMO', address: '0xc80D6aFF8194114c52AEcD84c9f15fd5c8abb187', supply: '99999999999999998976',
|
name: 'Kinango Kwale',
|
||||||
decimals: '18', reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '99999999999999998976'}},
|
locations: ['amani', 'bofu', 'chibuga', 'chikomani', 'chilongoni', 'chigojoni', 'chinguluni', 'chigato', 'chigale', 'chikole',
|
||||||
reserveRatio: '1000000', owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
'chilongoni', 'chilumani', 'chigojoni', 'chikomani', 'chizini', 'chikomeni', 'chidzuvini', 'chidzivuni', 'chikuyu', 'chizingo',
|
||||||
|
'doti', 'dzugwe', 'dzivani', 'dzovuni', 'hanje', 'kasemeni', 'katundani', 'kibandaogo', 'kibandaongo', 'kwale', 'kinango',
|
||||||
|
'kidzuvini', 'kalalani', 'kafuduni', 'kaloleni', 'kilibole', 'lutsangani', 'peku', 'gona', 'guro', 'gandini', 'mkanyeni', 'myenzeni',
|
||||||
|
'miyenzeni', 'miatsiani', 'mienzeni', 'mnyenzeni', 'minyenzeni', 'miyani', 'mioleni', 'makuluni', 'mariakani', 'makobeni', 'madewani',
|
||||||
|
'mwangaraba', 'mwashanga', 'miloeni', 'mabesheni', 'mazeras', 'mazera', 'mlola', 'muugano', 'mulunguni', 'mabesheni', 'miatsani',
|
||||||
|
'miatsiani', 'mwache', 'mwangani', 'mwehavikonje', 'miguneni', 'nzora', 'nzovuni', 'vikinduni', 'vikolani', 'vitangani', 'viogato',
|
||||||
|
'vyogato', 'vistangani', 'yapha', 'yava', 'yowani', 'ziwani', 'majengo', 'matuga', 'vigungani', 'vidziweni', 'vinyunduni', 'ukunda',
|
||||||
|
'kokotoni', 'mikindani']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Foo Token', symbol: 'FOO', address: '0x9ceD86089f7aBB5A97B40eb0E7521e7aa308d354', supply: '1000000000000000001014',
|
name: 'Misc Nairobi',
|
||||||
decimals: '18', reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '1000000000000000001014'}},
|
locations: ['nairobi', 'west', 'lindi', 'kibera', 'kibira', 'kibra', 'makina', 'soweto', 'olympic', 'kangemi', 'ruiru', 'congo',
|
||||||
reserveRatio: '1000000', owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
'kawangware', 'kwangware', 'donholm', 'dagoreti', 'dandora', 'kabete', 'sinai', 'donhom', 'donholm', 'huruma', 'kitengela',
|
||||||
|
'makadara', ',mlolongo', 'kenyatta', 'mlolongo', 'tassia', 'tasia', 'gatina', '56', 'industrial', 'kariobangi', 'kasarani', 'kayole',
|
||||||
|
'mathare', 'pipe', 'juja', 'uchumi', 'jogoo', 'umoja', 'thika', 'kikuyu', 'stadium', 'buru buru', 'ngong', 'starehe', 'mwiki',
|
||||||
|
'fuata', 'kware', 'kabiro', 'embakassi', 'embakasi', 'kmoja', 'east', 'githurai', 'landi', 'langata', 'limuru', 'mathere',
|
||||||
|
'dagoretti', 'kirembe', 'muugano', 'mwiki', 'toi market']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'testb', symbol: 'tstb', address: '0xC63cFA91A3BFf41cE31Ff436f67D3ACBC977DB95', supply: '99000', decimals: '18',
|
name: 'Misc Mombasa',
|
||||||
reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '99000'}}, reserveRatio: '1000000',
|
locations: ['mombasa', 'likoni', 'bangla', 'bangladesh', 'kizingo', 'old town', 'makupa', 'mvita', 'ngombeni', 'ngómbeni', 'ombeni',
|
||||||
owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
'magongo', 'miritini', 'changamwe', 'jomvu', 'ohuru', 'tudor', 'diani']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'testa', symbol: 'tsta', address: '0x8fA4101ef19D0a078239d035659e92b278bD083C', supply: '9981', decimals: '18',
|
name: 'Kisauni',
|
||||||
reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '9981'}}, reserveRatio: '1000000',
|
locations: ['bamburi', 'kisauni', 'mworoni', 'nyali', 'shanzu', 'bombolulu', 'mtopanga', 'mjambere', 'majaoni', 'manyani', 'magogoni',
|
||||||
owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
'junda', 'mwakirunge', 'mshomoroni']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'testc', symbol: 'tstc', address: '0x4A6fA6bc3BfE4C9661bC692D9798425350C9e3D4', supply: '100990', decimals: '18',
|
name: 'Kilifi',
|
||||||
reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '100990'}}, reserveRatio: '1000000',
|
locations: ['kilfi', 'kilifi', 'mtwapa', 'takaungu', 'makongeni', 'mnarani', 'mnarani', 'office', 'g.e', 'ge', 'raibai', 'ribe']
|
||||||
owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
},
|
||||||
|
{
|
||||||
|
name: 'Kakuma',
|
||||||
|
locations: ['kakuma']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Kitui',
|
||||||
|
locations: ['kitui', 'mwingi']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Nyanza',
|
||||||
|
locations: ['busia', 'nyalgunga', 'mbita', 'siaya', 'kisumu', 'nyalenda', 'hawinga', 'rangala', 'uyoma', 'mumias', 'homabay', 'homaboy',
|
||||||
|
'migori', 'kusumu']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Misc Rural Counties',
|
||||||
|
locations: ['makueni', 'meru', 'kisii', 'bomet', 'machakos', 'bungoma', 'eldoret', 'kakamega', 'kericho', 'kajiado', 'nandi', 'nyeri',
|
||||||
|
'wote', 'kiambu', 'mwea', 'nakuru', 'narok']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'other',
|
||||||
|
locations: ['other', 'none', 'unknown']
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/** A mock of curated area types. */
|
||||||
|
const areaTypes: Array<AreaType> = [
|
||||||
|
{
|
||||||
|
name: 'urban',
|
||||||
|
area: ['urban', 'nairobi', 'mombasa']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'rural',
|
||||||
|
area: ['rural', 'kakuma', 'kwale', 'kinango', 'kitui', 'nyanza']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'periurban',
|
||||||
|
area: ['kilifi', 'periurban']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'other',
|
||||||
|
area: ['other']
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
/** A mock of the user's business categories */
|
||||||
const categories: Array<Category> = [
|
const categories: Array<Category> = [
|
||||||
{
|
{
|
||||||
name: 'system',
|
name: 'system',
|
||||||
@ -147,96 +211,60 @@ const categories: Array<Category> = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const areaNames: Array<AreaName> = [
|
/** A mock of curated genders */
|
||||||
{
|
|
||||||
name: 'Mukuru Nairobi',
|
|
||||||
locations: ['kayaba', 'kayba', 'kambi', 'mukuru', 'masai', 'hazina', 'south', 'tetra', 'tetrapak', 'ruben', 'rueben', 'kingston',
|
|
||||||
'korokocho', 'kingstone', 'kamongo', 'lungalunga', 'sinai', 'sigei', 'lungu', 'lunga lunga', 'owino road', 'seigei']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Kinango Kwale',
|
|
||||||
locations: ['amani', 'bofu', 'chibuga', 'chikomani', 'chilongoni', 'chigojoni', 'chinguluni', 'chigato', 'chigale', 'chikole',
|
|
||||||
'chilongoni', 'chilumani', 'chigojoni', 'chikomani', 'chizini', 'chikomeni', 'chidzuvini', 'chidzivuni', 'chikuyu', 'chizingo',
|
|
||||||
'doti', 'dzugwe', 'dzivani', 'dzovuni', 'hanje', 'kasemeni', 'katundani', 'kibandaogo', 'kibandaongo', 'kwale', 'kinango',
|
|
||||||
'kidzuvini', 'kalalani', 'kafuduni', 'kaloleni', 'kilibole', 'lutsangani', 'peku', 'gona', 'guro', 'gandini', 'mkanyeni', 'myenzeni',
|
|
||||||
'miyenzeni', 'miatsiani', 'mienzeni', 'mnyenzeni', 'minyenzeni', 'miyani', 'mioleni', 'makuluni', 'mariakani', 'makobeni', 'madewani',
|
|
||||||
'mwangaraba', 'mwashanga', 'miloeni', 'mabesheni', 'mazeras', 'mazera', 'mlola', 'muugano', 'mulunguni', 'mabesheni', 'miatsani',
|
|
||||||
'miatsiani', 'mwache', 'mwangani', 'mwehavikonje', 'miguneni', 'nzora', 'nzovuni', 'vikinduni', 'vikolani', 'vitangani', 'viogato',
|
|
||||||
'vyogato', 'vistangani', 'yapha', 'yava', 'yowani', 'ziwani', 'majengo', 'matuga', 'vigungani', 'vidziweni', 'vinyunduni', 'ukunda',
|
|
||||||
'kokotoni', 'mikindani']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Misc Nairobi',
|
|
||||||
locations: ['nairobi', 'west', 'lindi', 'kibera', 'kibira', 'kibra', 'makina', 'soweto', 'olympic', 'kangemi', 'ruiru', 'congo',
|
|
||||||
'kawangware', 'kwangware', 'donholm', 'dagoreti', 'dandora', 'kabete', 'sinai', 'donhom', 'donholm', 'huruma', 'kitengela',
|
|
||||||
'makadara', ',mlolongo', 'kenyatta', 'mlolongo', 'tassia', 'tasia', 'gatina', '56', 'industrial', 'kariobangi', 'kasarani', 'kayole',
|
|
||||||
'mathare', 'pipe', 'juja', 'uchumi', 'jogoo', 'umoja', 'thika', 'kikuyu', 'stadium', 'buru buru', 'ngong', 'starehe', 'mwiki',
|
|
||||||
'fuata', 'kware', 'kabiro', 'embakassi', 'embakasi', 'kmoja', 'east', 'githurai', 'landi', 'langata', 'limuru', 'mathere',
|
|
||||||
'dagoretti', 'kirembe', 'muugano', 'mwiki', 'toi market']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Misc Mombasa',
|
|
||||||
locations: ['mombasa', 'likoni', 'bangla', 'bangladesh', 'kizingo', 'old town', 'makupa', 'mvita', 'ngombeni', 'ngómbeni', 'ombeni',
|
|
||||||
'magongo', 'miritini', 'changamwe', 'jomvu', 'ohuru', 'tudor', 'diani']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Kisauni',
|
|
||||||
locations: ['bamburi', 'kisauni', 'mworoni', 'nyali', 'shanzu', 'bombolulu', 'mtopanga', 'mjambere', 'majaoni', 'manyani', 'magogoni',
|
|
||||||
'junda', 'mwakirunge', 'mshomoroni']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Kilifi',
|
|
||||||
locations: ['kilfi', 'kilifi', 'mtwapa', 'takaungu', 'makongeni', 'mnarani', 'mnarani', 'office', 'g.e', 'ge', 'raibai', 'ribe']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Kakuma',
|
|
||||||
locations: ['kakuma']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Kitui',
|
|
||||||
locations: ['kitui', 'mwingi']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Nyanza',
|
|
||||||
locations: ['busia', 'nyalgunga', 'mbita', 'siaya', 'kisumu', 'nyalenda', 'hawinga', 'rangala', 'uyoma', 'mumias', 'homabay', 'homaboy',
|
|
||||||
'migori', 'kusumu']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Misc Rural Counties',
|
|
||||||
locations: ['makueni', 'meru', 'kisii', 'bomet', 'machakos', 'bungoma', 'eldoret', 'kakamega', 'kericho', 'kajiado', 'nandi', 'nyeri',
|
|
||||||
'wote', 'kiambu', 'mwea', 'nakuru', 'narok']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'other',
|
|
||||||
locations: ['other', 'none', 'unknown']
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
const areaTypes: Array<AreaType> = [
|
|
||||||
{
|
|
||||||
name: 'urban',
|
|
||||||
area: ['urban', 'nairobi', 'mombasa']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'rural',
|
|
||||||
area: ['rural', 'kakuma', 'kwale', 'kinango', 'kitui', 'nyanza']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'periurban',
|
|
||||||
area: ['kilifi', 'periurban']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'other',
|
|
||||||
area: ['other']
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
const accountTypes: Array<string> = ['user', 'cashier', 'vendor', 'tokenagent', 'group'];
|
|
||||||
const transactionTypes: Array<string> = ['transactions', 'conversions', 'disbursements', 'rewards', 'reclamation'];
|
|
||||||
const genders: Array<string> = ['male', 'female', 'other'];
|
const genders: Array<string> = ['male', 'female', 'other'];
|
||||||
|
|
||||||
|
/** A mock of the tokens in the system. */
|
||||||
|
const tokens: Array<Token> = [
|
||||||
|
{
|
||||||
|
name: 'Giftable Reserve', symbol: 'GRZ', address: '0xa686005CE37Dce7738436256982C3903f2E4ea8E', supply: '1000000001000000000000000000',
|
||||||
|
decimals: '18', reserves: {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Demo Token', symbol: 'DEMO', address: '0xc80D6aFF8194114c52AEcD84c9f15fd5c8abb187', supply: '99999999999999998976',
|
||||||
|
decimals: '18', reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '99999999999999998976'}},
|
||||||
|
reserveRatio: '1000000', owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Foo Token', symbol: 'FOO', address: '0x9ceD86089f7aBB5A97B40eb0E7521e7aa308d354', supply: '1000000000000000001014',
|
||||||
|
decimals: '18', reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '1000000000000000001014'}},
|
||||||
|
reserveRatio: '1000000', owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'testb', symbol: 'tstb', address: '0xC63cFA91A3BFf41cE31Ff436f67D3ACBC977DB95', supply: '99000', decimals: '18',
|
||||||
|
reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '99000'}}, reserveRatio: '1000000',
|
||||||
|
owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'testa', symbol: 'tsta', address: '0x8fA4101ef19D0a078239d035659e92b278bD083C', supply: '9981', decimals: '18',
|
||||||
|
reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '9981'}}, reserveRatio: '1000000',
|
||||||
|
owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'testc', symbol: 'tstc', address: '0x4A6fA6bc3BfE4C9661bC692D9798425350C9e3D4', supply: '100990', decimals: '18',
|
||||||
|
reserves: {'0xa686005CE37Dce7738436256982C3903f2E4ea8E': {weight: '1000000', balance: '100990'}}, reserveRatio: '1000000',
|
||||||
|
owner: '0x3Da99AAD2D9CA01D131eFc3B17444b832B31Ff4a'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
/** A mock of curated transaction types. */
|
||||||
|
const transactionTypes: Array<string> = ['transactions', 'conversions', 'disbursements', 'rewards', 'reclamation'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Intercepts HTTP requests and handles some specified requests internally.
|
||||||
|
* Provides a backend that can handle requests for certain data items.
|
||||||
|
*
|
||||||
|
* @implements HttpInterceptor
|
||||||
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MockBackendInterceptor implements HttpInterceptor {
|
export class MockBackendInterceptor implements HttpInterceptor {
|
||||||
|
/**
|
||||||
|
* Intercepts HTTP requests.
|
||||||
|
*
|
||||||
|
* @param request - An outgoing HTTP request with an optional typed body.
|
||||||
|
* @param next - The next HTTP handler or the outgoing request dispatcher.
|
||||||
|
* @returns The response from the resolved request.
|
||||||
|
*/
|
||||||
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
||||||
const { url, method, headers, body } = request;
|
const { url, method, headers, body } = request;
|
||||||
|
|
||||||
@ -248,22 +276,17 @@ export class MockBackendInterceptor implements HttpInterceptor {
|
|||||||
.pipe(delay(500))
|
.pipe(delay(500))
|
||||||
.pipe(dematerialize());
|
.pipe(dematerialize());
|
||||||
|
|
||||||
|
/** Forward requests from select routes to their internal handlers. */
|
||||||
function handleRoute(): Observable<any> {
|
function handleRoute(): Observable<any> {
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
case url.endsWith('/accounttypes') && method === 'GET':
|
||||||
|
return getAccountTypes();
|
||||||
case url.endsWith('/actions') && method === 'GET':
|
case url.endsWith('/actions') && method === 'GET':
|
||||||
return getActions();
|
return getActions();
|
||||||
case url.match(/\/actions\/\d+$/) && method === 'GET':
|
case url.match(/\/actions\/\d+$/) && method === 'GET':
|
||||||
return getActionById();
|
return getActionById();
|
||||||
case url.match(/\/actions\/\d+$/) && method === 'POST':
|
case url.match(/\/actions\/\d+$/) && method === 'POST':
|
||||||
return approveAction();
|
return approveAction();
|
||||||
case url.endsWith('/tokens') && method === 'GET':
|
|
||||||
return getTokens();
|
|
||||||
case url.match(/\/tokens\/\w+$/) && method === 'GET':
|
|
||||||
return getTokenBySymbol();
|
|
||||||
case url.endsWith('/categories') && method === 'GET':
|
|
||||||
return getCategories();
|
|
||||||
case url.match(/\/categories\/\w+$/) && method === 'GET':
|
|
||||||
return getCategoryByProduct();
|
|
||||||
case url.endsWith('/areanames') && method === 'GET':
|
case url.endsWith('/areanames') && method === 'GET':
|
||||||
return getAreaNames();
|
return getAreaNames();
|
||||||
case url.match(/\/areanames\/\w+$/) && method === 'GET':
|
case url.match(/\/areanames\/\w+$/) && method === 'GET':
|
||||||
@ -272,12 +295,18 @@ export class MockBackendInterceptor implements HttpInterceptor {
|
|||||||
return getAreaTypes();
|
return getAreaTypes();
|
||||||
case url.match(/\/areatypes\/\w+$/) && method === 'GET':
|
case url.match(/\/areatypes\/\w+$/) && method === 'GET':
|
||||||
return getAreaTypeByArea();
|
return getAreaTypeByArea();
|
||||||
case url.endsWith('/accounttypes') && method === 'GET':
|
case url.endsWith('/categories') && method === 'GET':
|
||||||
return getAccountTypes();
|
return getCategories();
|
||||||
case url.endsWith('/transactiontypes') && method === 'GET':
|
case url.match(/\/categories\/\w+$/) && method === 'GET':
|
||||||
return getTransactionTypes();
|
return getCategoryByProduct();
|
||||||
case url.endsWith('/genders') && method === 'GET':
|
case url.endsWith('/genders') && method === 'GET':
|
||||||
return getGenders();
|
return getGenders();
|
||||||
|
case url.endsWith('/tokens') && method === 'GET':
|
||||||
|
return getTokens();
|
||||||
|
case url.match(/\/tokens\/\w+$/) && method === 'GET':
|
||||||
|
return getTokenBySymbol();
|
||||||
|
case url.endsWith('/transactiontypes') && method === 'GET':
|
||||||
|
return getTransactionTypes();
|
||||||
default:
|
default:
|
||||||
// pass through any requests not handled above
|
// pass through any requests not handled above
|
||||||
return next.handle(request);
|
return next.handle(request);
|
||||||
@ -286,15 +315,6 @@ export class MockBackendInterceptor implements HttpInterceptor {
|
|||||||
|
|
||||||
// route functions
|
// route functions
|
||||||
|
|
||||||
function getActions(): Observable<HttpResponse<any>> {
|
|
||||||
return ok(actions);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getActionById(): Observable<HttpResponse<any>> {
|
|
||||||
const queriedAction: Action = actions.find(action => action.id === idFromUrl());
|
|
||||||
return ok(queriedAction);
|
|
||||||
}
|
|
||||||
|
|
||||||
function approveAction(): Observable<HttpResponse<any>> {
|
function approveAction(): Observable<HttpResponse<any>> {
|
||||||
const queriedAction: Action = actions.find(action => action.id === idFromUrl());
|
const queriedAction: Action = actions.find(action => action.id === idFromUrl());
|
||||||
queriedAction.approval = body.approval;
|
queriedAction.approval = body.approval;
|
||||||
@ -302,23 +322,17 @@ export class MockBackendInterceptor implements HttpInterceptor {
|
|||||||
return ok(message);
|
return ok(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTokens(): Observable<HttpResponse<any>> {
|
function getAccountTypes(): Observable<HttpResponse<any>> {
|
||||||
return ok(tokens);
|
return ok(accountTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTokenBySymbol(): Observable<HttpResponse<any>> {
|
function getActions(): Observable<HttpResponse<any>> {
|
||||||
const queriedToken: Token = tokens.find(token => token.symbol === stringFromUrl());
|
return ok(actions);
|
||||||
return ok(queriedToken);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCategories(): Observable<HttpResponse<any>> {
|
function getActionById(): Observable<HttpResponse<any>> {
|
||||||
const categoryList: Array<string> = categories.map(category => category.name);
|
const queriedAction: Action = actions.find(action => action.id === idFromUrl());
|
||||||
return ok(categoryList);
|
return ok(queriedAction);
|
||||||
}
|
|
||||||
|
|
||||||
function getCategoryByProduct(): Observable<HttpResponse<any>> {
|
|
||||||
const queriedCategory: Category = categories.find(category => category.products.includes(stringFromUrl()));
|
|
||||||
return ok(queriedCategory.name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAreaNames(): Observable<HttpResponse<any>> {
|
function getAreaNames(): Observable<HttpResponse<any>> {
|
||||||
@ -341,24 +355,35 @@ export class MockBackendInterceptor implements HttpInterceptor {
|
|||||||
return ok(queriedAreaType.name);
|
return ok(queriedAreaType.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAccountTypes(): Observable<HttpResponse<any>> {
|
function getCategories(): Observable<HttpResponse<any>> {
|
||||||
return ok(accountTypes);
|
const categoryList: Array<string> = categories.map(category => category.name);
|
||||||
|
return ok(categoryList);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTransactionTypes(): Observable<HttpResponse<any>> {
|
function getCategoryByProduct(): Observable<HttpResponse<any>> {
|
||||||
return ok(transactionTypes);
|
const queriedCategory: Category = categories.find(category => category.products.includes(stringFromUrl()));
|
||||||
|
return ok(queriedCategory.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGenders(): Observable<HttpResponse<any>> {
|
function getGenders(): Observable<HttpResponse<any>> {
|
||||||
return ok(genders);
|
return ok(genders);
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper functions
|
function getTokens(): Observable<HttpResponse<any>> {
|
||||||
|
return ok(tokens);
|
||||||
function ok(responseBody: any): Observable<HttpResponse<any>> {
|
|
||||||
return of(new HttpResponse({ status: 200, body: responseBody }));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTokenBySymbol(): Observable<HttpResponse<any>> {
|
||||||
|
const queriedToken: Token = tokens.find(token => token.symbol === stringFromUrl());
|
||||||
|
return ok(queriedToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTransactionTypes(): Observable<HttpResponse<any>> {
|
||||||
|
return ok(transactionTypes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// helper functions
|
||||||
|
|
||||||
function error(message): Observable<any> {
|
function error(message): Observable<any> {
|
||||||
return throwError({ status: 400, error: { message } });
|
return throwError({ status: 400, error: { message } });
|
||||||
}
|
}
|
||||||
@ -368,6 +393,10 @@ export class MockBackendInterceptor implements HttpInterceptor {
|
|||||||
return parseInt(urlParts[urlParts.length - 1], 10);
|
return parseInt(urlParts[urlParts.length - 1], 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ok(responseBody: any): Observable<HttpResponse<any>> {
|
||||||
|
return of(new HttpResponse({ status: 200, body: responseBody }));
|
||||||
|
}
|
||||||
|
|
||||||
function stringFromUrl(): string {
|
function stringFromUrl(): string {
|
||||||
const urlParts: Array<string> = url.split('/');
|
const urlParts: Array<string> = url.split('/');
|
||||||
return urlParts[urlParts.length - 1];
|
return urlParts[urlParts.length - 1];
|
||||||
@ -375,6 +404,11 @@ export class MockBackendInterceptor implements HttpInterceptor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exports the MockBackendInterceptor as an Angular provider.
|
||||||
|
*
|
||||||
|
* @exports
|
||||||
|
*/
|
||||||
export const MockBackendProvider = {
|
export const MockBackendProvider = {
|
||||||
provide: HTTP_INTERCEPTORS,
|
provide: HTTP_INTERCEPTORS,
|
||||||
useClass: MockBackendInterceptor,
|
useClass: MockBackendInterceptor,
|
||||||
|
@ -1,8 +1,15 @@
|
|||||||
|
/** An object defining the properties of the data read. */
|
||||||
const objCsv: { size: number, dataFile: any } = {
|
const objCsv: { size: number, dataFile: any } = {
|
||||||
size: 0,
|
size: 0,
|
||||||
dataFile: []
|
dataFile: []
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads a csv file and converts it to an array.
|
||||||
|
*
|
||||||
|
* @param input - The file to be read.
|
||||||
|
* @returns An array of the read data.
|
||||||
|
*/
|
||||||
function readCsv(input: any): Array<any> | void {
|
function readCsv(input: any): Array<any> | void {
|
||||||
if (input.files && input.files[0]) {
|
if (input.files && input.files[0]) {
|
||||||
const reader: FileReader = new FileReader();
|
const reader: FileReader = new FileReader();
|
||||||
@ -15,6 +22,12 @@ function readCsv(input: any): Array<any> | void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses data to CSV format.
|
||||||
|
*
|
||||||
|
* @param data - The data to be parsed.
|
||||||
|
* @returns An array of the parsed data.
|
||||||
|
*/
|
||||||
function parseData(data: any): Array<any> {
|
function parseData(data: any): Array<any> {
|
||||||
const csvData: Array<any> = [];
|
const csvData: Array<any> = [];
|
||||||
const lineBreak: Array<any> = data.split('\n');
|
const lineBreak: Array<any> = data.split('\n');
|
||||||
@ -25,6 +38,7 @@ function parseData(data: any): Array<any> {
|
|||||||
return csvData;
|
return csvData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @exports */
|
||||||
export {
|
export {
|
||||||
readCsv
|
readCsv
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
|
// Third party imports
|
||||||
import { validatePerson, validateVcard } from 'cic-schemas-data-validator';
|
import { validatePerson, validateVcard } from 'cic-schemas-data-validator';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates a person object against the defined Person schema.
|
||||||
|
*
|
||||||
|
* @param person - A person object to be validated.
|
||||||
|
*/
|
||||||
async function personValidation(person: any): Promise<void> {
|
async function personValidation(person: any): Promise<void> {
|
||||||
const personValidationErrors: any = await validatePerson(person);
|
const personValidationErrors: any = await validatePerson(person);
|
||||||
|
|
||||||
@ -8,6 +14,11 @@ async function personValidation(person: any): Promise<void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates a vcard object against the defined Vcard schema.
|
||||||
|
*
|
||||||
|
* @param vcard - A vcard object to be validated.
|
||||||
|
*/
|
||||||
async function vcardValidation(vcard: any): Promise<void> {
|
async function vcardValidation(vcard: any): Promise<void> {
|
||||||
const vcardValidationErrors: any = await validateVcard(vcard);
|
const vcardValidationErrors: any = await validateVcard(vcard);
|
||||||
|
|
||||||
@ -16,6 +27,7 @@ async function vcardValidation(vcard: any): Promise<void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @exports */
|
||||||
export {
|
export {
|
||||||
personValidation,
|
personValidation,
|
||||||
vcardValidation,
|
vcardValidation,
|
||||||
|
Loading…
Reference in New Issue
Block a user