@codex-ts/core-lib 1.1.5 → 2.0.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.
- package/README.md +362 -33
- package/fesm2022/codex-ts-core-lib.mjs +4357 -2708
- package/fesm2022/codex-ts-core-lib.mjs.map +1 -1
- package/lib/components/base-form.component.d.ts +3 -4
- package/lib/components/base-page.component.d.ts +2 -1
- package/lib/components/base-tabbed-form.component.d.ts +3 -4
- package/lib/components/base-table.component.d.ts +1 -0
- package/lib/components/base-task-dashboard.component.d.ts +21 -15
- package/lib/components/base-task-details.component.d.ts +4 -5
- package/lib/components/formly/field.interface.d.ts +34 -0
- package/lib/components/formly/form-field.wrapper.d.ts +6 -6
- package/lib/components/formly/formly.constants.d.ts +1 -0
- package/lib/components/formly/primeng-formly.module.d.ts +19 -0
- package/lib/components/formly/types/file-upload.type.d.ts +58 -0
- package/lib/components/formly/types/radio.type.d.ts +5 -0
- package/lib/components/formly/types/text-input.type.d.ts +10 -1
- package/lib/components/keycloak-error-banner/keycloak-error-page.component.d.ts +6 -0
- package/lib/components/not-found/not-found.component.d.ts +11 -0
- package/lib/components/unauthorized/unauthorized.component.d.ts +12 -0
- package/lib/keycloak/keycloak-service.token.d.ts +3 -0
- package/lib/keycloak/keycloak.guard.d.ts +1 -1
- package/lib/keycloak/keycloak.interface.d.ts +21 -0
- package/lib/keycloak/keycloak.service.d.ts +24 -3
- package/lib/models/base-task.model.d.ts +6 -4
- package/lib/models/base.comment.model.d.ts +5 -0
- package/lib/models/base.entity.model.d.ts +39 -0
- package/lib/models/base.model.d.ts +0 -44
- package/lib/models/department.interface.d.ts +4 -0
- package/lib/models/pagination/filter-criteria.interface.d.ts +3 -0
- package/lib/models/pagination/table-column-datatype.enum.d.ts +6 -0
- package/lib/models/reference-dto.interface.d.ts +5 -0
- package/lib/models/workflow.model.d.ts +27 -0
- package/lib/services/base-entity.service.d.ts +80 -0
- package/lib/services/base-error.service.d.ts +24 -0
- package/lib/services/base-task.service.d.ts +21 -19
- package/lib/services/entity-registry.service.d.ts +21 -0
- package/lib/services/entity-service.interface.d.ts +22 -0
- package/lib/services/form.service.d.ts +7 -8
- package/lib/services/http-utility.service.d.ts +18 -0
- package/lib/services/master-data-service.interface.d.ts +5 -0
- package/lib/services/task-entity-service.interface.d.ts +24 -0
- package/lib/validators/common-validators.d.ts +61 -0
- package/lib/workflow-engine/workflow-engine-api.service.d.ts +104 -0
- package/lib/workflow-engine/workflow-engine.models.d.ts +236 -0
- package/package.json +2 -2
- package/public-api.d.ts +53 -33
- package/lib/services/base-crud.service.d.ts +0 -36
- package/lib/services/entity.service.d.ts +0 -9
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseEntity } from './base.entity.model';
|
|
2
|
+
import { BaseComment } from './base.comment.model';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Models `io.codex.library.core.task.WorkflowDto`, which paired with
|
|
5
|
+
* `microservice-starter-lib`'s Spring-State-Machine-based `BaseWorkflowController`. That
|
|
6
|
+
* controller was deleted (see `WORKFLOW_ENGINE_MIGRATION.md`) in favor of `workflow-engine-lib`,
|
|
7
|
+
* a completely different engine with its own REST API and its own Angular client — see
|
|
8
|
+
* `WorkflowTask`/`WorkflowInstance`/`WorkflowEngineApiService` in `workflow-engine/`. Nothing in
|
|
9
|
+
* this codebase serves the endpoints this interface's shape assumes; kept only for source
|
|
10
|
+
* compatibility with any existing consumer, not as a working feature.
|
|
11
|
+
*/
|
|
12
|
+
export interface Workflow<S = string, C = BaseComment> extends BaseEntity {
|
|
13
|
+
status: S;
|
|
14
|
+
comments: C[];
|
|
15
|
+
currentAssignee: string;
|
|
16
|
+
currentAssigneeName: string;
|
|
17
|
+
currentDepartment: string;
|
|
18
|
+
currentSegment: string;
|
|
19
|
+
previousAssignee: string;
|
|
20
|
+
previousAssigneeName: string;
|
|
21
|
+
statusChangedDate: Date;
|
|
22
|
+
statusChangedBy: string;
|
|
23
|
+
workflowType: string;
|
|
24
|
+
currentWorkflowStep: string;
|
|
25
|
+
workflowVersion: number;
|
|
26
|
+
requiresApproval: boolean;
|
|
27
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { HttpUtilityService } from './http-utility.service';
|
|
3
|
+
import { UtilsService } from './utils.service';
|
|
4
|
+
import { MessageService } from 'primeng/api';
|
|
5
|
+
import { Page } from '../models/pagination/page.interface';
|
|
6
|
+
import { PageRequest } from '../models/pagination/page-request.interface';
|
|
7
|
+
import { EntityService } from './entity-service.interface';
|
|
8
|
+
import { ReferenceDto } from '../models/reference-dto.interface';
|
|
9
|
+
import { BaseModel } from '../models/base.model';
|
|
10
|
+
export declare abstract class BaseEntityService<T extends BaseModel> implements EntityService<T> {
|
|
11
|
+
protected httpUtility: HttpUtilityService;
|
|
12
|
+
protected utilsService: UtilsService;
|
|
13
|
+
protected resourcePath: string;
|
|
14
|
+
protected backendBaseUrl: string;
|
|
15
|
+
protected messageService: MessageService | undefined;
|
|
16
|
+
get loading$(): Observable<boolean>;
|
|
17
|
+
protected apiUrl: string;
|
|
18
|
+
/**
|
|
19
|
+
* Creates an instance of BaseCrudService.
|
|
20
|
+
* @param httpUtility - Service for making HTTP requests
|
|
21
|
+
* @param utilsService - Utility service for common operations
|
|
22
|
+
* @param resourcePath - API resource path (e.g., 'customers', 'products')
|
|
23
|
+
* @param backendBaseUrl - Base URL for the backend API
|
|
24
|
+
* @param messageService - Optional service for showing messages
|
|
25
|
+
*/
|
|
26
|
+
protected constructor(httpUtility: HttpUtilityService, utilsService: UtilsService, resourcePath: string, backendBaseUrl: string, messageService: MessageService | undefined);
|
|
27
|
+
/**
|
|
28
|
+
* Find entities by createdBy with pagination using PageRequest and filters.
|
|
29
|
+
* POST /page with { ...pageRequest, filters: [{ field: 'createdBy', value: createdBy }] }
|
|
30
|
+
*/
|
|
31
|
+
findByCreatedBy(createdBy: string, pageRequest?: PageRequest): Observable<Page<T>>;
|
|
32
|
+
/**
|
|
33
|
+
* Get all entities with pagination.
|
|
34
|
+
* POST /page with pageRequest
|
|
35
|
+
*/
|
|
36
|
+
getAll(pageRequest?: PageRequest): Observable<Page<T>>;
|
|
37
|
+
/**
|
|
38
|
+
* Joins URL parts ensuring no double slashes
|
|
39
|
+
*/
|
|
40
|
+
private joinUrls;
|
|
41
|
+
getById(uuid: string): Observable<T>;
|
|
42
|
+
create(entity: Omit<T, 'uuid'>): Observable<T>;
|
|
43
|
+
update(uuid: string, entity: Omit<T, 'uuid'>): Observable<T>;
|
|
44
|
+
delete(uuid: string): Observable<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Get all entities without pagination.
|
|
47
|
+
* GET /
|
|
48
|
+
*/
|
|
49
|
+
findAll(): Observable<T[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Get detailed entity information by UUID.
|
|
52
|
+
* GET /{uuid}/detailed
|
|
53
|
+
*/
|
|
54
|
+
findDetailedByUuid(uuid: string): Observable<T>;
|
|
55
|
+
/**
|
|
56
|
+
* Partially update an entity with the specified field values.
|
|
57
|
+
* PATCH /{uuid}
|
|
58
|
+
*/
|
|
59
|
+
patch(uuid: string, updates: Partial<T>): Observable<T>;
|
|
60
|
+
/**
|
|
61
|
+
* Get all entities as reference data.
|
|
62
|
+
* GET /reference
|
|
63
|
+
*/
|
|
64
|
+
findAllReference(): Observable<ReferenceDto[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Get paginated reference data.
|
|
67
|
+
* POST /reference/page
|
|
68
|
+
*/
|
|
69
|
+
findAllReferencePaginated(pageRequest?: PageRequest): Observable<Page<ReferenceDto>>;
|
|
70
|
+
/**
|
|
71
|
+
* Get all entities with filters (non-paginated).
|
|
72
|
+
* GET /search?field=value&...
|
|
73
|
+
*/
|
|
74
|
+
findAllWithFilters(filters: Record<string, string>): Observable<T[]>;
|
|
75
|
+
/**
|
|
76
|
+
* Get a single entity by filters (non-paginated).
|
|
77
|
+
* GET /search-one?field=value&...
|
|
78
|
+
*/
|
|
79
|
+
findOneWithFilters(filters: Record<string, string>): Observable<T | null>;
|
|
80
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { InjectionToken, Signal } from '@angular/core';
|
|
2
|
+
import { HttpErrorResponse } from '@angular/common/http';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export interface ErrorState {
|
|
5
|
+
type: string;
|
|
6
|
+
message: string;
|
|
7
|
+
code?: string | number;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
export declare class BaseErrorService {
|
|
11
|
+
private readonly _error;
|
|
12
|
+
private readonly router;
|
|
13
|
+
private readonly messageService;
|
|
14
|
+
get error(): Signal<ErrorState | null>;
|
|
15
|
+
/**
|
|
16
|
+
* Handle HTTP and other errors in the application
|
|
17
|
+
*/
|
|
18
|
+
handleError(error: HttpErrorResponse | Error): void;
|
|
19
|
+
setError(error: ErrorState): void;
|
|
20
|
+
clearError(): void;
|
|
21
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseErrorService, never>;
|
|
22
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<BaseErrorService>;
|
|
23
|
+
}
|
|
24
|
+
export declare const ERROR_SERVICE: InjectionToken<BaseErrorService>;
|
|
@@ -3,38 +3,40 @@ import { HttpUtilityService } from './http-utility.service';
|
|
|
3
3
|
import { UtilsService } from './utils.service';
|
|
4
4
|
import { MessageService } from 'primeng/api';
|
|
5
5
|
import { Page } from '../models/pagination/page.interface';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { BaseEntityService } from './base-entity.service';
|
|
7
|
+
import { KeycloakService } from '../keycloak/keycloak.service';
|
|
8
|
+
import { BaseTask } from '../models/base-task.model';
|
|
9
|
+
import { TaskEntityService } from './task-entity-service.interface';
|
|
8
10
|
import * as i0 from "@angular/core";
|
|
9
11
|
/**
|
|
10
12
|
* Base service for task-related operations that extends the BaseCrudService.
|
|
11
13
|
* Implements endpoints defined in Java BaseTaskController.
|
|
14
|
+
*
|
|
15
|
+
* @deprecated `BaseTaskController` (the Java controller this service's `sendEvent`/`PUT
|
|
16
|
+
* /{uuid}/event/{event}` call targets) no longer exists — it was deleted along with
|
|
17
|
+
* `microservice-starter-lib`'s Spring-State-Machine-based workflow subsystem in favor of
|
|
18
|
+
* `workflow-engine-lib`. Calling `sendEvent` against any current backend will 404. Use
|
|
19
|
+
* `WorkflowEngineApiService` from `workflow-engine/` instead, which targets the actual current
|
|
20
|
+
* engine API (`claim`/`unclaim`/`start`/`complete`/`reject`/`reassign` on `/workflow/tasks`).
|
|
12
21
|
*/
|
|
13
|
-
export declare abstract class BaseTaskService<T extends {
|
|
14
|
-
uuid: string;
|
|
15
|
-
}> extends BaseCrudService<T> {
|
|
22
|
+
export declare abstract class BaseTaskService<T extends BaseTask, AU = any, S extends string = string, E extends string = string> extends BaseEntityService<T> implements TaskEntityService<T, S, E> {
|
|
16
23
|
protected httpUtility: HttpUtilityService;
|
|
17
24
|
protected utilsService: UtilsService;
|
|
18
25
|
protected resourcePath: string;
|
|
19
26
|
protected backendBaseUrl: string;
|
|
20
27
|
protected messageService: MessageService | undefined;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* Find tasks by department with pagination
|
|
24
|
-
* Maps to GET /department/{department} endpoint
|
|
25
|
-
*/
|
|
26
|
-
findByDepartment(department: string, pageRequest?: PageRequest): Observable<Page<T>>;
|
|
27
|
-
/**
|
|
28
|
-
* Find tasks by assigned user with pagination
|
|
29
|
-
* Maps to GET /user/{userId} endpoint
|
|
30
|
-
*/
|
|
31
|
-
findByAssignedUser(userId: string, pageRequest?: PageRequest): Observable<Page<T>>;
|
|
28
|
+
readonly keycloakService: KeycloakService;
|
|
29
|
+
constructor(httpUtility: HttpUtilityService, utilsService: UtilsService, resourcePath: string, backendBaseUrl: string, messageService: MessageService | undefined, keycloakService: KeycloakService);
|
|
32
30
|
/**
|
|
33
31
|
* Send an event for a task
|
|
34
32
|
* Maps to PUT /{uuid}/event/{event} endpoint
|
|
35
33
|
* For ASSIGN events, userId and department are required
|
|
36
34
|
*/
|
|
37
|
-
sendEvent(uuid: string, event:
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
sendEvent(uuid: string, event: E, userId?: string, department?: string): Observable<T>;
|
|
36
|
+
/**
|
|
37
|
+
* Calls POST /current-assignees-in endpoint to fetch tasks by assignees with pagination.
|
|
38
|
+
*/
|
|
39
|
+
getByCurrentAssigneesIn(assigneeIds: string[], pageable?: any): Observable<Page<T>>;
|
|
40
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseTaskService<any, any, any, any>, never>;
|
|
41
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<BaseTaskService<any, any, any, any>>;
|
|
40
42
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { HttpUtilityService } from './http-utility.service';
|
|
3
|
+
import { ReferenceDataProviderService } from './reference-data-provider.service';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class EntityRegistryService {
|
|
6
|
+
private httpUtility;
|
|
7
|
+
private dataProvider;
|
|
8
|
+
constructor(httpUtility: HttpUtilityService, dataProvider: ReferenceDataProviderService);
|
|
9
|
+
/**
|
|
10
|
+
* Gets reference options for an entity, suitable for select/dropdown components
|
|
11
|
+
* @param entityName The name of the entity (e.g., 'customers', 'departments')
|
|
12
|
+
* @returns Observable of options array with label/value pairs
|
|
13
|
+
*/
|
|
14
|
+
getEntityOptions(entityName: string): Observable<{
|
|
15
|
+
label: string;
|
|
16
|
+
value: string;
|
|
17
|
+
data?: any;
|
|
18
|
+
}[]>;
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityRegistryService, never>;
|
|
20
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<EntityRegistryService>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { Page } from '../models/pagination/page.interface';
|
|
3
|
+
import { PageRequest } from '../models/pagination/page-request.interface';
|
|
4
|
+
import { ReferenceDto } from '../models/reference-dto.interface';
|
|
5
|
+
import { BaseModel } from '../models/base.model';
|
|
6
|
+
/**
|
|
7
|
+
* Base interface for CRUD operations that all entity services must implement
|
|
8
|
+
* @template T - The entity type
|
|
9
|
+
*/
|
|
10
|
+
export interface EntityService<T extends BaseModel> {
|
|
11
|
+
create(data: Omit<T, 'uuid'>): Observable<T>;
|
|
12
|
+
update(uuid: string, data: Omit<T, 'uuid'>): Observable<T>;
|
|
13
|
+
delete(uuid: string): Observable<void>;
|
|
14
|
+
getById(uuid: string): Observable<T>;
|
|
15
|
+
getAll(pageRequest?: PageRequest): Observable<Page<T>>;
|
|
16
|
+
findAll(): Observable<T[]>;
|
|
17
|
+
findAllReference(): Observable<ReferenceDto[]>;
|
|
18
|
+
findAllReferencePaginated(pageRequest?: PageRequest): Observable<Page<ReferenceDto>>;
|
|
19
|
+
findByCreatedBy(createdBy: string, pageRequest?: PageRequest): Observable<Page<T>>;
|
|
20
|
+
patch(uuid: string, updates: Partial<T>): Observable<T>;
|
|
21
|
+
findDetailedByUuid(uuid: string): Observable<T>;
|
|
22
|
+
}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { PageMode } from '../constants/app.constants';
|
|
3
3
|
import { FormComponentState } from '../states/form-component.state';
|
|
4
|
-
import { EntityService } from './entity.
|
|
4
|
+
import { EntityService } from './entity-service.interface';
|
|
5
5
|
import { FormlyConfigService } from './formly-config.service';
|
|
6
6
|
import { NotificationService } from './notification.service';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}> {
|
|
7
|
+
import { BaseModel } from '../models/base.model';
|
|
8
|
+
export declare class FormService<T extends BaseModel> {
|
|
10
9
|
private entityService;
|
|
11
10
|
private formlyConfigService;
|
|
12
11
|
private notificationService;
|
|
13
12
|
private entityName;
|
|
14
13
|
private jsonFields;
|
|
15
14
|
private dropdownOptions;
|
|
16
|
-
|
|
15
|
+
formState: FormComponentState<T>;
|
|
17
16
|
constructor(entityService: EntityService<T>, formlyConfigService: FormlyConfigService, notificationService: NotificationService, entityName: string, jsonFields: any, dropdownOptions?: Record<string, any>);
|
|
17
|
+
private handleFormChange;
|
|
18
|
+
private updateState;
|
|
19
|
+
private calculateHasChanges;
|
|
18
20
|
private initializeForm;
|
|
19
21
|
private getFormlyFieldConfig;
|
|
20
22
|
loadData(uuid?: string): Observable<void>;
|
|
@@ -25,7 +27,4 @@ export declare class FormService<T extends {
|
|
|
25
27
|
setMode(mode: PageMode): void;
|
|
26
28
|
getState(): FormComponentState<T>;
|
|
27
29
|
patchValue(value: Partial<T>): void;
|
|
28
|
-
private updateCurrentData;
|
|
29
|
-
private checkFormChanges;
|
|
30
|
-
private hasFormChanges;
|
|
31
30
|
}
|
|
@@ -16,7 +16,10 @@ export declare class HttpUtilityService {
|
|
|
16
16
|
private messageService?;
|
|
17
17
|
private loading;
|
|
18
18
|
loading$: Observable<boolean>;
|
|
19
|
+
private inFlight;
|
|
19
20
|
constructor(http: HttpClient, messageService?: MessageService | undefined);
|
|
21
|
+
private startLoading;
|
|
22
|
+
private endLoading;
|
|
20
23
|
/**
|
|
21
24
|
* Perform a GET request with enhanced options
|
|
22
25
|
* @param url The endpoint URL
|
|
@@ -61,6 +64,21 @@ export declare class HttpUtilityService {
|
|
|
61
64
|
retries?: number;
|
|
62
65
|
timeoutMs?: number;
|
|
63
66
|
}): Observable<T>;
|
|
67
|
+
/**
|
|
68
|
+
* Perform a PATCH request with enhanced options
|
|
69
|
+
* @param url The endpoint URL
|
|
70
|
+
* @param body The request payload
|
|
71
|
+
* @param options Additional request options
|
|
72
|
+
* @returns An observable of the response
|
|
73
|
+
*/
|
|
74
|
+
patch<T>(url: string, body: any, options?: {
|
|
75
|
+
params?: HttpParams | Record<string, string | number | boolean | readonly (string | number | boolean)[]>;
|
|
76
|
+
headers?: HttpHeaders | Record<string, string | string[]>;
|
|
77
|
+
responseType?: 'json';
|
|
78
|
+
withCredentials?: boolean;
|
|
79
|
+
retries?: number;
|
|
80
|
+
timeoutMs?: number;
|
|
81
|
+
}): Observable<T>;
|
|
64
82
|
/**
|
|
65
83
|
* Perform a DELETE request with enhanced options
|
|
66
84
|
* @param url The endpoint URL
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import { EntityService } from "./entity-service.interface";
|
|
3
|
+
import { BaseTask } from "../models/base-task.model";
|
|
4
|
+
/**
|
|
5
|
+
* Interface for task-specific operations
|
|
6
|
+
* @template T - The entity type (must extend BaseTaskModel)
|
|
7
|
+
* @template S - The status enum type (for task status)
|
|
8
|
+
* @template E - The event enum type (for task events)
|
|
9
|
+
*
|
|
10
|
+
* @deprecated Paired with {@link BaseTaskService}, which targets a Java controller that no
|
|
11
|
+
* longer exists — see that class's `@deprecated` note. Use `WorkflowEngineApiService` instead.
|
|
12
|
+
*/
|
|
13
|
+
export interface TaskEntityService<T extends BaseTask, S extends string = string, E extends string = string> extends EntityService<T> {
|
|
14
|
+
/**
|
|
15
|
+
* Send an event for a task.
|
|
16
|
+
* Maps to PUT /{uuid}/event/{event} endpoint.
|
|
17
|
+
* For ASSIGN events, userId and department are required.
|
|
18
|
+
* @param uuid The task UUID.
|
|
19
|
+
* @param event The event enum value.
|
|
20
|
+
* @param userId Optional user ID for assignment.
|
|
21
|
+
* @param department Optional department for assignment.
|
|
22
|
+
*/
|
|
23
|
+
sendEvent(uuid: string, event: E, userId?: string, department?: string): Observable<T>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';
|
|
2
|
+
import { FormlyFieldConfig } from '@ngx-formly/core';
|
|
3
|
+
/**
|
|
4
|
+
* Common Validators for form fields
|
|
5
|
+
*/
|
|
6
|
+
export declare class CommonValidators {
|
|
7
|
+
/**
|
|
8
|
+
* Email validator pattern
|
|
9
|
+
* Matches standard email format with @ and domain
|
|
10
|
+
*/
|
|
11
|
+
static readonly EMAIL_PATTERN: RegExp;
|
|
12
|
+
/**
|
|
13
|
+
* Indian mobile number validator pattern
|
|
14
|
+
* Matches 10-digit numbers, optionally starting with +91 or 0
|
|
15
|
+
*/
|
|
16
|
+
static readonly MOBILE_PATTERN: RegExp;
|
|
17
|
+
/**
|
|
18
|
+
* PAN card validator pattern
|
|
19
|
+
* Format: AAAAA0000A (5 letters, 4 numbers, 1 letter)
|
|
20
|
+
*/
|
|
21
|
+
static readonly PAN_PATTERN: RegExp;
|
|
22
|
+
/**
|
|
23
|
+
* Returns a validator function to check if the value matches the given pattern
|
|
24
|
+
* @param pattern - Regular expression to test
|
|
25
|
+
* @param errorMessage - Optional custom error message
|
|
26
|
+
*/
|
|
27
|
+
static patternValidator(pattern: RegExp, errorMessage?: string): ValidatorFn;
|
|
28
|
+
/**
|
|
29
|
+
* Email validator function
|
|
30
|
+
*/
|
|
31
|
+
static email(control: AbstractControl): ValidationErrors | null;
|
|
32
|
+
/**
|
|
33
|
+
* Mobile number validator function
|
|
34
|
+
*/
|
|
35
|
+
static mobileNumber(control: AbstractControl): ValidationErrors | null;
|
|
36
|
+
/**
|
|
37
|
+
* PAN card validator function
|
|
38
|
+
*/
|
|
39
|
+
static panCard(control: AbstractControl): ValidationErrors | null;
|
|
40
|
+
/**
|
|
41
|
+
* Generate formly validator configuration for email
|
|
42
|
+
*/
|
|
43
|
+
static formlyEmailValidator(): {
|
|
44
|
+
expression: (fc: AbstractControl) => boolean;
|
|
45
|
+
message: (error: any, field: FormlyFieldConfig) => string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Generate formly validator configuration for mobile number
|
|
49
|
+
*/
|
|
50
|
+
static formlyMobileValidator(): {
|
|
51
|
+
expression: (fc: AbstractControl) => boolean;
|
|
52
|
+
message: (error: any, field: FormlyFieldConfig) => string;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Generate formly validator configuration for PAN card
|
|
56
|
+
*/
|
|
57
|
+
static formlyPanValidator(): {
|
|
58
|
+
expression: (fc: AbstractControl) => boolean;
|
|
59
|
+
message: (error: any, field: FormlyFieldConfig) => string;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { MessageService } from 'primeng/api';
|
|
3
|
+
import { HttpUtilityService } from '../services/http-utility.service';
|
|
4
|
+
import { UtilsService } from '../services/utils.service';
|
|
5
|
+
import { BusinessObject, CancelInstanceRequest, CompleteTaskRequest, DeployWorkflowRequest, QueueSearchCriteria, QueueView, ReassignTaskRequest, RegisterBusinessObjectRequest, RegisterFormRequest, SetVariablesRequest, SignalEventRequest, StartInstanceRequest, WorkflowAuditEntry, WorkflowDefinitionSummary, WorkflowForm, WorkflowInstance, WorkflowPage, WorkflowTask, WorkflowVersionDetail, WorkflowVersionSummary } from './workflow-engine.models';
|
|
6
|
+
/**
|
|
7
|
+
* Client for `workflow-engine-lib`'s REST API — the data-driven engine that replaced
|
|
8
|
+
* `microservice-starter-lib`'s Spring-State-Machine-based workflow subsystem.
|
|
9
|
+
*
|
|
10
|
+
* Follows this library's established DI convention (see {@link BaseEntityService}): not
|
|
11
|
+
* `providedIn: 'root'`, constructed with the backend base URL by the consuming application —
|
|
12
|
+
* *
|
|
13
|
+
* ```ts
|
|
14
|
+
* providers: [{
|
|
15
|
+
* provide: WorkflowEngineApiService,
|
|
16
|
+
* useFactory: (http: HttpUtilityService, utils: UtilsService, msg: MessageService) =>
|
|
17
|
+
* new WorkflowEngineApiService(http, utils, 'https://api.example.com/workflow', msg),
|
|
18
|
+
* deps: [HttpUtilityService, UtilsService, MessageService],
|
|
19
|
+
* }]
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* Every method maps one-to-one onto an engine endpoint; nothing here is business-specific.
|
|
23
|
+
*
|
|
24
|
+
* Deliberately not decorated with {@code @Injectable()} — like {@link BaseEntityService}, this
|
|
25
|
+
* class is always provided via an explicit `useFactory`/`useClass` provider (see above), never
|
|
26
|
+
* auto-constructed by Angular's injector, so its constructor isn't required to be fully
|
|
27
|
+
* DI-resolvable (`backendBaseUrl: string` isn't a valid injection token on its own).
|
|
28
|
+
*/
|
|
29
|
+
export declare class WorkflowEngineApiService {
|
|
30
|
+
protected httpUtility: HttpUtilityService;
|
|
31
|
+
protected utilsService: UtilsService;
|
|
32
|
+
protected backendBaseUrl: string;
|
|
33
|
+
protected messageService: MessageService | undefined;
|
|
34
|
+
protected apiUrl: string;
|
|
35
|
+
/**
|
|
36
|
+
* Creates the client.
|
|
37
|
+
*
|
|
38
|
+
* @param httpUtility HTTP requests, loading state, standardised error handling
|
|
39
|
+
* @param utilsService UUID validation
|
|
40
|
+
* @param backendBaseUrl base URL of the service hosting `workflow-engine-lib`, e.g.
|
|
41
|
+
* `https://api.example.com/workflow`
|
|
42
|
+
* @param messageService optional, shown on client-side validation failures
|
|
43
|
+
*/
|
|
44
|
+
constructor(httpUtility: HttpUtilityService, utilsService: UtilsService, backendBaseUrl: string, messageService: MessageService | undefined);
|
|
45
|
+
private requireUuid;
|
|
46
|
+
/** Finds a task by id. `GET /tasks/{id}` */
|
|
47
|
+
getTask(id: string): Observable<WorkflowTask>;
|
|
48
|
+
/** Claims a task out of a shared queue. `POST /tasks/{id}/claim` */
|
|
49
|
+
claimTask(id: string): Observable<WorkflowTask>;
|
|
50
|
+
/** Releases a claim, returning the task to its queue. `POST /tasks/{id}/unclaim` */
|
|
51
|
+
unclaimTask(id: string): Observable<WorkflowTask>;
|
|
52
|
+
/** Marks work on a task as actively started. `POST /tasks/{id}/start` */
|
|
53
|
+
startTask(id: string): Observable<WorkflowTask>;
|
|
54
|
+
/** Completes a task and resumes its workflow. `POST /tasks/{id}/complete` */
|
|
55
|
+
completeTask(id: string, request?: CompleteTaskRequest): Observable<WorkflowTask>;
|
|
56
|
+
/** Rejects a task, resuming its workflow down a different path. `POST /tasks/{id}/reject` */
|
|
57
|
+
rejectTask(id: string, request?: CompleteTaskRequest): Observable<WorkflowTask>;
|
|
58
|
+
/** Reassigns a task to a different subject. `POST /tasks/{id}/reassign` */
|
|
59
|
+
reassignTask(id: string, request: ReassignTaskRequest): Observable<WorkflowTask>;
|
|
60
|
+
/** Starts a new workflow instance. `POST /instances` */
|
|
61
|
+
startInstance(request: StartInstanceRequest): Observable<WorkflowInstance>;
|
|
62
|
+
/** Finds an instance by id. `GET /instances/{id}` */
|
|
63
|
+
getInstance(id: string): Observable<WorkflowInstance>;
|
|
64
|
+
/** Finds instances by business key. `GET /instances?businessKey=...` */
|
|
65
|
+
findInstancesByBusinessKey(businessKey: string): Observable<WorkflowInstance[]>;
|
|
66
|
+
/** Loads an instance's audit history, oldest first. `GET /instances/{id}/history` */
|
|
67
|
+
instanceHistory(id: string): Observable<WorkflowAuditEntry[]>;
|
|
68
|
+
/** Reads an instance's current variables. `GET /instances/{id}/variables` */
|
|
69
|
+
getInstanceVariables(id: string): Observable<Record<string, unknown>>;
|
|
70
|
+
/** Sets or replaces instance variables outside of any node execution. `PUT /instances/{id}/variables` */
|
|
71
|
+
setInstanceVariables(id: string, request: SetVariablesRequest): Observable<WorkflowInstance>;
|
|
72
|
+
/** Signals an external event to a waiting instance. `POST /instances/{id}/signal` */
|
|
73
|
+
signalInstance(id: string, request: SignalEventRequest): Observable<WorkflowInstance>;
|
|
74
|
+
/** Cancels a running instance and withdraws its open tasks. `POST /instances/{id}/cancel` */
|
|
75
|
+
cancelInstance(id: string, request?: CancelInstanceRequest): Observable<WorkflowInstance>;
|
|
76
|
+
/** Deploys a workflow definition, creating a new immutable version. `POST /definitions` */
|
|
77
|
+
deployDefinition(request: DeployWorkflowRequest): Observable<WorkflowVersionSummary>;
|
|
78
|
+
/** Lists every workflow definition. `GET /definitions` */
|
|
79
|
+
listDefinitions(): Observable<WorkflowDefinitionSummary[]>;
|
|
80
|
+
/** Finds a definition by key. `GET /definitions/{key}` */
|
|
81
|
+
getDefinition(key: string): Observable<WorkflowDefinitionSummary>;
|
|
82
|
+
/** Lists every deployed version of a definition. `GET /definitions/{key}/versions` */
|
|
83
|
+
listVersions(key: string): Observable<WorkflowVersionSummary[]>;
|
|
84
|
+
/** Loads the active version's authored document. `GET /definitions/{key}/versions/active` */
|
|
85
|
+
activeVersion(key: string): Observable<WorkflowVersionDetail>;
|
|
86
|
+
/** Activates a specific version. `POST /definitions/{key}/versions/{versionNumber}/activate` */
|
|
87
|
+
activateVersion(key: string, versionNumber: number): Observable<WorkflowVersionSummary>;
|
|
88
|
+
/** Loads one of the queue views. `GET /queue/{view}` */
|
|
89
|
+
queue(view: QueueView, page?: number, size?: number): Observable<WorkflowPage<WorkflowTask>>;
|
|
90
|
+
/** Searches the queue with structured criteria. `POST /queue/search` */
|
|
91
|
+
searchQueue(criteria?: QueueSearchCriteria, page?: number, size?: number): Observable<WorkflowPage<WorkflowTask>>;
|
|
92
|
+
/** Registers a business object type, or updates one with the same code. `POST /business-objects` */
|
|
93
|
+
registerBusinessObject(request: RegisterBusinessObjectRequest): Observable<BusinessObject>;
|
|
94
|
+
/** Lists every registered business object. `GET /business-objects` */
|
|
95
|
+
listBusinessObjects(): Observable<BusinessObject[]>;
|
|
96
|
+
/** Finds one business object, including the workflows bound to it. `GET /business-objects/{code}` */
|
|
97
|
+
getBusinessObject(code: string): Observable<BusinessObject>;
|
|
98
|
+
/** Registers a new version of a form under a business object. `POST /business-objects/{code}/forms` */
|
|
99
|
+
registerForm(code: string, request: RegisterFormRequest): Observable<WorkflowForm>;
|
|
100
|
+
/** Lists every form registered under a business object. `GET /business-objects/{code}/forms` */
|
|
101
|
+
listForms(code: string): Observable<WorkflowForm[]>;
|
|
102
|
+
/** Finds the active form version a new task would render. `GET /business-objects/{code}/forms/{formKey}` */
|
|
103
|
+
activeForm(code: string, formKey: string): Observable<WorkflowForm>;
|
|
104
|
+
}
|