# iaudit-core-library

> This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.0.6.

Latest version **17.0.5** (published 2025-08-14) · 0 weekly downloads

## Install

```sh
npm install iaudit-core-library
pnpm add iaudit-core-library
yarn add iaudit-core-library
bun add iaudit-core-library
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 17.0.5 |
| Published | 2025-08-14 |
| First published | 2022-01-21 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 363.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | iaudit |

## Links

- npm: https://www.npmjs.com/package/iaudit-core-library
- npm.io page: https://npm.io/package/iaudit-core-library

## Dependencies (1)

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

## Recent versions

- 17.0.5 (latest) — 2025-08-14
- 17.0.4 — 2025-08-12
- 17.0.3 — 2025-08-11
- 17.0.2 — 2025-08-11
- 17.0.1 — 2025-07-28
- 17.0.0 — 2024-02-07
- 14.0.8 — 2023-05-25
- 14.0.7 — 2023-05-04
- 14.0.6 — 2023-05-04
- 14.0.5 — 2023-05-04
- 14.0.4 — 2023-05-04
- 14.0.3 — 2023-02-08
- 14.0.2 — 2023-02-08
- 14.0.1 — 2023-02-03
- 14.0.0 — 2023-02-03
- … 5 more at https://npm.io/package/iaudit-core-library/versions

## README

# IauditCoreLibrary

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.0.6.


## Code scaffolding

Run `ng generate component component-name --project iaudit-core-library` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project iaudit-core-library`.
> Note: Don't forget to add `--project iaudit-core-library` or else it will be added to the default project in your `angular.json` file. 

## Build

Run `ng build iaudit-core-library` to build the project. The build artifacts will be stored in the `dist/` directory.

## Publishing

After building your library with `ng build iaudit-core-library`, go to the dist folder `cd dist/iaudit-core-library` and run `npm publish`.

## Running unit tests

Run `ng test iaudit-core-library` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.


## Content
Here you will find all the resources available to be used in the application


### [ApplicationService]
Your responsibility is to manager all notifications
> Methods
```sh
notifyUser(user: any): void
notifyTranslate(language: DataValueResponse): void
```
> Variables
```sh
- public userEmmitter: EventEmitter<string> = new EventEmitter(null);
- public translateEmmitter: EventEmitter<DataValueResponse> = new EventEmitter(null);
```

#### [CookieService]
 Your responsibility is to manage custom cookies

> Methods
```sh
get(name: string): any
create(name: string, value: any): void
delete(name: string ): void  
```
#### [CookieUserService]
Your responsability is to manager informations about user
> Methods
```sh
create(response: any): void
delete(): void
getUserInfo(): UserInfo
```

#### [CookieLanguageService]
Your responsability is to manager informations about language

> Methods
```sh
create(language: any): void
delete(): void 
get(): DataValueResponse[]
```

#### [CookieCustomerService]
Your responsability is to manager informations about customer
> Methods
```sh
create(customer: string): void
get(): string
delete(): void
```

#### [AuthenticationService]
Your responsability is to manager life cicle user 
> Methods
```sh
createSession(expiresIn: number): any
tokenExpired(): boolean
login(user: Authentication, apiUrl: string): Observable<any>
logout(): void
change(changePassword: ChangePassword, url: string): Observable<any> 
recover(recover: RecoverPassword, url: string): Observable<any>
isAuthenticated()
```
> Types
```sh
export enum UserType {
    External = 1,
    Internal = 2
  }

  export enum GmtType {
    Application,
    User
  }
 ``` 

#### [CustomTranslateService]
Your responsibility is to configure '@ngx-translate/core' and allow the language to be changed.

> Methods
```shsh
setup(codes: string[]): void
use(code: string): void
```

## Share
This section is more important, here we have mandatory and other optional features to be used in the applications.

#### [BaseComponent]
Your responsibility is to share resources with all angular components. To use it will be necessary to inherit this class
> Methods
```sh
ngOnInit(): void
translate(key: string): string
translateButtonPagination(): void
getActives(): void 
onEditorChangeValue(owner: any): void
updateLocate(code: string = null): void
ngAfterViewInit(): void
validateField(form: FormGroup, field: string, error: string = 'required'): boolean
openModal(modalId: string): void
closeModal(modalId: string): void
split(text: string, character: string): string[]
activeTab(tabId: string): void
getFormValidationErrors(form: FormGroup): void
getTabKey(form: FormGroup): string
private findInput(key: string): string
protected getCookieUser(): string 
protected getGmt(who: GmtType)
protected setTimeZone(date: Date, gmt: number): Date
public setCookieUser(cookieUserName: string): void
mustMatch(controlName: string, matchingControlName: string)
```

#### [Tabs - SmartAdmin]
```sh
<ul class="nav nav-pills nav-justified" role="tablist">
    <li class="nav-item"><a class="nav-link active" data-toggle="tab"  name='js_change_pill_justified-1' href="#js_change_pill_justified-1">{{'context.report.create.tabs.tab01' | translate}}</a>
    </li>
    <li class="nav-item"><a class="nav-link" data-toggle="tab"  name='js_change_pill_justified-2' href="#js_change_pill_justified-2">{{'context.report.create.tabs.tab02' | translate}}</a>
    </li>
<ul>

<div class="tab-content py-3">
    <div class="tab-pane fade show active" id="js_change_pill_justified-1" role="tabpanel">
    <div class="row">  
    <div class="col-lg-3">
      <div class="form-group">
        <label class="control-label">{{'context.report.create.denounced.function' | translate}}</label>
        <div class="input-group bg-white shadow-inset-2">                      
          <input [readonly]="isReadOnlyReportData" type="text" class="form-control" formControlName="Function" id="Function" tab="js_change_pill_justified-1">
        </div>
        <span *ngIf="validateField(denouncedForm,'Function')" class="text-danger help-block"><strong>
          {{'messages.requiredfield' | translate}}
        </strong> </span>
      </div>
    </div>                       
    </div>                    
    <div class="tab-pane fade" id="js_change_pill_justified-2" role="tabpanel">
       <div class="row">  
    <div class="col-lg-3">
      <div class="form-group">
        <label class="control-label">{{'context.report.create.denounced.LastNanme' | translate}}</label>
        <div class="input-group bg-white shadow-inset-2">                      
          <input [readonly]="isReadOnlyReportData" type="text" class="form-control" formControlName="LastName" id="LastName" tab="js_change_pill_justified-2">
        </div>
        <span *ngIf="validateField(denouncedForm,'LastName')" class="text-danger help-block"><strong>
          {{'messages.requiredfield' | translate}}
        </strong> </span>
      </div>
    </div>
</div>

Obs. play attention on id inputs property and tab property.

if (!this.form.valid) {
      const tab = this.getTabKey(this.form);
      this.activeTab(tab); 
      this.form.markAllAsTouched();
      this.message.fire({
        icon: 'error',
        title: this.translate('messages.dialogs.title'),
        text: this.translate('messages.dialogs.required'),
        footer: ''
      });
      return;
    }

Case want show specific tab use this this.activeTab('js_change_pill_justified-2')

#### [Models]
Here we are have some generics models to use in application
> class

```sh
export class DataResponse {
    public success = false;
}

export class DataValueResponse {
    constructor(
        public Id: any = null,
        public Name: string = null,
        public Code: string = null
    ) { }
}

export class Dropdown extends DataResponse {
    constructor(
        public data: DataValueResponse[] = null
    ) {
        super();
    }
}
```

> Public variables


```sh
declare var $: any;
defineLocale('pt-br', ptBrLocale);
config: NgSelectConfig;
authenticationService: AuthenticationService;
applicationService: ApplicationService;
cookieLanguageService: CookieLanguageService;
cookieUserService: CookieUserService;
cookieService: CookieService;
customTranslateService: CustomTranslateService;
crosscutService: CrosscutService;
localeService: BsLocaleService;
subscription: Subscription;
route: ActivatedRoute;
router: Router;
fb: FormBuilder;
form: FormGroup;
nameMask: any = null;
maskType: any = null;
placeholderMask: any = null;
errors: any[] = [];
message = Swal;
@ViewChild('editor') editor: { dataChange: { subscribe: (arg0: (value: string) => void) => void; }; };
locales: string[];
page = 1;
pageBefore = '';
pageNext = '';
modalId = '';
isSearch = false;
canDelete = false;
maxDate: Date = new Date();
currentlanguage: DataValueResponse;
actives = new Array<DataValueResponse>();
element: ElementRef;
spinner: NgxSpinnerService;
gmt: number;
```

#### [Required Module]
Your responsibility is to share all visual and non-visual components for each application module.

> Exports
```sh
imports: [
    CommonModule,
    FormsModule,
    ReactiveFormsModule,
    RouterModule,
    HttpClientModule,
    NgxPaginationModule,
    NgxCurrencyModule,
    NgxMaskModule.forRoot(options),
    BsDatepickerModule.forRoot(),
    NgSelectModule,
    NgxDropzoneModule,
    TranslateModule,
    NgxSpinnerModule
  ],
declarations: [
    IauditDataFilterPipe
  ],
exports: [
    CommonModule,
    FormsModule,
    ReactiveFormsModule,
    RouterModule,
    HttpClientModule,
    NgxPaginationModule,
    NgxCurrencyModule,
    NgxMaskModule,
    BsDatepickerModule,
    NgSelectModule,
    CKEditorModule,
    NgxDropzoneModule,
    TranslateModule,
    IauditDataFilterPipe
  ]
  
Obs.  IauditDataFilterPipe it is a pipe, to use is necessary call per your name
@Pipe({
  name: 'iauditdatafilter',
  pure: false
})
Exemple as use this pipe

<tbody>
                                  <tr class="d-flex"
                                  *ngFor="let item of customers | paginate: { itemsPerPage: 20, currentPage: page, id:'pgCustomer' } | iauditdatafilter: {'Name': searchInput}">

```

#### [BaseService]
Your responsibility is to share resources about calls with api.
> Methods
```sh
protected translate(key: string): string
protected getHeaderJson(): { headers: HttpHeaders; } 
protected getHeaderFormDataWithoutContent():
protected getHeaderFormData(name: string): { headers: HttpHeaders; }
protected getAuthHeaderJson(): { headers: HttpHeaders; }
protected getUserToken(): string
protected extractData(response: any): any
protected serviceError(error: Response | any): Observable<never>
protected getGmt(who: GmtType)
protected setTimeZone(date: Date, gmt: number): Date
protected getCookieUser(): string
public setUrl(urlApi: string): void
public setCookieUser(cookieUserName: string): void
```

#### [CrosscutService]
Your responsibility is not to provide adequate abstractions to modularize.
> Methods
```sh
newGuid(): string
nullGuid(): string 
getYesNo(): DataValueResponse[]
getCountries(): DataValueResponse[]
```

#### [CryptoRSAService]
Your responsibility is to encrypt plain-text data using a provided RSA public key (RSA‑OAEP with SHA‑256)
>Methods
```sh
encrypt(publicKey: string): Promise<string>
````
>Variables
```sh
- private publicKey?: CryptoKey
```

>Injection
```sh
// in your AppModule (or wherever you configure providers)
providers: [
  { 
    provide: RSA_PUBLIC_KEY, 
    useValue: '-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkq…\n-----END PUBLIC KEY-----' 
  }
```

>Usage
```sh
constructor(private cryptoRSA: CryptoRSAService) {}

async sendSecure() {
  const cipherText = await this.cryptoRSA.encrypt('confidential text');
  console.log(cipherText); // encrypted in Base64
}
```

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