@wertzui/ngx-restworld-client 3.3.0 → 4.1.0

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,5 +1,5 @@
1
1
  import { HttpHeaders, HttpResponse } from '@angular/common/http';
2
- import { FormsResource, HalClient, Link, PagedListResource, Resource, Template } from "@wertzui/ngx-hal-client";
2
+ import { FormsResource, HalClient, Link, PagedListResource, Resource, ResourceDto, Template } from "@wertzui/ngx-hal-client";
3
3
  import { ProblemDetails } from "../models/problem-details";
4
4
  import { RESTworldOptions } from "../models/restworld-options";
5
5
  export declare class RESTworldClient {
@@ -12,8 +12,10 @@ export declare class RESTworldClient {
12
12
  ensureHomeResourceIsSet(): Promise<void>;
13
13
  private getHomeForced;
14
14
  private setDefaultCurie;
15
- getList(rel: string, parameters: {}, headers?: HttpHeaders, curie?: string): Promise<HttpResponse<PagedListResource | ProblemDetails>>;
16
- getListByUri(uri: string, parameters: {}, headers?: HttpHeaders): Promise<HttpResponse<PagedListResource | ProblemDetails>>;
15
+ getList<TListDto extends ResourceDto>(rel: string, parameters: {}, headers?: HttpHeaders, curie?: string): Promise<HttpResponse<PagedListResource<TListDto> | ProblemDetails>>;
16
+ getListByUri<TListDto extends ResourceDto>(uri: string, parameters: {}, headers?: HttpHeaders): Promise<HttpResponse<PagedListResource<TListDto> | ProblemDetails>>;
17
+ getAllPagesFromList<TListDto extends ResourceDto>(rel: string, parameters: {}, headers?: HttpHeaders, curie?: string): Promise<HttpResponse<PagedListResource<TListDto> | ProblemDetails>>;
18
+ getAllPagesFromListByUri<TListDto extends ResourceDto>(uri: string, parameters: {}, headers?: HttpHeaders): Promise<HttpResponse<PagedListResource<TListDto> | ProblemDetails>>;
17
19
  getSingle(relOrUri: string, id?: number, headers?: HttpHeaders, curie?: string): Promise<HttpResponse<Resource | ProblemDetails>>;
18
20
  save(resource: Resource): Promise<HttpResponse<Resource | ProblemDetails>>;
19
21
  getAllForms(resource: Resource): Promise<HttpResponse<FormsResource | ProblemDetails>[]>;
@@ -1,15 +1,36 @@
1
- import { HttpBackend } from "@angular/common/http";
2
1
  import { ClientSettings } from "../models/client-settings";
3
2
  import { RESTworldClientCollection } from "./restworld-client-collection";
4
3
  import * as i0 from "@angular/core";
5
4
  export declare class SettingsService {
6
5
  private _clients;
7
- private readonly _client;
8
- private _settings;
6
+ private static _settings;
9
7
  get settings(): ClientSettings | undefined;
10
- constructor(backend: HttpBackend, _clients: RESTworldClientCollection);
11
- initialize(): Promise<void>;
12
- private ensureSettingsAreLoaded;
8
+ private initializing;
9
+ private initialized;
10
+ constructor(_clients: RESTworldClientCollection);
11
+ ensureInitialized(): Promise<void>;
12
+ /**
13
+ * Call this method in your main.ts before calling bootstrapModule(...)
14
+ *
15
+ * Example:
16
+ * async function main() {
17
+ * try {
18
+ * await SettingsService.ensureSettingsAreLoaded();
19
+ *
20
+ * const providers : StaticProvider[] = [
21
+ * { provide: 'BASE_URL', useFactory: getBaseUrl, deps: [] }
22
+ * ];
23
+ *
24
+ * await platformBrowserDynamic(providers).bootstrapModule(AppModule);
25
+ * }
26
+ * catch (e) {
27
+ * console.error(e);
28
+ * }
29
+ * }
30
+ *
31
+ * main();
32
+ * */
33
+ static ensureSettingsAreLoaded(): Promise<void>;
13
34
  private populateRESTworldClientCollectionFromSettings;
14
35
  static ɵfac: i0.ɵɵFactoryDeclaration<SettingsService, never>;
15
36
  static ɵprov: i0.ɵɵInjectableDeclaration<SettingsService>;
@@ -1,5 +1,4 @@
1
- import { AfterViewInit, OnChanges, OnInit, SimpleChanges } from '@angular/core';
2
- import { PagedListResource, Resource } from '@wertzui/ngx-hal-client';
1
+ import { PagedListResource, Resource, ResourceDto } from '@wertzui/ngx-hal-client';
3
2
  import * as _ from 'lodash';
4
3
  import { ConfirmationService, LazyLoadEvent, MenuItem, MessageService } from 'primeng/api';
5
4
  import { RESTworldClientCollection } from '../../services/restworld-client-collection';
@@ -19,7 +18,7 @@ export interface Column {
19
18
  field: string;
20
19
  type: ColumnType;
21
20
  }
22
- export declare class RESTworldListViewComponent implements AfterViewInit, OnInit, OnChanges {
21
+ export declare class RESTworldListViewComponent<TListDto extends ResourceDto> {
23
22
  private _clients;
24
23
  private _confirmationService;
25
24
  private _messageService;
@@ -44,7 +43,7 @@ export declare class RESTworldListViewComponent implements AfterViewInit, OnInit
44
43
  private _sortOrder;
45
44
  rowsPerPage: number[];
46
45
  createButtonMenu?: MenuItem[];
47
- resource?: PagedListResource;
46
+ resource?: PagedListResource<TListDto>;
48
47
  isLoading: boolean;
49
48
  private _totalRecords;
50
49
  private _lastEvent;
@@ -56,9 +55,6 @@ export declare class RESTworldListViewComponent implements AfterViewInit, OnInit
56
55
  private static _dateFormat;
57
56
  get dateFormat(): string;
58
57
  constructor(_clients: RESTworldClientCollection, _confirmationService: ConfirmationService, _messageService: MessageService, avatarGenerator: AvatarGenerator, _router: Router);
59
- ngOnChanges(changes: SimpleChanges): void;
60
- ngOnInit(): void;
61
- ngAfterViewInit(): Promise<void>;
62
58
  createNew(): Promise<boolean>;
63
59
  private getClient;
64
60
  load: _.DebouncedFunc<(event: LazyLoadEvent) => Promise<void>>;
@@ -77,6 +73,6 @@ export declare class RESTworldListViewComponent implements AfterViewInit, OnInit
77
73
  private createFilterForProperty;
78
74
  private static createODataOperator;
79
75
  private createComparisonValue;
80
- static ɵfac: i0.ɵɵFactoryDeclaration<RESTworldListViewComponent, never>;
81
- static ɵcmp: i0.ɵɵComponentDeclaration<RESTworldListViewComponent, "rw-list", never, { "editLink": "editLink"; "apiName": "apiName"; "rel": "rel"; "sortField": "sortField"; "sortOrder": "sortOrder"; "rowsPerPage": "rowsPerPage"; "createButtonMenu": "createButtonMenu"; }, {}, never, never>;
76
+ static ɵfac: i0.ɵɵFactoryDeclaration<RESTworldListViewComponent<any>, never>;
77
+ static ɵcmp: i0.ɵɵComponentDeclaration<RESTworldListViewComponent<any>, "rw-list", never, { "editLink": "editLink"; "apiName": "apiName"; "rel": "rel"; "sortField": "sortField"; "sortOrder": "sortOrder"; "rowsPerPage": "rowsPerPage"; "createButtonMenu": "createButtonMenu"; }, {}, never, never>;
82
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wertzui/ngx-restworld-client",
3
- "version": "3.3.0",
3
+ "version": "4.1.0",
4
4
  "author": "wertzui",
5
5
  "description": "An Angular client to consume a RESTworld service that serves application/hal+json or hal-forms+json.",
6
6
  "publishConfig": {
@@ -35,7 +35,7 @@
35
35
  "@angular/router": "^13.2.5",
36
36
  "@fortawesome/fontawesome-free": "^6.0.0",
37
37
  "@jdrks/ngx-deep-linking": "^1.0.7",
38
- "@wertzui/ngx-hal-client": "^2.0.1",
38
+ "@wertzui/ngx-hal-client": "^2.1.1",
39
39
  "cldr-dates-modern": "^40.0.0",
40
40
  "cldr-numbers-modern": "^40.0.0",
41
41
  "lodash": "^4.17.21",