# e5core-angular-services

> e5 Anywhere Angular Services

Latest version **1.2.2** (published 2019-02-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install e5core-angular-services
pnpm add e5core-angular-services
yarn add e5core-angular-services
bun add e5core-angular-services
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2019-02-07 |
| First published | 2018-08-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.8 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | e5 Workflow Inc |
| Maintainers | devashi, e5grant, e5peter, e5rumi |
| Keywords | e5, e5 Workflow, Angular, e5 Anywhere, Services |

## Links

- npm: https://www.npmjs.com/package/e5core-angular-services
- npm.io page: https://npm.io/package/e5core-angular-services

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^1.9.0

## Recent versions

- 1.2.2 (latest) — 2019-02-07
- 1.2.0 — 2019-01-25
- 1.1.13 — 2019-01-21
- 1.1.12 — 2018-12-18
- 1.1.11 — 2018-11-23
- 1.1.10 — 2018-11-23
- 1.1.9 — 2018-11-15
- 1.1.8 — 2018-11-07
- 1.1.6 — 2018-08-13
- 1.1.5 — 2018-08-13
- 1.1.4 — 2018-08-13
- 1.1.3 — 2018-08-12
- 0.0.2 — 2018-08-10
- 0.0.1 — 2018-08-10
- 1.0.1 — 2018-08-08
- … 1 more at https://npm.io/package/e5core-angular-services/versions

## README

# e5core-angular-services (1.2.1)
Copyright 2018 e5 Workflow Inc

This library implements a group of Angular Services that can be used to access the e5 Workflow e5 Anywhere REST API web services from an Angular Application and componment.

## Quick Start
The following is a simple guide for adding a e5 Anywhere angular services to an existing Angular CLI application. Note that to access the API you will need to authenticate to the REST web service. The authentication method uses which will depend on your environment (see [Authentication]("#authentication")).
1. Install the Library
    ```
    npm install e5core-angular-services --save
    ```
2. Register the default API endpoints in the application module e.g. "app.module.ts".
    ```typescript
    import { E5coreAngularServicesModule } from 'e5core-angular-services' ;
    ...
    @NgModule({
        imports: [ E5coreAngularServicesModule, ... ]
    ```
3. Add the [Authentication](#authentication) method for your environment.
4. Add the e5 Anywhere API endpoint provider to you 'app.module.ts'.
    ```typescript
    import { environment as Environment } from '../environments/environment'
    import { E5ConfigurationService } from 'e5core-angular-services';
    export class EnvConfigurationService extends E5ConfigurationService {
        constructor() {
            super() ;
            this.settings = Environment.e5Configuration
        }
    }
    ...
    @NgModule({
        providers: [
            {
                provide: E5ConfigurationService,
                useClass: EnvConfigurationService
            },
        ...
    ```
5. Add the environment settings to the "environment.ts".
    ```typescript
    export const environment = {
        production: false,
        e5Configuration : {
            env : {
                name : "Simple Configuration"
            },
            apiServer: {
                baseUrl: "http://demo.e5workflow.com:84",
                scope: "test"
            }
        }
    };
    ```
6. Inject the service into your component.
    ```typescript
    import { WorkGetNextService } from 'e5core-angular-services';
    export class GetNextComponent implements OnInit {
        constructor(private service:WorkGetNextService) { }

    ```
7. Call the service in a click handler (for example)
    ```typescript
    getNext() {
        this.service.getNextId().subscribe(
            res => {
                this.id = res.id ;
            }
        )
    }
    ```

## <a name="authentication"></a>Authentication
The e5 Anywhere API REST services can be configured in a number of ways to authenticate a user, and this is depended on what your application and environment are using. For example it could be using Windows Authentication or JWT Tokens.
### Adding Windows Authentication
1. Create a "winAuthInterceptor.ts" class file.
    ```typescript
    import { Injectable } from '@angular/core';
    import { HttpRequest, HttpHandler, HttpInterceptor, HttpEvent } from '@angular/common/http';
    import { Observable } from 'rxjs';

    @Injectable()
    export class WinAuthInterceptor implements HttpInterceptor{
        constructor(){}

        intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
            req = req.clone({
                withCredentials: true
            });
            return next.handle(req);
        }
    }
    ```
2. Add the interceptor to you 'app.module.ts'
    ```typescript
    import { HTTP_INTERCEPTORS } from '@angular/common/http';
    import { WinAuthInterceptor } from './WinAuthInterceptor';
    @NgModule({
        providers: [
            {
            provide: HTTP_INTERCEPTORS,
            useClass: WinAuthInterceptor,
            multi: true
            },
            ...
    })
    ```
## Change Log

Version|Changes
-|-
1.2.2|Work Task APIs : Fixed CSOM Work Task Apis 
1.2.1|Added Work Task APIs : PrescribeTask, UnprescribeTask, CompleteTask,GetPrescribableTasks, GetPrescribedTasks 
1.2.0|Upgrade to Angular 7.0
1.1.13|Added AddEvent function to WorkItem
1.1.12|Added UiDocument service
1.1.11|Changed "WorkWork*" models to jusr "Work*"
1.1.10|Added getWorkRelatedItems and models to WotkItemService
1.1.9|Moved UiListService to ListSearchService and added a prefix "Taxonomy" to the Taxonomy Services.
1.1.8|Added SLA Monitor, Attachment and updated workitem and search definition services.
1.1.7|Inproved type completion on functions and models, added UI WorkItem and and UI SearchDefinition services.
1.1.4|Changed services method optional function parameters into an options typed object. e.g. you can now use ``getFindWorkItem(1, {}, { select: 'Id,Reference' })`` instead of ```getFindWorkItem(1, {}, null, null, null, null, null, null, null, 'Id,Reference' )```.
1.1.6|Fixed a couple of NPM deployment issues.

---
_Source: https://npm.io/package/e5core-angular-services · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
