cat-documents-ng 0.1.30 → 0.1.32

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 (92) hide show
  1. package/{src/Shared/constant/ERROR.ts → Shared/constant/ERROR.d.ts} +43 -38
  2. package/Shared/constant/PERMISSIONS.d.ts +20 -0
  3. package/Shared/constant/SHARED.d.ts +215 -0
  4. package/{src/Shared/constant/URLS.ts → Shared/constant/URLS.d.ts} +60 -65
  5. package/Shared/services/app-config.service.d.ts +51 -0
  6. package/{src/Shared/services/global-error.handler.ts → Shared/services/global-error.handler.d.ts} +27 -29
  7. package/Shared/services/session.service.d.ts +46 -0
  8. package/fesm2022/cat-documents-ng.mjs +2623 -0
  9. package/fesm2022/cat-documents-ng.mjs.map +1 -0
  10. package/index.d.ts +5 -0
  11. package/lib/document/components/document-container/document-container.component.d.ts +101 -0
  12. package/lib/document/components/document-list/document-list.component.d.ts +193 -0
  13. package/lib/document/components/document-list-item/document-list-item.component.d.ts +28 -0
  14. package/lib/document/components/document-upload/document-upload.component.d.ts +120 -0
  15. package/lib/document/components/document-viewer/document-viewer.component.d.ts +77 -0
  16. package/{src/lib/document/components/folder-block/folder-block.component.ts → lib/document/components/folder-block/folder-block.component.d.ts} +37 -53
  17. package/lib/document/components/folder-container/folder-container.component.d.ts +29 -0
  18. package/lib/document/components/linked-document/linked-document.component.d.ts +38 -0
  19. package/lib/document/directives/document.directive.d.ts +20 -0
  20. package/lib/document/directives/permission.directive.d.ts +38 -0
  21. package/lib/document/document.module.d.ts +40 -0
  22. package/{src/lib/document/models/document-alert.model.ts → lib/document/models/document-alert.model.d.ts} +38 -45
  23. package/lib/document/models/document-type.model.d.ts +37 -0
  24. package/lib/document/models/document.model.d.ts +44 -0
  25. package/{src/lib/document/models/folder.model.ts → lib/document/models/folder.model.d.ts} +29 -35
  26. package/lib/document/services/document-http.service.d.ts +69 -0
  27. package/lib/document/services/document-upload.service.d.ts +67 -0
  28. package/lib/document/services/document.service.d.ts +20 -0
  29. package/lib/document/services/file-format.service.d.ts +23 -0
  30. package/lib/document/state/document.query.d.ts +50 -0
  31. package/{src/lib/document/state/document.service.ts → lib/document/state/document.service.d.ts} +64 -95
  32. package/{src/lib/document/state/document.state.ts → lib/document/state/document.state.d.ts} +36 -52
  33. package/lib/document/state/document.store.d.ts +29 -0
  34. package/package.json +25 -20
  35. package/{src/public-api.ts → public-api.d.ts} +6 -10
  36. package/ng-package.json +0 -11
  37. package/src/Shared/constant/PERMISSIONS.ts +0 -16
  38. package/src/Shared/constant/SHARED.ts +0 -312
  39. package/src/Shared/services/app-config.service.spec.ts +0 -19
  40. package/src/Shared/services/app-config.service.ts +0 -73
  41. package/src/Shared/services/session.service.spec.ts +0 -16
  42. package/src/Shared/services/session.service.ts +0 -76
  43. package/src/assets/config/api.config.json +0 -20
  44. package/src/lib/document/components/document-container/document-container.component.html +0 -14
  45. package/src/lib/document/components/document-container/document-container.component.scss +0 -8
  46. package/src/lib/document/components/document-container/document-container.component.spec.ts +0 -110
  47. package/src/lib/document/components/document-container/document-container.component.ts +0 -173
  48. package/src/lib/document/components/document-list/document-list.component.html +0 -81
  49. package/src/lib/document/components/document-list/document-list.component.scss +0 -82
  50. package/src/lib/document/components/document-list/document-list.component.spec.ts +0 -96
  51. package/src/lib/document/components/document-list/document-list.component.ts +0 -244
  52. package/src/lib/document/components/document-list-item/document-list-item.component.html +0 -36
  53. package/src/lib/document/components/document-list-item/document-list-item.component.scss +0 -34
  54. package/src/lib/document/components/document-list-item/document-list-item.component.spec.ts +0 -75
  55. package/src/lib/document/components/document-list-item/document-list-item.component.ts +0 -40
  56. package/src/lib/document/components/document-upload/document-upload.component.html +0 -56
  57. package/src/lib/document/components/document-upload/document-upload.component.scss +0 -32
  58. package/src/lib/document/components/document-upload/document-upload.component.spec.ts +0 -95
  59. package/src/lib/document/components/document-upload/document-upload.component.ts +0 -162
  60. package/src/lib/document/components/document-viewer/document-viewer.component.html +0 -98
  61. package/src/lib/document/components/document-viewer/document-viewer.component.scss +0 -54
  62. package/src/lib/document/components/document-viewer/document-viewer.component.spec.ts +0 -79
  63. package/src/lib/document/components/document-viewer/document-viewer.component.ts +0 -106
  64. package/src/lib/document/components/folder-block/folder-block.component.html +0 -46
  65. package/src/lib/document/components/folder-block/folder-block.component.scss +0 -9
  66. package/src/lib/document/components/folder-block/folder-block.component.spec.ts +0 -70
  67. package/src/lib/document/components/folder-container/folder-container.component.html +0 -2
  68. package/src/lib/document/components/folder-container/folder-container.component.scss +0 -0
  69. package/src/lib/document/components/folder-container/folder-container.component.spec.ts +0 -27
  70. package/src/lib/document/components/folder-container/folder-container.component.ts +0 -37
  71. package/src/lib/document/components/linked-document/linked-document.component.html +0 -23
  72. package/src/lib/document/components/linked-document/linked-document.component.scss +0 -10
  73. package/src/lib/document/components/linked-document/linked-document.component.spec.ts +0 -61
  74. package/src/lib/document/components/linked-document/linked-document.component.ts +0 -49
  75. package/src/lib/document/directives/document.directive.ts +0 -32
  76. package/src/lib/document/directives/permission.directive.spec.ts +0 -0
  77. package/src/lib/document/directives/permission.directive.ts +0 -66
  78. package/src/lib/document/document.module.ts +0 -241
  79. package/src/lib/document/models/document-type.model.ts +0 -44
  80. package/src/lib/document/models/document.model.ts +0 -53
  81. package/src/lib/document/services/document-http.service.spec.ts +0 -119
  82. package/src/lib/document/services/document-http.service.ts +0 -125
  83. package/src/lib/document/services/document-upload.service.spec.ts +0 -99
  84. package/src/lib/document/services/document-upload.service.ts +0 -127
  85. package/src/lib/document/services/document.service.ts +0 -29
  86. package/src/lib/document/services/file-format.service.spec.ts +0 -16
  87. package/src/lib/document/services/file-format.service.ts +0 -41
  88. package/src/lib/document/state/document.query.ts +0 -52
  89. package/src/lib/document/state/document.store.ts +0 -51
  90. package/tsconfig.lib.json +0 -15
  91. package/tsconfig.lib.prod.json +0 -11
  92. package/tsconfig.spec.json +0 -15
@@ -1,95 +1,64 @@
1
- import { Injectable } from '@angular/core';
2
- import { HttpClient } from '@angular/common/http';
3
- import { DocumentStore } from './document.store';
4
- import { Observable, tap } from 'rxjs';
5
- import { AppConfigService } from '../../../Shared/services/app-config.service';
6
- import { URLS } from '../../../Shared/constant/URLS';
7
- import { DocumentModel } from '../models/document.model';
8
-
9
- /**
10
- * Service for managing document-related operations.
11
- * The `DocumentService` acts as a bridge between the application and the backend API for handling document-related data.
12
- * It interacts with the `DocumentStore` for state management and uses `HttpClient` for making HTTP requests.
13
- * Creates an instance of `DocumentService`.
14
- * @param {DocumentStore} documentStore - The store that manages the state of documents.
15
- * @param {HttpClient} http - The Angular HTTP client for making API requests.
16
- */
17
- @Injectable({ providedIn: 'root' })
18
- export class DocumentService {
19
-
20
- /**
21
- * Creates an instance of DocumentService.
22
- * @param {DocumentStore} documentStore - Store managing the state of documents.
23
- * @param {HttpClient} http - Angular HTTP client for making API requests.
24
- * @param {AppConfigService} appConfigService - Service for retrieving application configuration, such as API base URL.
25
- */
26
- constructor(
27
- public documentStore: DocumentStore,
28
- private http: HttpClient,
29
- public appConfigService: AppConfigService
30
- ) { }
31
-
32
- /**
33
- * Get api url from appConfigService.
34
- * @readonly
35
- * @type {string}
36
- */
37
- get apiUrl(): string {
38
- return this.appConfigService.apiBaseUrl;
39
- }
40
-
41
- /**
42
- * Sends a request to create a new document.
43
- * @param {*} entity - The data of the document to be created.
44
- * @returns {Observable<any>} Observable that emits the newly created document.
45
- */
46
- create(entity: any): Observable<any> {
47
- return this.http.post<any>(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}`, entity).pipe(
48
- tap((newEntity: any) => this.documentStore.add(newEntity))
49
- );
50
- }
51
-
52
- /**
53
- * Fetches all documents from the backend.
54
- * @returns {Observable<DocumentModel[]>} Observable that emits an array of documents.
55
- */
56
- getAll(): Observable<DocumentModel[]> {
57
- return this.http.get<DocumentModel[]>(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}`).pipe(
58
- tap((entities: DocumentModel[]) => this.documentStore.set(entities))
59
- );
60
- }
61
-
62
- /**
63
- * Fetches a document by its ID.
64
- * @param {string} id - The unique identifier of the document.
65
- * @returns {Observable<any>} Observable that emits the retrieved document.
66
- */
67
- getById(id: string): Observable<any> {
68
- return this.http.get<any>(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${id}`).pipe(
69
- tap((entity: any) => this.documentStore.upsert(id, entity))
70
- );
71
- }
72
-
73
- /**
74
- * Updates an existing document by its ID.
75
- * @param {string} id - The unique identifier of the document.
76
- * @param {DocumentModel} entity - The updated data of the document.
77
- * @returns {Observable<DocumentModel>} Observable that emits the updated document.
78
- */
79
- update(id: string, entity: DocumentModel): Observable<DocumentModel> {
80
- return this.http.put<DocumentModel>(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${id}`, entity).pipe(
81
- tap((updatedEntity: DocumentModel) => this.documentStore.update(id, updatedEntity))
82
- );
83
- }
84
-
85
- /**
86
- * Deletes a document by its ID.
87
- * @param {string} id - The unique identifier of the document to be deleted.
88
- * @returns {Observable<void>} Observable that completes when the document is deleted.
89
- */
90
- delete(id: string): Observable<void> {
91
- return this.http.delete<void>(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${id}`).pipe(
92
- tap(() => this.documentStore.remove(id))
93
- );
94
- }
95
- }
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { DocumentStore } from './document.store';
3
+ import { Observable } from 'rxjs';
4
+ import { AppConfigService } from '../../../Shared/services/app-config.service';
5
+ import { DocumentModel } from '../models/document.model';
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * Service for managing document-related operations.
9
+ * The `DocumentService` acts as a bridge between the application and the backend API for handling document-related data.
10
+ * It interacts with the `DocumentStore` for state management and uses `HttpClient` for making HTTP requests.
11
+ * Creates an instance of `DocumentService`.
12
+ * @param {DocumentStore} documentStore - The store that manages the state of documents.
13
+ * @param {HttpClient} http - The Angular HTTP client for making API requests.
14
+ */
15
+ export declare class DocumentService {
16
+ documentStore: DocumentStore;
17
+ private http;
18
+ appConfigService: AppConfigService;
19
+ /**
20
+ * Creates an instance of DocumentService.
21
+ * @param {DocumentStore} documentStore - Store managing the state of documents.
22
+ * @param {HttpClient} http - Angular HTTP client for making API requests.
23
+ * @param {AppConfigService} appConfigService - Service for retrieving application configuration, such as API base URL.
24
+ */
25
+ constructor(documentStore: DocumentStore, http: HttpClient, appConfigService: AppConfigService);
26
+ /**
27
+ * Get api url from appConfigService.
28
+ * @readonly
29
+ * @type {string}
30
+ */
31
+ get apiUrl(): string;
32
+ /**
33
+ * Sends a request to create a new document.
34
+ * @param {*} entity - The data of the document to be created.
35
+ * @returns {Observable<any>} Observable that emits the newly created document.
36
+ */
37
+ create(entity: any): Observable<any>;
38
+ /**
39
+ * Fetches all documents from the backend.
40
+ * @returns {Observable<DocumentModel[]>} Observable that emits an array of documents.
41
+ */
42
+ getAll(): Observable<DocumentModel[]>;
43
+ /**
44
+ * Fetches a document by its ID.
45
+ * @param {string} id - The unique identifier of the document.
46
+ * @returns {Observable<any>} Observable that emits the retrieved document.
47
+ */
48
+ getById(id: string): Observable<any>;
49
+ /**
50
+ * Updates an existing document by its ID.
51
+ * @param {string} id - The unique identifier of the document.
52
+ * @param {DocumentModel} entity - The updated data of the document.
53
+ * @returns {Observable<DocumentModel>} Observable that emits the updated document.
54
+ */
55
+ update(id: string, entity: DocumentModel): Observable<DocumentModel>;
56
+ /**
57
+ * Deletes a document by its ID.
58
+ * @param {string} id - The unique identifier of the document to be deleted.
59
+ * @returns {Observable<void>} Observable that completes when the document is deleted.
60
+ */
61
+ delete(id: string): Observable<void>;
62
+ static ɵfac: i0.ɵɵFactoryDeclaration<DocumentService, never>;
63
+ static ɵprov: i0.ɵɵInjectableDeclaration<DocumentService>;
64
+ }
@@ -1,52 +1,36 @@
1
- import { EntityState } from '@datorama/akita';
2
- import { DocumentModel } from '../models/document.model';
3
- import { DocumentTypeModel } from '../models/document-type.model';
4
- import { DocumentAlertModel } from '../models/document-alert.model';
5
- import { FolderBlockModel } from '../models/folder.model';
6
- import { Message } from 'primeng/api';
7
-
8
- /**
9
- * Represents the state of the documents in the application.
10
- * This interface extends Akita's `EntityState` to include additional properties
11
- * for managing document-specific data, such as `records`, `filteredRecords` and `folderId`.
12
- * @interface DocumentState
13
- * @property {any[]} records - A collection of records related to documents.
14
- * @property {any[]} filteredRecords - A collection of filteredRecords related to documents.
15
- * @property {string | null} folderId - The ID of the currently selected folder, or `null` if no folder is selected.
16
- * @property {boolean} isDialogOpen - A flag indicating whether a dialog is open.
17
- */
18
- export interface DocumentState extends EntityState<DocumentModel, string> {
19
- records: DocumentModel[];
20
- folderId: string | null;
21
- isDialogOpen: boolean;
22
- filteredRecords:DocumentModel[];
23
- dropdownOptions: DocumentTypeModel[];
24
- uploadedDocumentFiles: DocumentModel[];
25
- parentDocumentTypeId: string | null;
26
- documentAlert:DocumentAlertModel
27
- folders:FolderBlockModel[]
28
- messages: Message[]
29
- documentList : DocumentModel[]
30
- }
31
-
32
- /**
33
- * Creates the initial state for the `DocumentState` store.
34
- * This function provides default values for all properties in the `DocumentState` interface,
35
- * ensuring the store starts with a consistent initial structure.
36
- * @returns {DocumentState} The initial state of the document store.
37
- */
38
- export function createInitialState(): DocumentState {
39
- return {
40
- records: [],
41
- filteredRecords: [],
42
- folderId: null,
43
- isDialogOpen: false,
44
- dropdownOptions: [],
45
- uploadedDocumentFiles: [],
46
- parentDocumentTypeId: null,
47
- documentAlert: {_id:''},
48
- folders:[],
49
- messages:[],
50
- documentList : []
51
- };
52
- }
1
+ import { EntityState } from '@datorama/akita';
2
+ import { DocumentModel } from '../models/document.model';
3
+ import { DocumentTypeModel } from '../models/document-type.model';
4
+ import { DocumentAlertModel } from '../models/document-alert.model';
5
+ import { FolderBlockModel } from '../models/folder.model';
6
+ import { Message } from 'primeng/api';
7
+ /**
8
+ * Represents the state of the documents in the application.
9
+ * This interface extends Akita's `EntityState` to include additional properties
10
+ * for managing document-specific data, such as `records`, `filteredRecords` and `folderId`.
11
+ * @interface DocumentState
12
+ * @property {any[]} records - A collection of records related to documents.
13
+ * @property {any[]} filteredRecords - A collection of filteredRecords related to documents.
14
+ * @property {string | null} folderId - The ID of the currently selected folder, or `null` if no folder is selected.
15
+ * @property {boolean} isDialogOpen - A flag indicating whether a dialog is open.
16
+ */
17
+ export interface DocumentState extends EntityState<DocumentModel, string> {
18
+ records: DocumentModel[];
19
+ folderId: string | null;
20
+ isDialogOpen: boolean;
21
+ filteredRecords: DocumentModel[];
22
+ dropdownOptions: DocumentTypeModel[];
23
+ uploadedDocumentFiles: DocumentModel[];
24
+ parentDocumentTypeId: string | null;
25
+ documentAlert: DocumentAlertModel;
26
+ folders: FolderBlockModel[];
27
+ messages: Message[];
28
+ documentList: DocumentModel[];
29
+ }
30
+ /**
31
+ * Creates the initial state for the `DocumentState` store.
32
+ * This function provides default values for all properties in the `DocumentState` interface,
33
+ * ensuring the store starts with a consistent initial structure.
34
+ * @returns {DocumentState} The initial state of the document store.
35
+ */
36
+ export declare function createInitialState(): DocumentState;
@@ -0,0 +1,29 @@
1
+ import { EntityStore } from '@datorama/akita';
2
+ import { DocumentState } from './document.state';
3
+ import { Message } from 'primeng/api';
4
+ import { DocumentModel } from '../models/document.model';
5
+ import * as i0 from "@angular/core";
6
+ /**
7
+ * Store that manages the state of documents in the application.
8
+ * The `DocumentStore` class extends Akita's `EntityStore` to manage the entity state for documents.
9
+ * It uses the `createInitialState` function to initialize the store with default values and
10
+ * is configured with the name `'documents'`.
11
+ * @augments EntityStore<DocumentState>
12
+ */
13
+ export declare class DocumentStore extends EntityStore<DocumentState> {
14
+ /**
15
+ * Creates an instance of `DocumentStore` with the initial state of the documents.
16
+ */
17
+ constructor();
18
+ setUploadedDocumentFiles(files: any[]): void;
19
+ setFolders(folders: any): void;
20
+ setDocumentTypes(documentType: any): void;
21
+ setDocumentAlert(documentAlert: any): void;
22
+ setParentDocumentTypeId(parentDocumentTypeId: string): void;
23
+ setMessage(message: Message[]): void;
24
+ setDocumentList(documents: DocumentModel[]): void;
25
+ setSelectedDocument(selectedDocument: any): void;
26
+ setIsDocumentUpdated(isDocumentUpdated: any): void;
27
+ static ɵfac: i0.ɵɵFactoryDeclaration<DocumentStore, never>;
28
+ static ɵprov: i0.ɵɵInjectableDeclaration<DocumentStore>;
29
+ }
package/package.json CHANGED
@@ -1,20 +1,25 @@
1
- {
2
- "name": "cat-documents-ng",
3
-
4
- "version": "0.1.30",
5
- "peerDependencies": {
6
- "@angular/common": "^19.0.0",
7
- "@angular/core": "^19.0.0"
8
- },
9
- "dependencies": {
10
- "tslib": "^2.3.0"
11
- },
12
- "typings": "index.d.ts",
13
- "sideEffects": false,
14
- "main": "bundles/cat-document-lib.umd.js",
15
- "module": "fesm2015/cat-document-lib.js",
16
- "es2015": "fesm2015/cat-document-lib.js",
17
- "devDependencies": {
18
- "@types/jest": "^29.5.14"
19
- }
20
- }
1
+ {
2
+ "name": "cat-documents-ng",
3
+ "version": "0.1.32",
4
+ "peerDependencies": {
5
+ "@angular/common": "^19.0.0",
6
+ "@angular/core": "^19.0.0"
7
+ },
8
+ "dependencies": {
9
+ "tslib": "^2.3.0"
10
+ },
11
+ "typings": "index.d.ts",
12
+ "sideEffects": false,
13
+ "main": "bundles/cat-document-lib.umd.js",
14
+ "module": "fesm2022/cat-documents-ng.mjs",
15
+ "es2015": "fesm2015/cat-document-lib.js",
16
+ "exports": {
17
+ "./package.json": {
18
+ "default": "./package.json"
19
+ },
20
+ ".": {
21
+ "types": "./index.d.ts",
22
+ "default": "./fesm2022/cat-documents-ng.mjs"
23
+ }
24
+ }
25
+ }
@@ -1,10 +1,6 @@
1
- /*
2
- * Public API Surface of cat-document-lib
3
- */
4
-
5
- export * from './lib/document/document.module';
6
- export * from './lib/document/components/document-container/document-container.component';
7
- export * from './lib/document/components/document-viewer/document-viewer.component';
8
- export * from './lib/document/components/document-list/document-list.component';
9
- export * from './lib/document/directives/document.directive';
10
- export * from './lib/document/directives/permission.directive';
1
+ export * from './lib/document/document.module';
2
+ export * from './lib/document/components/document-container/document-container.component';
3
+ export * from './lib/document/components/document-viewer/document-viewer.component';
4
+ export * from './lib/document/components/document-list/document-list.component';
5
+ export * from './lib/document/directives/document.directive';
6
+ export * from './lib/document/directives/permission.directive';
package/ng-package.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/cat-document-lib",
4
- "lib": {
5
- "entryFile": "src/public-api.ts"
6
- },
7
- "assets": [
8
- "src/assets"
9
- ]
10
-
11
- }
@@ -1,16 +0,0 @@
1
-
2
- /**
3
- * Storing all permission properties.
4
- * @export
5
- * @class PERMISSIONS
6
- * @typedef {PERMISSIONS}
7
- */
8
- export class PERMISSIONS{
9
-
10
- /**
11
- * Access permission.
12
- * @static
13
- * @type {string}
14
- */
15
- static DOCUMENT_POST = 'Documents-POST'
16
- }