@rosoftlab/core 1.0.5-alpha-5 → 1.0.5-alpha-6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,16 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+ import type { UserManagerSettings } from 'oidc-client-ts';
1
3
  import { UserManager } from 'oidc-client-ts';
4
+ import { Observable } from 'rxjs';
2
5
  import * as i0 from "@angular/core";
3
6
  export declare class AuthService {
4
7
  private manager;
8
+ private http;
9
+ private guestSettings?;
5
10
  private _authNavStatusSource;
6
- authNavStatus$: import("rxjs").Observable<boolean>;
11
+ authNavStatus$: Observable<boolean>;
7
12
  private user;
8
- constructor(manager: UserManager);
13
+ constructor(manager: UserManager, http: HttpClient, guestSettings?: UserManagerSettings);
9
14
  login(): void;
10
15
  logout(): void;
11
16
  completeAuthentication(): Promise<void>;
@@ -24,6 +29,7 @@ export declare class AuthService {
24
29
  get organisationId(): string;
25
30
  get organisationName(): string;
26
31
  signout(): Promise<void>;
27
- static ɵfac: i0.ɵɵFactoryDeclaration<AuthService, never>;
32
+ loginWithGuest(): Promise<void>;
33
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthService, [null, null, { optional: true; }]>;
28
34
  static ɵprov: i0.ɵɵInjectableDeclaration<AuthService>;
29
35
  }
@@ -1,3 +1,3 @@
1
1
  import { Provider } from '@angular/core';
2
2
  import type { UserManagerSettings } from 'oidc-client-ts';
3
- export declare function provideAuth(settings: UserManagerSettings): Provider[];
3
+ export declare function provideAuth(settings: UserManagerSettings, guest_settings?: UserManagerSettings): Provider[];
@@ -3,3 +3,4 @@ export declare class Tokens {
3
3
  import { InjectionToken } from '@angular/core';
4
4
  import type { UserManagerSettings } from 'oidc-client-ts';
5
5
  export declare const OIDC_CLIENT_SETTINGS: InjectionToken<UserManagerSettings>;
6
+ export declare const OIDC_GUEST_CLIENT_SETTINGS: InjectionToken<UserManagerSettings>;
package/lib/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export * from './interfaces/datastore-config.interface';
10
10
  export * from './interfaces/model-config.interface';
11
11
  export * from './interfaces/overrides.interface';
12
12
  export * from './interfaces/property-converter.interface';
13
+ export * from './services/datastore-port';
13
14
  export * from './models/base-meta.model';
14
15
  export * from './models/base-query-data';
15
16
  export * from './models/base.model';
@@ -24,3 +25,4 @@ export * from './rsl-base-module';
24
25
  export * from './services/base.service';
25
26
  export * from './services/local-file.service';
26
27
  export * from './validators/pattern-validator';
28
+ export * from './tokens/datastore-token';
@@ -1,17 +1,11 @@
1
- import { HttpHeaders } from '@angular/common/http';
2
1
  import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
3
- import { Observable } from 'rxjs';
4
2
  import { ModelConfig } from '../interfaces/model-config.interface';
5
- import { BaseDatastore, ModelType } from '../services/base-datastore.service';
3
+ import type { ModelType } from '../services/datastore-port';
6
4
  export declare class BaseModel {
7
- protected _datastore: BaseDatastore;
8
5
  highlighted: boolean;
9
6
  id: any;
10
7
  [key: string]: any;
11
- constructor(_datastore: BaseDatastore, data?: any);
12
- save(params?: any, headers?: HttpHeaders, customUrl?: string, customBody?: any): Observable<this>;
13
- patch(origModel: this, params?: any, headers?: HttpHeaders, customUrl?: string): Observable<this>;
14
- replace(params?: any, headers?: HttpHeaders, customUrl?: string, customBody?: any): Observable<this>;
8
+ constructor(data?: any);
15
9
  get attributeMetadata(): any;
16
10
  set attributeMetadata(val: any);
17
11
  get hasDirtyAttributes(): boolean;
@@ -26,6 +20,5 @@ export declare class BaseModel {
26
20
  getFromGroup(fb: UntypedFormBuilder): UntypedFormGroup;
27
21
  private getSubFromGroup;
28
22
  getModelFromFormGroup(formGroup: UntypedFormGroup, id?: any): void;
29
- getSerializedModel(): any;
30
23
  getCellClass(property: string): string;
31
24
  }
@@ -4,9 +4,9 @@ import { DatastoreConfig } from '../interfaces/datastore-config.interface';
4
4
  import { BaseQueryData } from '../models/base-query-data';
5
5
  import { BaseModel } from '../models/base.model';
6
6
  import { CacheService } from './cache.service';
7
+ import type { DatastorePort, ModelType } from './datastore-port';
7
8
  import * as i0 from "@angular/core";
8
- export type ModelType<T extends BaseModel> = new (datastore: BaseDatastore, data: any) => T;
9
- export declare class BaseDatastore {
9
+ export declare class BaseDatastore implements DatastorePort {
10
10
  protected httpClient: HttpClient;
11
11
  protected cacheService: CacheService;
12
12
  protected config: DatastoreConfig;
@@ -24,7 +24,7 @@ export declare class BaseDatastore {
24
24
  patchCustom<U, T extends BaseModel>(modelType: ModelType<T>, body: any, params?: any, headers?: HttpHeaders, customUrl?: string): Observable<U>;
25
25
  createRecord<T extends BaseModel>(modelType: ModelType<T>, data?: any): T;
26
26
  saveRecord<T extends BaseModel>(attributesMetadata: any, model: T, params?: any, headers?: HttpHeaders, customUrl?: string, customBody?: any): Observable<T>;
27
- patchRecord<T extends BaseModel>(attributesMetadata: any, model: T, origModel: T, params?: any, headers?: HttpHeaders, customUrl?: string): Observable<T>;
27
+ patchRecord<T extends BaseModel>(attributesMetadata: any, model: T, origModel?: T, params?: any, headers?: HttpHeaders, customUrl?: string): Observable<T>;
28
28
  replaceRecord<T extends BaseModel>(attributesMetadata: any, model: T, params?: any, headers?: HttpHeaders, customUrl?: string, customBody?: any): Observable<T>;
29
29
  deleteRecord<T extends BaseModel>(modelType: ModelType<T>, id: string, headers?: HttpHeaders, customUrl?: string): Observable<{}>;
30
30
  buildUrl<T extends BaseModel>(modelType: ModelType<T>, customUrl?: string): string;
@@ -36,6 +36,7 @@ export declare class BaseDatastore {
36
36
  get datastoreConfig(): DatastoreConfig;
37
37
  protected transformSerializedNamesToPropertyNames<T extends BaseModel>(modelType: ModelType<T>, attributes: any): any;
38
38
  protected getModelPropertyNames(model: BaseModel): any;
39
+ protected getApiFieldMap<T extends BaseModel>(modelType: ModelType<T>): Record<string, string> | null;
39
40
  buildHeaders(customHeaders?: HttpHeaders): HttpHeaders;
40
41
  buildParams<T extends BaseModel>(modelType: ModelType<T>, params: any): HttpParams;
41
42
  protected entityToModel<T extends BaseModel>(res: any, modelType: ModelType<T>, model?: T): T;
@@ -3,12 +3,12 @@ import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
3
3
  import { Observable } from 'rxjs';
4
4
  import { BaseQueryData } from '../models/base-query-data';
5
5
  import { BaseModel } from '../models/base.model';
6
- import { BaseDatastore, ModelType } from './base-datastore.service';
6
+ import type { DatastorePort, ModelType } from './datastore-port';
7
7
  import * as i0 from "@angular/core";
8
8
  export declare class BaseService<T extends BaseModel> {
9
- datastore: BaseDatastore;
9
+ datastore: DatastorePort;
10
10
  modelType: ModelType<T>;
11
- constructor(datastore: BaseDatastore);
11
+ constructor(datastore: DatastorePort);
12
12
  setModelType(modelType: ModelType<T>): void;
13
13
  get(id?: any, customInclude?: string): Observable<T>;
14
14
  getAll(page: number, pageSize: number, sort?: string, filters?: string, customInclude?: string): Observable<BaseQueryData<T>>;
@@ -17,10 +17,11 @@ export declare class BaseService<T extends BaseModel> {
17
17
  postCustom<U>(body: any, params?: any, headers?: HttpHeaders, customUrl?: string): Observable<U>;
18
18
  patchCustom<U>(body: any, params?: any, headers?: HttpHeaders, customUrl?: string): Observable<U>;
19
19
  save(docTypeOrFormGroup: T | UntypedFormGroup, id?: any, origModel?: T): Observable<T>;
20
- patch(docTypeOrFormGroup: T | UntypedFormGroup, origModel: T, id?: any): Observable<T>;
20
+ patch(docTypeOrFormGroup: T | UntypedFormGroup, origModel?: T, id?: any): Observable<T>;
21
21
  newModel(data?: any): T;
22
22
  toFormGroup(fb: UntypedFormBuilder, fromModel?: T): UntypedFormGroup;
23
23
  fromFormGroup(formGroup: UntypedFormGroup, id?: any): T;
24
+ serializeModel(model: T): any;
24
25
  getSelectValues(property: string): Observable<any[]>;
25
26
  static ɵfac: i0.ɵɵFactoryDeclaration<BaseService<any>, never>;
26
27
  static ɵprov: i0.ɵɵInjectableDeclaration<BaseService<any>>;
@@ -0,0 +1,19 @@
1
+ import type { HttpHeaders } from '@angular/common/http';
2
+ import type { Observable } from 'rxjs';
3
+ import type { BaseQueryData } from '../models/base-query-data';
4
+ import type { BaseModel } from '../models/base.model';
5
+ export type ModelType<T extends BaseModel> = new (data: any) => T;
6
+ export interface DatastorePort {
7
+ findAll<T extends BaseModel>(modelType: ModelType<T>, params?: any, headers?: HttpHeaders, customUrl?: string): Observable<BaseQueryData<T>>;
8
+ findRecord<T extends BaseModel>(modelType: ModelType<T>, id?: string, params?: any, headers?: HttpHeaders, customUrl?: string): Observable<T>;
9
+ getCustom<U, T extends BaseModel>(modelType: ModelType<T>, params?: any, headers?: HttpHeaders, customUrl?: string, customResponseType?: any): Observable<U>;
10
+ postCustom<U, T extends BaseModel>(modelType: ModelType<T>, body: any, params?: any, headers?: HttpHeaders, customUrl?: string): Observable<U>;
11
+ patchCustom<U, T extends BaseModel>(modelType: ModelType<T>, body: any, params?: any, headers?: HttpHeaders, customUrl?: string): Observable<U>;
12
+ createRecord<T extends BaseModel>(modelType: ModelType<T>, data?: any): T;
13
+ saveRecord<T extends BaseModel>(attributesMetadata: any, model: T, params?: any, headers?: HttpHeaders, customUrl?: string, customBody?: any): Observable<T>;
14
+ patchRecord<T extends BaseModel>(attributesMetadata: any, model: T, origModel?: T, params?: any, headers?: HttpHeaders, customUrl?: string): Observable<T>;
15
+ replaceRecord<T extends BaseModel>(attributesMetadata: any, model: T, params?: any, headers?: HttpHeaders, customUrl?: string, customBody?: any): Observable<T>;
16
+ deleteRecord<T extends BaseModel>(modelType: ModelType<T>, id: string, headers?: HttpHeaders, customUrl?: string): Observable<{}>;
17
+ buildUrl<T extends BaseModel>(modelType: ModelType<T>, customUrl?: string): string;
18
+ modelToEntity<T extends BaseModel>(model: T, attributesMetadata: any, allAttributes?: boolean): any;
19
+ }
@@ -1,9 +1,9 @@
1
- import { DatastoreCore } from '../core';
1
+ import type { DatastorePort } from './datastore-port';
2
2
  import { Employee } from '../models';
3
3
  import { BaseService } from './base.service';
4
4
  import * as i0 from "@angular/core";
5
5
  export declare class EmployeeService extends BaseService<Employee> {
6
- constructor(datastore: DatastoreCore);
6
+ constructor(datastore: DatastorePort);
7
7
  static ɵfac: i0.ɵɵFactoryDeclaration<EmployeeService, never>;
8
8
  static ɵprov: i0.ɵɵInjectableDeclaration<EmployeeService>;
9
9
  }
@@ -1,8 +1,9 @@
1
- import { DatastoreCore, Right } from '../core';
1
+ import type { DatastorePort } from './datastore-port';
2
+ import { Right } from '../core';
2
3
  import { BaseService } from './base.service';
3
4
  import * as i0 from "@angular/core";
4
5
  export declare class RightService extends BaseService<Right> {
5
- constructor(datastore: DatastoreCore);
6
+ constructor(datastore: DatastorePort);
6
7
  static ɵfac: i0.ɵɵFactoryDeclaration<RightService, never>;
7
8
  static ɵprov: i0.ɵɵInjectableDeclaration<RightService>;
8
9
  }
@@ -1,10 +1,11 @@
1
1
  import { Observable } from 'rxjs';
2
- import { DatastoreCore, Right } from '../core';
2
+ import type { DatastorePort } from './datastore-port';
3
+ import { Right } from '../core';
3
4
  import { Role } from '../models/role';
4
5
  import { BaseService } from './base.service';
5
6
  import * as i0 from "@angular/core";
6
7
  export declare class RoleService extends BaseService<Role> {
7
- constructor(datastore: DatastoreCore);
8
+ constructor(datastore: DatastorePort);
8
9
  getRoleRights(roleId: string): Observable<Right[]>;
9
10
  static ɵfac: i0.ɵɵFactoryDeclaration<RoleService, never>;
10
11
  static ɵprov: i0.ɵɵInjectableDeclaration<RoleService>;
@@ -1,9 +1,10 @@
1
1
  import { Observable } from 'rxjs';
2
- import { BaseQueryData, BaseService, DatastoreCore, Menu, Right, User } from '../core';
2
+ import { BaseQueryData, BaseService, Menu, Right, User } from '../core';
3
+ import type { DatastorePort } from './datastore-port';
3
4
  import * as i0 from "@angular/core";
4
5
  export declare class UserService extends BaseService<User> {
5
6
  userRights: Right[];
6
- constructor(datastore: DatastoreCore);
7
+ constructor(datastore: DatastorePort);
7
8
  getRights(): Observable<BaseQueryData<Right>>;
8
9
  hasRightForLink(link: string): boolean;
9
10
  getMenus(): Observable<BaseQueryData<Menu>>;
@@ -0,0 +1,3 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import type { DatastorePort } from '../services/datastore-port';
3
+ export declare const DATASTORE_PORT: InjectionToken<DatastorePort>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rosoftlab/core",
3
- "version": "1.0.5-alpha-5",
3
+ "version": "1.0.5-alpha-6",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^19.2.8",
6
6
  "@angular/core": "^19.2.8",