ngx-lift 1.7.3 → 1.9.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.
@@ -0,0 +1,28 @@
1
+ export interface KubernetesObjectCondition {
2
+ /**
3
+ * lastTransitionTime is a string representing the last time the condition transitioned from one status to another.
4
+ * If the underlying condition change is unknown, the time when the API field changed is used.
5
+ */
6
+ lastTransitionTime: string;
7
+ /**
8
+ * message is a string providing a human - readable message about the transition. It can be an empty string.
9
+ */
10
+ message: string;
11
+ /**
12
+ * reason is a string containing a programmatic identifier indicating the reason for the condition's last transition.
13
+ * Producers of specific condition types may define expected values and meanings for this field.
14
+ */
15
+ reason: string;
16
+ /**
17
+ * status is an enum with possible values 'True', 'False', or 'Unknown' representing the current status of the condition.
18
+ */
19
+ status: 'True' | 'False' | 'Unknown';
20
+ /**
21
+ * type is a string representing the type of condition in CamelCase or in foo.example.com/CamelCase format.
22
+ */
23
+ type: string;
24
+ /**
25
+ * observedGeneration is an integer representing the.metadata.generation that the condition was set based upon.
26
+ */
27
+ observedGeneration?: number;
28
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#objectmeta-v1-meta
3
+ */
4
+ export interface KubernetesObjectMetaV1 {
5
+ name: string;
6
+ namespace?: string;
7
+ selfLink?: string;
8
+ uid?: string;
9
+ resourceVersion?: string;
10
+ generation?: number;
11
+ creationTimestamp?: string;
12
+ deletionTimestamp?: string;
13
+ deletionGracePeriodSeconds?: number;
14
+ labels?: Record<string, string>;
15
+ annotations?: Record<string, string>;
16
+ ownerReferences?: OwnerReference[];
17
+ finalizers?: string[];
18
+ clusterName?: string;
19
+ managedFields?: ManagedField[];
20
+ }
21
+ interface OwnerReference {
22
+ apiVersion: string;
23
+ kind: string;
24
+ name: string;
25
+ uid: string;
26
+ controller: boolean;
27
+ blockOwnerDeletion?: boolean;
28
+ }
29
+ interface ManagedField {
30
+ apiVersion: string;
31
+ fieldsType: string;
32
+ fieldsV1: Record<string, unknown>;
33
+ manager: string;
34
+ operation: string;
35
+ subresource?: string;
36
+ time: string;
37
+ }
38
+ export {};
@@ -0,0 +1,8 @@
1
+ import { KubernetesObjectMetaV1 } from './kubernetes-object-meta.model';
2
+ export interface KubernetesObject {
3
+ apiVersion: string;
4
+ kind: string;
5
+ metadata: KubernetesObjectMetaV1;
6
+ spec?: any;
7
+ status?: any;
8
+ }
@@ -45,5 +45,20 @@ import { AsyncState } from '../models/async-state.model';
45
45
  * ))
46
46
  * )
47
47
  *
48
+ * Usage 3: provide initialValue
49
+ *
50
+ * import {createAsyncState} from 'ngx-lift';
51
+ * import {noop} from 'rxjs';
52
+ *
53
+ * private userService = inject(UserService);
54
+ * private location = inject(Location);
55
+ *
56
+ * userState$ = this.userService
57
+ * .getUserById(1)
58
+ * .pipe(createAsyncState<User>(noop, {loading: false, error: null, data: this.location.getState()}));
48
59
  */
49
- export declare function createAsyncState<T, E = HttpErrorResponse>(observerOrNextForOrigin?: Partial<TapObserver<T>> | ((value: T) => void)): UnaryFunction<Observable<T>, Observable<AsyncState<T, E>>>;
60
+ export declare function createAsyncState<T, E = HttpErrorResponse>(observerOrNextForOrigin?: Partial<TapObserver<T>> | ((value: T) => void), initialValue?: {
61
+ loading: boolean;
62
+ error: E | null;
63
+ data: T | null;
64
+ }): UnaryFunction<Observable<T>, Observable<AsyncState<T, E>>>;
@@ -1,6 +1,7 @@
1
1
  export * from './combine-latest-eager.operator';
2
2
  export * from './create-async-state.operator';
3
3
  export * from './distinct-on-change.operator';
4
+ export * from './kubernetes-pagination.operator';
4
5
  export * from './logger.operator';
5
6
  export * from './poll.operator';
6
7
  export * from './start-with-tap.operator';
@@ -0,0 +1,30 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { Observable, OperatorFunction } from 'rxjs';
3
+ import { KubernetesList, KubernetesObject } from '../models';
4
+ /**
5
+ * Fetches paginated Kubernetes resources by continually making requests
6
+ * until all pages have been retrieved, and aggregates the items from all pages
7
+ * into a single KubernetesList.
8
+ *
9
+ * @template T The type of the items contained within the KubernetesList.
10
+ * @param http The HttpClient instance used to make the HTTP requests.
11
+ * @param endpoint The API endpoint to fetch the resources from.
12
+ * @param initialParams Optional initial parameters to include in the request.
13
+ * Can include query parameters like filters and pagination settings.
14
+ * `limit` and `continue` parameters are parameters for kubernetes
15
+ * @returns An observable that emits a single KubernetesList containing all items from all pages.
16
+ */
17
+ export declare function aggregatePaginatedKubernetesResources<T extends KubernetesObject>(http: HttpClient, endpoint: string, initialParams?: Record<string, string | number | boolean | (string | number | boolean)[]>): OperatorFunction<KubernetesList<T>, KubernetesList<T>>;
18
+ /**
19
+ * Fetches paginated Kubernetes resources by continually making requests
20
+ * until all pages have been retrieved.
21
+ *
22
+ * @template T The type of the items contained within the KubernetesList.
23
+ * @param http The HttpClient instance used to make the HTTP requests.
24
+ * @param endpoint The API endpoint to fetch the resources from.
25
+ * @param initialParams Optional initial parameters to include in the request.
26
+ * Can include query parameters like filters and pagination settings.
27
+ * `limit` and `continue` parameters are parameters for kubernetes
28
+ * @returns An observable that emits a single KubernetesList containing all items from all pages.
29
+ */
30
+ export declare function fetchPaginatedKubernetesResources<T extends KubernetesObject>(http: HttpClient, endpoint: string, initialParams?: Record<string, string | number | boolean | (string | number | boolean)[]>): Observable<KubernetesList<T>>;
@@ -9,8 +9,8 @@ import { AsyncState } from '../models';
9
9
  * @param {object} options - The configuration options for polling.
10
10
  * @param {number} options.interval - The interval in milliseconds between each poll.
11
11
  * @param {(params: any) => Observable<Data> | Data} options.pollingFn - A function that returns an Observable, Promise, or primitive value.
12
- * @param {Observable<Input> | Signal<Input>} [options.trigger] - An optional Observable or Signal that triggers a manual poll.
13
- * @param {(input: Input) => any} [options.paramsBuilder] - An optional function that builds parameters for the polling function based on the input. The value emitted by the trigger observable will serve as the parameter.
12
+ * @param {Observable<Input> | Signal<Input>} [options.forceRefresh] - An optional Observable or Signal that triggers a manual refresh of the polling function.
13
+ * @param {(input: Input) => any} [options.paramsBuilder] - An optional function that builds parameters for the polling function based on the input. The value emitted by the forceRefresh observable will serve as the parameter.
14
14
  * @returns {Observable<AsyncState<Data>>} An Observable emitting objects representing the state of the asynchronous operation.
15
15
  */
16
16
  export declare function poll<Data>(options: {
@@ -20,11 +20,11 @@ export declare function poll<Data>(options: {
20
20
  export declare function poll<Data, Input>(options: {
21
21
  interval: number;
22
22
  pollingFn: (params: Input) => Observable<Data> | Promise<Data> | Data;
23
- trigger: Observable<Input> | Signal<Input>;
23
+ forceRefresh: Observable<Input> | Signal<Input>;
24
24
  }): Observable<AsyncState<Data>>;
25
25
  export declare function poll<Data, Input>(options: {
26
26
  interval: number;
27
27
  pollingFn: (params: any) => Observable<Data> | Promise<Data> | Data;
28
- trigger: Observable<Input> | Signal<Input>;
28
+ forceRefresh: Observable<Input> | Signal<Input>;
29
29
  paramsBuilder: (input: Input) => any;
30
30
  }): Observable<AsyncState<Data>>;
@@ -56,8 +56,11 @@ export declare class IdleDetectionService {
56
56
  startWatching(): void;
57
57
  /**
58
58
  * Resets the idle timer when user activity is detected.
59
+ * @param withCountdownReset - Flag to indicate if countdown should be reset.
60
+ * By default, it only reset the idle-detection timer. If you enter the countdown phase, it won't stop the countdown.
61
+ * Pass true when you want to reset the countdown as well. This is useful when you click "Keep Me Signed In" button in cll-idle-detection component
59
62
  */
60
- resetTimer(): void;
63
+ resetTimer(withCountdownReset?: boolean): void;
61
64
  /**
62
65
  * Sets up the interruption events that will end the idle detection.
63
66
  * Listens to a set of events on the document (e.g. click, keydown, mousemove, etc.).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-lift",
3
- "version": "1.7.3",
3
+ "version": "1.9.0",
4
4
  "description": "A project has been crafted with the goal of enhancing and simplifying your Angular development experience.",
5
5
  "author": "Guanghui Wang <guanghui-wang@foxmail.com>",
6
6
  "peerDependencies": {