@codex-ts/core-lib 1.0.8 → 1.0.12

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.
Files changed (36) hide show
  1. package/README.md +63 -0
  2. package/fesm2022/codex-ts-core-lib.mjs +1980 -1383
  3. package/fesm2022/codex-ts-core-lib.mjs.map +1 -1
  4. package/index.d.ts +5 -29
  5. package/lib/components/base-form.component.d.ts +27 -22
  6. package/lib/components/base-list-page.component.d.ts +12 -71
  7. package/lib/components/base-list-tabbed-form.component.d.ts +40 -0
  8. package/lib/components/base-tabbed-form.component.d.ts +17 -20
  9. package/lib/components/base-table.component.d.ts +72 -0
  10. package/lib/components/base-task-details.component.d.ts +59 -0
  11. package/lib/components/formly/types/numeric-input.type.d.ts +2 -2
  12. package/lib/components/formly/types/select.type.d.ts +1 -1
  13. package/lib/components/formly/types/textarea.type.d.ts +1 -1
  14. package/lib/enums/task-role.enum.d.ts +37 -0
  15. package/lib/keycloak/keycloak-config.interface.d.ts +19 -0
  16. package/lib/keycloak/keycloak.guard.d.ts +25 -0
  17. package/lib/keycloak/keycloak.service.d.ts +24 -0
  18. package/lib/keycloak/keycloak.token.d.ts +3 -0
  19. package/lib/models/base-create-request.model.d.ts +12 -0
  20. package/lib/models/base-request.model.d.ts +9 -0
  21. package/lib/models/base-response.model.d.ts +15 -0
  22. package/lib/models/base-task.model.d.ts +17 -0
  23. package/lib/models/base-update-request.model.d.ts +16 -0
  24. package/lib/models/base.model.d.ts +59 -0
  25. package/lib/models/pagination/page.interface.d.ts +23 -6
  26. package/lib/services/base-task.service.d.ts +40 -0
  27. package/lib/services/form.service.d.ts +31 -0
  28. package/lib/services/http-utility.service.d.ts +1 -1
  29. package/lib/states/form-component.state.d.ts +12 -0
  30. package/lib/states/form.state.d.ts +21 -0
  31. package/lib/states/list-tabbed-form.state.d.ts +9 -0
  32. package/lib/states/tabbed-form.state.d.ts +21 -0
  33. package/package.json +11 -25
  34. package/public-api.d.ts +37 -0
  35. package/lib/services/entity-registry.service.d.ts +0 -26
  36. package/lib/services/reference-data-provider.service.d.ts +0 -8
@@ -0,0 +1,15 @@
1
+ import { BaseModel } from './base.model';
2
+ /**
3
+ * Base interface for all API response DTOs
4
+ * Extends BaseModel to include audit fields and adds response-specific fields
5
+ */
6
+ export interface BaseResponse extends BaseModel {
7
+ /**
8
+ * Unique request identifier for tracing/debugging
9
+ */
10
+ requestId?: string;
11
+ /**
12
+ * Timestamp when the response was generated
13
+ */
14
+ timestamp: Date;
15
+ }
@@ -0,0 +1,17 @@
1
+ import { BaseModel } from './base.model';
2
+ /**
3
+ * Base model interface for all task entities
4
+ * Contains common fields used across different types of tasks
5
+ */
6
+ export interface BaseTaskModel extends BaseModel {
7
+ title: string;
8
+ description: string;
9
+ type: string;
10
+ category: string;
11
+ priority: string;
12
+ assignedUser: string;
13
+ assignedDepartment: string;
14
+ product: string;
15
+ subProduct: string;
16
+ business: string;
17
+ }
@@ -0,0 +1,16 @@
1
+ import { BaseRequest } from './base-request.model';
2
+ /**
3
+ * Base interface for update operation requests
4
+ * Contains fields required for entity identification and version control
5
+ */
6
+ export interface BaseUpdateRequest extends BaseRequest {
7
+ /**
8
+ * Unique identifier of the entity to update
9
+ */
10
+ uuid: string;
11
+ /**
12
+ * Version number for optimistic locking
13
+ * Must match the current version in database
14
+ */
15
+ version: number;
16
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Base model interface that all entities extend from
3
+ * Contains common fields for entity identification and auditing
4
+ * Maps to Java BaseEntity
5
+ */
6
+ export interface BaseModel {
7
+ /**
8
+ * Database generated ID
9
+ */
10
+ id?: number;
11
+ /**
12
+ * Unique identifier, used for external reference
13
+ */
14
+ uuid: string;
15
+ /**
16
+ * Version number for optimistic locking
17
+ */
18
+ version?: number;
19
+ /**
20
+ * User who created the entity
21
+ */
22
+ createdBy: string;
23
+ /**
24
+ * Timestamp when entity was created
25
+ */
26
+ createdDate: Date;
27
+ /**
28
+ * User who last modified the entity
29
+ */
30
+ lastModifiedBy?: string;
31
+ /**
32
+ * Timestamp when entity was last modified
33
+ */
34
+ lastModifiedDate?: Date;
35
+ /**
36
+ * Whether the entity is marked as deleted
37
+ */
38
+ deleted: boolean;
39
+ /**
40
+ * Whether the entity is currently active
41
+ */
42
+ active: boolean;
43
+ /**
44
+ * User who deleted the entity
45
+ */
46
+ deletedBy?: string;
47
+ /**
48
+ * Timestamp when entity was deleted
49
+ */
50
+ deletedDate?: Date;
51
+ /**
52
+ * Get unique identifier string
53
+ */
54
+ getKey?(): string;
55
+ /**
56
+ * Get display label for the entity
57
+ */
58
+ getDisplayLabel?(): string;
59
+ }
@@ -1,9 +1,26 @@
1
+ export interface Sort {
2
+ empty: boolean;
3
+ sorted: boolean;
4
+ unsorted: boolean;
5
+ }
6
+ export interface Pageable {
7
+ pageNumber: number;
8
+ pageSize: number;
9
+ sort: Sort;
10
+ offset: number;
11
+ paged: boolean;
12
+ unpaged: boolean;
13
+ }
1
14
  export interface Page<T> {
2
15
  content: T[];
3
- page: {
4
- totalElements: number;
5
- totalPages: number;
6
- size: number;
7
- number: number;
8
- };
16
+ pageable: Pageable;
17
+ last: boolean;
18
+ totalElements: number;
19
+ totalPages: number;
20
+ size: number;
21
+ number: number;
22
+ sort: Sort;
23
+ first: boolean;
24
+ numberOfElements: number;
25
+ empty: boolean;
9
26
  }
@@ -0,0 +1,40 @@
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 { BaseCrudService } from './base-crud.service';
8
+ import * as i0 from "@angular/core";
9
+ /**
10
+ * Base service for task-related operations that extends the BaseCrudService.
11
+ * Implements endpoints defined in Java BaseTaskController.
12
+ */
13
+ export declare abstract class BaseTaskService<T extends {
14
+ uuid: string;
15
+ }> extends BaseCrudService<T> {
16
+ protected httpUtility: HttpUtilityService;
17
+ protected utilsService: UtilsService;
18
+ protected resourcePath: string;
19
+ protected backendBaseUrl: string;
20
+ protected messageService: MessageService | undefined;
21
+ constructor(httpUtility: HttpUtilityService, utilsService: UtilsService, resourcePath: string, backendBaseUrl: string, messageService: MessageService | undefined);
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>>;
32
+ /**
33
+ * Send an event for a task
34
+ * Maps to PUT /{uuid}/event/{event} endpoint
35
+ * For ASSIGN events, userId and department are required
36
+ */
37
+ sendEvent(uuid: string, event: string, userId?: string, department?: string): Observable<T>;
38
+ static ɵfac: i0.ɵɵFactoryDeclaration<BaseTaskService<any>, never>;
39
+ static ɵprov: i0.ɵɵInjectableDeclaration<BaseTaskService<any>>;
40
+ }
@@ -0,0 +1,31 @@
1
+ import { Observable } from 'rxjs';
2
+ import { PageMode } from '../constants/app.constants';
3
+ import { FormComponentState } from '../states/form-component.state';
4
+ import { EntityService } from './entity.service';
5
+ import { FormlyConfigService } from './formly-config.service';
6
+ import { NotificationService } from './notification.service';
7
+ export declare class FormService<T extends {
8
+ uuid: string;
9
+ }> {
10
+ private entityService;
11
+ private formlyConfigService;
12
+ private notificationService;
13
+ private entityName;
14
+ private jsonFields;
15
+ private dropdownOptions;
16
+ protected formState: FormComponentState<T>;
17
+ constructor(entityService: EntityService<T>, formlyConfigService: FormlyConfigService, notificationService: NotificationService, entityName: string, jsonFields: any, dropdownOptions?: Record<string, any>);
18
+ private initializeForm;
19
+ private getFormlyFieldConfig;
20
+ loadData(uuid?: string): Observable<void>;
21
+ private updateFormState;
22
+ submit(): Observable<T>;
23
+ private validateSubmission;
24
+ private getSubmitOperation;
25
+ setMode(mode: PageMode): void;
26
+ getState(): FormComponentState<T>;
27
+ patchValue(value: Partial<T>): void;
28
+ private updateCurrentData;
29
+ private checkFormChanges;
30
+ private hasFormChanges;
31
+ }
@@ -16,7 +16,7 @@ export declare class HttpUtilityService {
16
16
  private messageService?;
17
17
  private loading;
18
18
  loading$: Observable<boolean>;
19
- constructor(http: HttpClient, messageService?: MessageService);
19
+ constructor(http: HttpClient, messageService?: MessageService | undefined);
20
20
  /**
21
21
  * Perform a GET request with enhanced options
22
22
  * @param url The endpoint URL
@@ -0,0 +1,12 @@
1
+ import { FormGroup } from '@angular/forms';
2
+ import { FormlyFieldConfig } from '@ngx-formly/core';
3
+ import { FormState } from './form.state';
4
+ /**
5
+ * State interface specific to form components that use Formly
6
+ */
7
+ export interface FormComponentState<T> extends FormState<T> {
8
+ /** The Angular form group instance */
9
+ form: FormGroup;
10
+ /** Formly field configuration array */
11
+ fields: FormlyFieldConfig[];
12
+ }
@@ -0,0 +1,21 @@
1
+ import { ComponentContext } from '../enums/component-context.enum';
2
+ import { PageMode } from '../constants/app.constants';
3
+ /**
4
+ * Base form state interface used by all form components
5
+ */
6
+ export interface FormState<T> {
7
+ /** Indicates if this is a new entity being created */
8
+ isNew: boolean;
9
+ /** Current mode of the form (create/edit/view) */
10
+ mode: PageMode;
11
+ /** Current form data */
12
+ currentData: T;
13
+ /** Original form data used to detect changes */
14
+ originalData: T | null;
15
+ /** Flag indicating if form has unsaved changes */
16
+ hasChanges: boolean;
17
+ /** Loading state flag */
18
+ loading: boolean;
19
+ /** Current context the form is operating in */
20
+ context?: ComponentContext;
21
+ }
@@ -0,0 +1,9 @@
1
+ import { TabbedFormState } from './tabbed-form.state';
2
+ /**
3
+ * State interface for list-based tabbed form components.
4
+ * This type of form handles multiple items where each item becomes a tab.
5
+ */
6
+ export interface ListTabbedFormState<T> extends TabbedFormState<T> {
7
+ /** Array of form data items, where each item corresponds to a tab */
8
+ formDataList: T[];
9
+ }
@@ -0,0 +1,21 @@
1
+ import { FormState } from './form.state';
2
+ /**
3
+ * Configuration interface for tabs
4
+ */
5
+ export interface TabConfig {
6
+ /** Unique identifier for the tab */
7
+ value: string;
8
+ /** Display title of the tab */
9
+ title: string;
10
+ /** Indicates if this tab manages the parent model or a child model */
11
+ isParentModel?: boolean;
12
+ }
13
+ /**
14
+ * State interface for tabbed form components
15
+ */
16
+ export interface TabbedFormState<T> extends FormState<T> {
17
+ /** Currently active tab value */
18
+ activeTab: string;
19
+ /** Array of tab configurations */
20
+ tabs: TabConfig[];
21
+ }
package/package.json CHANGED
@@ -1,32 +1,19 @@
1
1
  {
2
2
  "name": "@codex-ts/core-lib",
3
- "version": "1.0.8",
4
- "description": "",
5
- "main": "index.js",
6
- "keywords": [],
7
- "author": "",
8
- "license": "ISC",
9
- "dependencies": {
10
- "tslib": "^2.3.0"
11
- },
3
+ "version": "1.0.12",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
12
6
  "peerDependencies": {
13
- "@angular/animations": "^19.1.5",
14
- "@angular/cdk": "^19.1.5",
15
- "@angular/common": "^19.1.5",
16
- "@angular/compiler": "^19.1.5",
17
- "@angular/core": "^19.1.5",
18
- "@angular/forms": "^19.1.5",
19
- "@angular/platform-browser": "^19.1.5",
20
- "@angular/platform-browser-dynamic": "^19.1.5",
21
- "@angular/router": "^19.1.5",
7
+ "@angular/common": "^19.2.0",
8
+ "@angular/core": "^19.2.0",
22
9
  "@ngx-formly/core": "^6.3.12",
23
- "@primeng/themes": "^19.0.6",
24
- "primeflex": "^3.3.1",
25
- "primeicons": "^7.0.0",
26
10
  "primeng": "^19.0.6",
27
- "rxjs": "~7.8.0",
28
- "zone.js": "~0.15.0"
11
+ "rxjs": "~7.8.0"
29
12
  },
13
+ "dependencies": {
14
+ "tslib": "^2.3.0"
15
+ },
16
+ "sideEffects": false,
30
17
  "module": "fesm2022/codex-ts-core-lib.mjs",
31
18
  "typings": "index.d.ts",
32
19
  "exports": {
@@ -37,6 +24,5 @@
37
24
  "types": "./index.d.ts",
38
25
  "default": "./fesm2022/codex-ts-core-lib.mjs"
39
26
  }
40
- },
41
- "sideEffects": false
27
+ }
42
28
  }
@@ -0,0 +1,37 @@
1
+ export * from './lib/constants/app.constants';
2
+ export * from './lib/constants/app.messages';
3
+ export * from './lib/enums/component-context.enum';
4
+ export * from './lib/enums/tabbed-form-type.enum';
5
+ export * from './lib/enums/task-role.enum';
6
+ export * from './lib/models/base.model';
7
+ export * from './lib/models/base-task.model';
8
+ export * from './lib/models/base-request.model';
9
+ export * from './lib/models/base-response.model';
10
+ export * from './lib/models/base-create-request.model';
11
+ export * from './lib/models/base-update-request.model';
12
+ export * from './lib/models/pagination/page.interface';
13
+ export * from './lib/models/pagination/page-request.interface';
14
+ export { KEYCLOAK_CONFIG } from './lib/keycloak/keycloak.token';
15
+ export * from './lib/keycloak/keycloak-config.interface';
16
+ export * from './lib/keycloak/keycloak.guard';
17
+ export * from './lib/keycloak/keycloak.service';
18
+ export * from './lib/services/http-utility.service';
19
+ export * from './lib/services/utils.service';
20
+ export * from './lib/services/notification.service';
21
+ export * from './lib/services/entity.service';
22
+ export * from './lib/services/base-crud.service';
23
+ export * from './lib/services/base-task.service';
24
+ export * from './lib/services/formly-config.service';
25
+ export * from './lib/services/form.service';
26
+ export * from './lib/components/formly/core-formly.module';
27
+ export * from './lib/components/base-form.component';
28
+ export * from './lib/components/base-page.component';
29
+ export * from './lib/components/base-list-page.component';
30
+ export * from './lib/components/base-tabbed-form.component';
31
+ export * from './lib/components/base-list-tabbed-form.component';
32
+ export * from './lib/components/base-task-details.component';
33
+ export * from './lib/states/form.state';
34
+ export * from './lib/states/form-component.state';
35
+ export * from './lib/states/tabbed-form.state';
36
+ export * from './lib/states/list-tabbed-form.state';
37
+ export * from './lib/pipes/indian-date.pipe';
@@ -1,26 +0,0 @@
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 interface ReferenceDto {
6
- key: string;
7
- displayLabel: string;
8
- data?: any;
9
- }
10
- export declare class EntityRegistryService {
11
- private httpUtility;
12
- private dataProvider;
13
- constructor(httpUtility: HttpUtilityService, dataProvider: ReferenceDataProviderService);
14
- /**
15
- * Gets reference options for an entity, suitable for select/dropdown components
16
- * @param entityName The name of the entity (e.g., 'customers', 'departments')
17
- * @returns Observable of options array with label/value pairs
18
- */
19
- getEntityOptions(entityName: string): Observable<{
20
- label: string;
21
- value: string;
22
- data?: any;
23
- }[]>;
24
- static ɵfac: i0.ɵɵFactoryDeclaration<EntityRegistryService, never>;
25
- static ɵprov: i0.ɵɵInjectableDeclaration<EntityRegistryService>;
26
- }
@@ -1,8 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- export declare class ReferenceDataProviderService {
3
- private endpoints;
4
- setEndpoints(endpoints: Record<string, string>): void;
5
- getReferenceEndpoint(entityName: string): string | null;
6
- static ɵfac: i0.ɵɵFactoryDeclaration<ReferenceDataProviderService, never>;
7
- static ɵprov: i0.ɵɵInjectableDeclaration<ReferenceDataProviderService>;
8
- }