@stemy/ngx-utils 19.7.20 → 19.7.22

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.
@@ -470,7 +470,11 @@ export interface IProgress {
470
470
  export type ProgressListener = (progress: IProgress) => void;
471
471
  export type CacheExpireMode = boolean | "auth" | Date;
472
472
  export interface IHttpService {
473
- language: ILanguageService;
473
+ readonly language: ILanguageService;
474
+ readonly requestHeaders: Readonly<HttpRequestHeaders>;
475
+ readonly requestParams: Readonly<HttpRequestQuery>;
476
+ setHeader(name: string, value?: string | string[]): void;
477
+ setParam(name: string, value?: any): void;
474
478
  cached(mode: CacheExpireMode): Observable<any>;
475
479
  url(url: string): string;
476
480
  makeListParams(page: number, itemsPerPage: number, orderBy?: string, orderDescending?: boolean, filter?: string): HttpRequestQuery;
@@ -482,8 +486,12 @@ export interface SvgDefinition {
482
486
  }
483
487
  export type SvgSourceModifier = (svg: SVGSVGElement, width: number, height: number) => string;
484
488
  export interface IBaseHttpClient extends HttpClient {
485
- readonly requestHeaders: HttpRequestHeaders;
486
- readonly requestParams: HttpRequestQuery;
489
+ readonly requestHeaders: Readonly<HttpRequestHeaders>;
490
+ readonly requestParams: Readonly<HttpRequestQuery>;
491
+ setHeader(name: string, value?: string | string[]): void;
492
+ getHeader(name: string): string;
493
+ setParam(name: string, value?: any): void;
494
+ makeHeaders(): HttpHeaders;
487
495
  }
488
496
  export interface IApiService extends IHttpService {
489
497
  client: IBaseHttpClient;
@@ -1,7 +1,6 @@
1
1
  import { ChangeDetectorRef, ElementRef, EventEmitter, OnChanges } from "@angular/core";
2
2
  import { ControlValueAccessor } from "@angular/forms";
3
- import { IApiService, IFileUploadProcess, IFileUploadResult, IToasterService, UploadType } from "../../common-types";
4
- import { BaseHttpClient } from "../../services/base-http.client";
3
+ import { IApiService, IBaseHttpClient, IFileUploadProcess, IFileUploadResult, IToasterService, UploadType } from "../../common-types";
5
4
  import { BtnComponent } from "../btn/btn.component";
6
5
  import * as i0 from "@angular/core";
7
6
  export declare class UploadComponent implements ControlValueAccessor, OnChanges {
@@ -31,7 +30,7 @@ export declare class UploadComponent implements ControlValueAccessor, OnChanges
31
30
  protected rootElem: DocumentOrShadowRoot;
32
31
  protected fileImageCache: Map<Blob, string>;
33
32
  protected acceptTypes: string[];
34
- get http(): BaseHttpClient;
33
+ get http(): IBaseHttpClient;
35
34
  get root(): DocumentOrShadowRoot;
36
35
  constructor(cdr: ChangeDetectorRef, element: ElementRef<HTMLElement>, api: IApiService, toaster: IToasterService);
37
36
  onDragEnter(ev: DragEvent): void;
@@ -61,10 +61,10 @@ import { DynamicTableComponent } from "./components/dynamic-table/dynamic-table.
61
61
  import { PaginationMenuComponent } from "./components/pagination-menu/pagination-menu.component";
62
62
  import { UnorderedListComponent } from "./components/unordered-list/unordered-list.component";
63
63
  import { UploadComponent } from "./components/upload/upload.component";
64
- export declare const pipes: (typeof SyncAsyncPipe | typeof FilterPipe | typeof FormatNumberPipe | typeof GlobalTemplatePipe | typeof IncludesPipe | typeof ReducePipe | typeof RoundPipe | typeof SafeHtmlPipe | typeof TranslatePipe)[];
64
+ export declare const pipes: (typeof FilterPipe | typeof FormatNumberPipe | typeof GlobalTemplatePipe | typeof IncludesPipe | typeof ReducePipe | typeof RoundPipe | typeof SafeHtmlPipe | typeof SyncAsyncPipe | typeof TranslatePipe)[];
65
65
  export declare const directives: (typeof AsyncMethodBase | typeof AsyncMethodTargetDirective | typeof BackgroundDirective | typeof ComponentLoaderDirective | typeof DynamicTableTemplateDirective | typeof GlobalTemplateDirective | typeof IconDirective | typeof NgxTemplateOutletDirective | typeof PaginationDirective | typeof PaginationItemDirective | typeof ResourceIfDirective | typeof StickyDirective | typeof StickyClassDirective | typeof DropdownDirective | typeof DropdownContentDirective | typeof TabsItemDirective | typeof UnorderedListItemDirective | typeof UnorderedListTemplateDirective)[];
66
66
  export declare const components: (typeof ChipsComponent | typeof CloseBtnComponent | typeof DropListComponent | typeof DynamicTableComponent | typeof PaginationMenuComponent | typeof UnorderedListComponent | typeof UploadComponent)[];
67
- export declare const providers: (typeof SyncAsyncPipe | typeof UniversalService | typeof StateService | typeof AuthGuard | typeof EventsService | typeof AclService | typeof BaseHttpClient | typeof StorageService | typeof CacheService | typeof BaseHttpService | typeof StaticAuthService | typeof ConfigService | typeof BaseDialogService | typeof ErrorHandlerService | typeof FormatterService | typeof GlobalTemplateService | typeof IconService | typeof StaticLanguageService | typeof OpenApiService | typeof BaseToasterService | typeof ComponentLoaderService | typeof TranslatedUrlSerializer | typeof PromiseService | typeof SocketService | typeof FilterPipe | typeof FormatNumberPipe | typeof GlobalTemplatePipe | typeof IncludesPipe | typeof ReducePipe | typeof RoundPipe | typeof SafeHtmlPipe | typeof TranslatePipe | typeof DeviceDetectorService | {
67
+ export declare const providers: (typeof FilterPipe | typeof FormatNumberPipe | typeof GlobalTemplatePipe | typeof IncludesPipe | typeof ReducePipe | typeof RoundPipe | typeof SafeHtmlPipe | typeof SyncAsyncPipe | typeof TranslatePipe | typeof BaseHttpClient | typeof BaseHttpService | typeof AuthGuard | typeof AclService | typeof StaticAuthService | typeof ConfigService | typeof BaseDialogService | typeof ErrorHandlerService | typeof EventsService | typeof FormatterService | typeof GlobalTemplateService | typeof IconService | typeof StaticLanguageService | typeof OpenApiService | typeof PromiseService | typeof SocketService | typeof StateService | typeof StorageService | typeof BaseToasterService | typeof CacheService | typeof ComponentLoaderService | typeof TranslatedUrlSerializer | typeof UniversalService | typeof DeviceDetectorService | {
68
68
  provide: import("@angular/core").InjectionToken<import("@angular/platform-browser").EventManagerPlugin[]>;
69
69
  useClass: typeof DragDropEventPlugin;
70
70
  multi: boolean;
@@ -1,15 +1,17 @@
1
- import { HttpClient, HttpHandler, HttpHeaders, HttpParams } from "@angular/common/http";
2
- import { HttpRequestHeaders, HttpRequestQuery } from "../common-types";
1
+ import { HttpClient, HttpHandler, HttpHeaders } from "@angular/common/http";
2
+ import { RequestBag } from "./request-bag";
3
+ import { HttpRequestHeaders, HttpRequestQuery, IBaseHttpClient } from "../common-types";
3
4
  import * as i0 from "@angular/core";
4
- export declare class BaseHttpClient extends HttpClient {
5
- requestHeaders: HttpRequestHeaders;
6
- requestParams: HttpRequestQuery;
5
+ export declare class BaseHttpClient extends HttpClient implements IBaseHttpClient {
7
6
  renewTokenFunc: () => void;
8
- protected extraRequestParams: HttpRequestQuery;
7
+ readonly bag: RequestBag;
9
8
  constructor(handler: HttpHandler);
10
- makeHeaders(headers?: HttpRequestHeaders, withCredentials?: boolean): HttpHeaders;
11
- makeParams(params?: HttpRequestQuery): HttpParams;
12
- setExtraRequestParam(name: string, value?: any): void;
9
+ get requestHeaders(): Readonly<HttpRequestHeaders>;
10
+ get requestParams(): Readonly<HttpRequestQuery>;
11
+ setHeader(name: string, value?: string | string[]): void;
12
+ getHeader(name: string): string;
13
+ setParam(name: string, value?: any): void;
14
+ makeHeaders(): HttpHeaders;
13
15
  static ɵfac: i0.ɵɵFactoryDeclaration<BaseHttpClient, never>;
14
16
  static ɵprov: i0.ɵɵInjectableDeclaration<BaseHttpClient>;
15
17
  }
@@ -7,6 +7,7 @@ import { UniversalService } from "./universal.service";
7
7
  import { StorageService } from "./storage.service";
8
8
  import { Observable } from "rxjs";
9
9
  import { CacheService } from "./cache.service";
10
+ import { RequestBag } from "./request-bag";
10
11
  import * as i0 from "@angular/core";
11
12
  export declare class BaseHttpService implements IHttpService {
12
13
  readonly injector: Injector;
@@ -17,15 +18,18 @@ export declare class BaseHttpService implements IHttpService {
17
18
  readonly toaster: IToasterService;
18
19
  readonly configs: IConfigService;
19
20
  readonly request: Request;
20
- protected static failedRequests: Array<() => void>;
21
21
  get name(): string;
22
+ get requestHeaders(): Readonly<HttpRequestHeaders>;
23
+ get requestParams(): Readonly<HttpRequestQuery>;
22
24
  protected get withCredentials(): boolean;
23
- requestHeaders: HttpRequestHeaders;
24
- requestParams: HttpRequestQuery;
25
- protected static retryFailedRequests(): void;
26
25
  get universal(): UniversalService;
26
+ protected static failedRequests: Array<() => void>;
27
+ protected readonly bag: RequestBag;
28
+ protected static retryFailedRequests(): void;
27
29
  constructor(injector: Injector, client: BaseHttpClient, storage: StorageService, caches: CacheService, language: ILanguageService, toaster: IToasterService, configs: IConfigService, request?: Request);
28
30
  protected initService(): void;
31
+ setHeader(name: string, value?: string | string[]): void;
32
+ setParam(name: string, value?: any): void;
29
33
  cached(mode: CacheExpireMode): Observable<any>;
30
34
  url(url: string): string;
31
35
  createUrl(url: string, params: HttpRequestQuery): string;
@@ -0,0 +1,16 @@
1
+ import { HttpHeaders, HttpParams } from "@angular/common/http";
2
+ import { HttpRequestHeaders, HttpRequestQuery } from "../common-types";
3
+ export declare class RequestBag {
4
+ protected source?: RequestBag;
5
+ protected readonly headers: HttpRequestHeaders;
6
+ protected readonly params: HttpRequestQuery;
7
+ get requestHeaders(): Readonly<HttpRequestHeaders>;
8
+ get requestParams(): Readonly<HttpRequestQuery>;
9
+ constructor(source?: RequestBag);
10
+ makeHeaders(headersObj?: HttpRequestHeaders | HttpHeaders, withCredentials?: boolean): HttpHeaders;
11
+ makeParams(paramsObj?: HttpRequestQuery): HttpParams;
12
+ setHeader(name: string, value?: string | string[]): void;
13
+ getHeader(name: string): string;
14
+ setParam(name: string, value?: any): void;
15
+ protected convertHeaders(headers: HttpHeaders): HttpRequestHeaders;
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stemy/ngx-utils",
3
- "version": "19.7.20",
3
+ "version": "19.7.22",
4
4
  "license": "MIT",
5
5
  "public": true,
6
6
  "repository": "https://github.com/stemyke/ngx-utils.git",
package/public_api.d.ts CHANGED
@@ -54,6 +54,7 @@ export { CacheService } from "./ngx-utils/services/cache.service";
54
54
  export { ComponentLoaderService } from "./ngx-utils/services/component-loader.service";
55
55
  export { IUrlDictionary, TranslatedUrlSerializer } from "./ngx-utils/services/translated-url.serializer";
56
56
  export { PromiseService } from "./ngx-utils/services/promise.service";
57
+ export { RequestBag } from "./ngx-utils/services/request-bag";
57
58
  export { SocketService } from "./ngx-utils/services/socket.service";
58
59
  export { DragEventListener } from "./ngx-utils/plugins/drag-drop-handler";
59
60
  export { DragDropEventPlugin } from "./ngx-utils/plugins/drag-drop-event.plugin";