@sarafapp/iron_core 1.0.17

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 (136) hide show
  1. package/dist/IronCore.js +2469 -0
  2. package/dist/IronCore.umd.cjs +2 -0
  3. package/dist/index.d.ts +29 -0
  4. package/dist/src/BaseModel.d.ts +45 -0
  5. package/dist/src/Utils.d.ts +4 -0
  6. package/dist/src/accessHandling/AccessControl.d.ts +10 -0
  7. package/dist/src/accessHandling/AccessLevel.d.ts +13 -0
  8. package/dist/src/accessHandling/Accessible.d.ts +3 -0
  9. package/dist/src/accessHandling/EveryDirectiveAccess.d.ts +4 -0
  10. package/dist/src/accessHandling/SSO/AuthorizationDirective.d.ts +17 -0
  11. package/dist/src/accessHandling/SSO/AuthorizationService.d.ts +17 -0
  12. package/dist/src/accessHandling/SSO/EveryLevelAuthorizationDirective.d.ts +4 -0
  13. package/dist/src/accessHandling/SSO/SomeLevelsAuthorizationDirective.d.ts +4 -0
  14. package/dist/src/accessHandling/SomeDirectiveAccess.d.ts +4 -0
  15. package/dist/src/accessHandling/index.d.ts +9 -0
  16. package/dist/src/baseDirective/BeforeMountDirective.d.ts +3 -0
  17. package/dist/src/baseDirective/BeforeUnMountDirective.d.ts +3 -0
  18. package/dist/src/baseDirective/BeforeUpdateDirective.d.ts +3 -0
  19. package/dist/src/baseDirective/CreatedDirective.d.ts +3 -0
  20. package/dist/src/baseDirective/MountedDirective.d.ts +3 -0
  21. package/dist/src/baseDirective/UnMountedDirective.d.ts +3 -0
  22. package/dist/src/baseDirective/UpdateDirective.d.ts +3 -0
  23. package/dist/src/baseDirective/index.d.ts +7 -0
  24. package/dist/src/baseForm/FormManager.d.ts +17 -0
  25. package/dist/src/baseForm/InputControl.d.ts +36 -0
  26. package/dist/src/baseForm/InputControlBuilder.d.ts +14 -0
  27. package/dist/src/baseForm/InputControlData.d.ts +13 -0
  28. package/dist/src/baseForm/TouchSensitiveForm.d.ts +9 -0
  29. package/dist/src/baseForm/UseForm.d.ts +5 -0
  30. package/dist/src/baseForm/index.d.ts +6 -0
  31. package/dist/src/baseSchedule/Schedule.d.ts +3 -0
  32. package/dist/src/baseSchedule/Scheduler.d.ts +8 -0
  33. package/dist/src/baseSchedule/index.d.ts +2 -0
  34. package/dist/src/baseTable/BaseTable.d.ts +46 -0
  35. package/dist/src/baseTable/Constants.d.ts +12 -0
  36. package/dist/src/baseTable/OnDestory.d.ts +3 -0
  37. package/dist/src/baseTable/RowActionSource.d.ts +4 -0
  38. package/dist/src/baseTable/RowClick.d.ts +3 -0
  39. package/dist/src/baseTable/RowDoubleClick.d.ts +3 -0
  40. package/dist/src/baseTable/RowMetaClick.d.ts +3 -0
  41. package/dist/src/baseTable/SelectableTable.d.ts +19 -0
  42. package/dist/src/baseTable/TableAction.d.ts +8 -0
  43. package/dist/src/baseTable/TableHeaderSchema.d.ts +27 -0
  44. package/dist/src/baseTable/TableLoader.d.ts +3 -0
  45. package/dist/src/baseTable/TablePaginate.d.ts +3 -0
  46. package/dist/src/baseTable/TableService.d.ts +9 -0
  47. package/dist/src/baseTable/TableSort.d.ts +4 -0
  48. package/dist/src/baseTable/TableSummarySchema.d.ts +9 -0
  49. package/dist/src/baseTable/index.d.ts +15 -0
  50. package/dist/src/baseTable/moduleConnection/Action.d.ts +3 -0
  51. package/dist/src/baseTable/moduleConnection/Column.d.ts +3 -0
  52. package/dist/src/baseTable/moduleConnection/Table.d.ts +4 -0
  53. package/dist/src/baseTable/moduleConnection/TableDestroy.d.ts +2 -0
  54. package/dist/src/baseTable/moduleConnection/TableRowClick.d.ts +2 -0
  55. package/dist/src/composables/UseCrud.d.ts +10 -0
  56. package/dist/src/composables/UseData.d.ts +14 -0
  57. package/dist/src/composables/UseLoadingStatus.d.ts +15 -0
  58. package/dist/src/composables/UseParams.d.ts +15 -0
  59. package/dist/src/composables/UseRepository.d.ts +63 -0
  60. package/dist/src/composables/UseStaticTableService.d.ts +4 -0
  61. package/dist/src/composables/index.d.ts +6 -0
  62. package/dist/src/constants/Constants.d.ts +108 -0
  63. package/dist/src/constants/index.d.ts +1 -0
  64. package/dist/src/crudService/CrudService.d.ts +22 -0
  65. package/dist/src/crudService/index.d.ts +1 -0
  66. package/dist/src/dateHandling/Constants.d.ts +5 -0
  67. package/dist/src/dateHandling/Converter.d.ts +5 -0
  68. package/dist/src/dateHandling/JalaliDateSetup.d.ts +1 -0
  69. package/dist/src/dateHandling/Model.d.ts +12 -0
  70. package/dist/src/dateHandling/Utils.d.ts +8 -0
  71. package/dist/src/dateHandling/index.d.ts +5 -0
  72. package/dist/src/debounce/DebounceAction.d.ts +4 -0
  73. package/dist/src/debounce/DebounceService.d.ts +9 -0
  74. package/dist/src/debounce/index.d.ts +2 -0
  75. package/dist/src/deviceManagement/Constants.d.ts +4 -0
  76. package/dist/src/deviceManagement/Visibility.d.ts +4 -0
  77. package/dist/src/deviceManagement/VisibilityManager.d.ts +6 -0
  78. package/dist/src/deviceManagement/index.d.ts +3 -0
  79. package/dist/src/errorHandling/ErrorHandler.d.ts +3 -0
  80. package/dist/src/errorHandling/HandleError.d.ts +2 -0
  81. package/dist/src/errorHandling/index.d.ts +2 -0
  82. package/dist/src/feedbackHandling/FailureFeedback.d.ts +3 -0
  83. package/dist/src/feedbackHandling/Feedback.d.ts +11 -0
  84. package/dist/src/feedbackHandling/HandleFeedback.d.ts +2 -0
  85. package/dist/src/feedbackHandling/InfoFeedback.d.ts +3 -0
  86. package/dist/src/feedbackHandling/SuccessFeedback.d.ts +3 -0
  87. package/dist/src/feedbackHandling/WarningFeedback.d.ts +3 -0
  88. package/dist/src/feedbackHandling/index.d.ts +6 -0
  89. package/dist/src/httpClient/ApiBuilder.d.ts +14 -0
  90. package/dist/src/httpClient/ErrorHandlerRegistry.d.ts +10 -0
  91. package/dist/src/httpClient/HttpClient.d.ts +14 -0
  92. package/dist/src/httpClient/Interceptor.d.ts +4 -0
  93. package/dist/src/httpClient/index.d.ts +4 -0
  94. package/dist/src/initializer/ApplicationInitializer.d.ts +6 -0
  95. package/dist/src/initializer/Initializer.d.ts +3 -0
  96. package/dist/src/initializer/index.d.ts +2 -0
  97. package/dist/src/json/JsonMapper.d.ts +18 -0
  98. package/dist/src/json/index.d.ts +1 -0
  99. package/dist/src/layout/Constants.d.ts +10 -0
  100. package/dist/src/layout/DialogService.d.ts +1 -0
  101. package/dist/src/layout/DrawerService.d.ts +1 -0
  102. package/dist/src/layout/Toast.d.ts +8 -0
  103. package/dist/src/layout/index.d.ts +4 -0
  104. package/dist/src/lib/Constants.d.ts +20 -0
  105. package/dist/src/lib/Formatter.d.ts +10 -0
  106. package/dist/src/lib/Util.d.ts +11 -0
  107. package/dist/src/lib/index.d.ts +3 -0
  108. package/dist/src/observables/AbstractSubject.d.ts +7 -0
  109. package/dist/src/observables/BehaviorSubject.d.ts +15 -0
  110. package/dist/src/observables/Observer.d.ts +3 -0
  111. package/dist/src/observables/Subject.d.ts +6 -0
  112. package/dist/src/observables/index.d.ts +4 -0
  113. package/dist/src/process/Proccess.d.ts +9 -0
  114. package/dist/src/process/ProcessManager.d.ts +10 -0
  115. package/dist/src/process/index.d.ts +2 -0
  116. package/dist/src/repository/Params.d.ts +11 -0
  117. package/dist/src/repository/Repository.d.ts +38 -0
  118. package/dist/src/repository/SyncDetail.d.ts +5 -0
  119. package/dist/src/repository/index.d.ts +4 -0
  120. package/dist/src/repository/model.d.ts +5 -0
  121. package/dist/src/routeGuard/RouteGuard.d.ts +6 -0
  122. package/dist/src/routeGuard/index.d.ts +1 -0
  123. package/dist/src/search/client/ClientArraySearch.d.ts +4 -0
  124. package/dist/src/search/client/ClientSearch.d.ts +3 -0
  125. package/dist/src/search/index.d.ts +2 -0
  126. package/dist/src/sort/SortDetail.d.ts +6 -0
  127. package/dist/src/sort/client/Sorter.d.ts +6 -0
  128. package/dist/src/sort/index.d.ts +4 -0
  129. package/dist/src/sort/strategies/SimpleSort.d.ts +5 -0
  130. package/dist/src/sort/strategies/SortStrategy.d.ts +4 -0
  131. package/dist/src/types/Global.d.ts +1 -0
  132. package/dist/src/types/index.d.ts +1 -0
  133. package/dist/src/validators/Validator.d.ts +4 -0
  134. package/dist/src/validators/index.d.ts +1 -0
  135. package/dist/vite.config.d.ts +2 -0
  136. package/package.json +38 -0
@@ -0,0 +1,10 @@
1
+ export declare const enum ToastType {
2
+ Success = "success",
3
+ Failure = "error",
4
+ Info = "info",
5
+ Warning = "warning"
6
+ }
7
+ export declare const enum ToastLocation {
8
+ BottomLeft = "bottomLeft",
9
+ TopLeft = "topLeft"
10
+ }
@@ -0,0 +1 @@
1
+ export declare const useDialogService: any;
@@ -0,0 +1 @@
1
+ export declare const useDrawerService: any;
@@ -0,0 +1,8 @@
1
+ import { ToastLocation, ToastType } from './Constants';
2
+ export declare class ToastMessage {
3
+ type: ToastType;
4
+ message: string;
5
+ description: string;
6
+ placement: ToastLocation;
7
+ constructor(type: ToastType, message: string, description: string);
8
+ }
@@ -0,0 +1,4 @@
1
+ export { ToastLocation, ToastType } from './Constants';
2
+ export { ToastMessage } from './Toast';
3
+ export { useDialogService } from './DialogService';
4
+ export { useDrawerService } from './DrawerService';
@@ -0,0 +1,20 @@
1
+ export declare const enum CommonMaskFormats {
2
+ BankCard = "####-####-####-####",
3
+ Iban = "##-####-####-####-####-####-##"
4
+ }
5
+ export declare const enum DateFormat {
6
+ FullDate = "jYYYY/jM/jD HH:mm",
7
+ SimpleDate = "jYYYY/jM/jD",
8
+ CompactGregorianDate = "YYYYMMDD",
9
+ ShortJalaliDate = "YYMM",
10
+ JustHour = "HH:mm:ss"
11
+ }
12
+ interface Bank {
13
+ [identifier: string | number]: {
14
+ persian: string;
15
+ english: string;
16
+ };
17
+ }
18
+ export declare const cards: Array<Bank>;
19
+ export declare const ibans: Array<Bank>;
20
+ export {};
@@ -0,0 +1,10 @@
1
+ import { DateFormat } from './Constants';
2
+ export declare class Formatter {
3
+ static toCurrency(amount: number, options: unknown): string;
4
+ static toCurrencyWithDotSeparator(amount: number): string;
5
+ static applyMask(format: string, value: string): string;
6
+ static applyBankCardMask(value: number | string): string;
7
+ static applyIbanMask(value: number | string): string;
8
+ static toEnglishDigits(value: string): string;
9
+ static mapUnixToDate(unixValue: number, format: DateFormat): any;
10
+ }
@@ -0,0 +1,11 @@
1
+ import { AxiosResponse } from 'axios';
2
+ export declare class Util {
3
+ static getBankImageBaseOnCardInfo(account_number: string | undefined, type: "IBAN" | "CARD"): string;
4
+ private static card;
5
+ private static iban;
6
+ static copyValueToClipboard(value: string | number): Promise<void>;
7
+ static downloadBlob(response: AxiosResponse<Blob>, fileName?: string): void;
8
+ private static extractFileNameFromHeader;
9
+ static removeSpacesFromString(value: string): string;
10
+ static isArraySorted<T>(items: T[], itemResolver?: (item: T) => T, order?: any): boolean;
11
+ }
@@ -0,0 +1,3 @@
1
+ export * from './Constants';
2
+ export * from './Formatter';
3
+ export * from './Util';
@@ -0,0 +1,7 @@
1
+ import { Observer } from './Observer';
2
+ export declare abstract class AbstractSubject {
3
+ private observers;
4
+ attach(observer: Observer<AbstractSubject>): void;
5
+ detach(observer: Observer<AbstractSubject>): void;
6
+ protected notify(): void;
7
+ }
@@ -0,0 +1,15 @@
1
+ import { Subject } from './Subject';
2
+ import { Observer } from './Observer';
3
+ export type ObserverCallback<T> = (value: T) => void;
4
+ type ObserverUpdaterCallback<T> = (value: T) => T;
5
+ export declare class BehaviorSubject<T> implements Subject<T> {
6
+ private _value;
7
+ private observers;
8
+ constructor(value: T);
9
+ attach(observer: Observer<T> | ObserverCallback<T>): void;
10
+ detach(observer: Observer<T> | ObserverCallback<T>): void;
11
+ notify(): void;
12
+ next(newValue: T | ObserverUpdaterCallback<T>): void;
13
+ getValue(): T;
14
+ }
15
+ export {};
@@ -0,0 +1,3 @@
1
+ export interface Observer<T> {
2
+ update(subject: T): void;
3
+ }
@@ -0,0 +1,6 @@
1
+ import { Observer } from './Observer';
2
+ export interface Subject<T> {
3
+ attach(observer: Observer<T>): void;
4
+ detach(observer: Observer<T>): void;
5
+ notify(): void;
6
+ }
@@ -0,0 +1,4 @@
1
+ export { AbstractSubject } from './AbstractSubject';
2
+ export { type Observer } from './Observer';
3
+ export { type ObserverCallback, BehaviorSubject } from './BehaviorSubject';
4
+ export { type Subject } from './Subject';
@@ -0,0 +1,9 @@
1
+ import { Nullable } from '../types/Global';
2
+ import { ProcessManager } from './ProcessManager';
3
+ export declare abstract class Process {
4
+ name: string;
5
+ next: Nullable<Process>;
6
+ constructor(name: string, next: Nullable<Process>);
7
+ addToManager(manager: ProcessManager): void;
8
+ abstract execute(): Promise<void>;
9
+ }
@@ -0,0 +1,10 @@
1
+ import { Process } from './Proccess';
2
+ export declare class ProcessManager {
3
+ private mapProcesses;
4
+ private processes;
5
+ constructor(process: Process);
6
+ private assignProcessManager;
7
+ setProcessToMap(process: Process): void;
8
+ start(): Promise<void>;
9
+ startFrom(processName: string): Promise<void>;
10
+ }
@@ -0,0 +1,2 @@
1
+ export { ProcessManager } from './ProcessManager.ts';
2
+ export { Process } from './Proccess';
@@ -0,0 +1,11 @@
1
+ import { SortDetail } from '../sort';
2
+ import { BaseModel } from '../BaseModel';
3
+ export declare class Params {
4
+ pageNumber: number;
5
+ itemCount: number;
6
+ sortDetail: SortDetail<BaseModel>;
7
+ filters: {
8
+ key: string;
9
+ value: unknown;
10
+ }[];
11
+ }
@@ -0,0 +1,38 @@
1
+ import { BaseModel } from '../BaseModel';
2
+ import { FetchListResponse } from './model';
3
+ import { Nullable } from '../types';
4
+ import { SyncDetail } from './SyncDetail';
5
+ export interface Repository<Model extends BaseModel> {
6
+ /**
7
+ * Fetches a list of items based on optional query parameters.
8
+ * @param query - Optional query parameters.
9
+ * @returns A promise resolving to an array of items or undefined.
10
+ */
11
+ fetchList(query?: Record<string, unknown>): Promise<FetchListResponse<Model>>;
12
+ /**
13
+ * Fetches a single item by its ID.
14
+ * @param id - ID of the item to retrieve.
15
+ * @returns A promise resolving to the fetched item or undefined.
16
+ */
17
+ fetchItemById(id: number): Promise<Nullable<Model>>;
18
+ /**
19
+ * Creates a new item.
20
+ * @param body - Data for creating the item.
21
+ * @returns A promise resolving to the created item or undefined.
22
+ */
23
+ createItem<Body>(body: Body): Promise<Nullable<Model>>;
24
+ /**
25
+ * Updates an existing item by its ID.
26
+ * @param id - ID of the item to update.
27
+ * @param body - Updated data for the item.
28
+ * @returns A promise resolving to the updated item or undefined.
29
+ */
30
+ updateItem<Body>(id: number, body: Body): Promise<Nullable<Model>>;
31
+ /**
32
+ * Deletes an item by its ID.
33
+ * @param id - ID of the item to delete.
34
+ * @returns A promise resolving to a boolean indicating if the deletion was successful.
35
+ */
36
+ deleteItem(id: number): Promise<boolean>;
37
+ getSyncDetail(): SyncDetail;
38
+ }
@@ -0,0 +1,5 @@
1
+ export declare class SyncDetail {
2
+ shouldKeepSync: boolean;
3
+ intervalInMillisecond: number;
4
+ constructor(shouldKeepSync: boolean, intervalInMillisecond: number);
5
+ }
@@ -0,0 +1,4 @@
1
+ export { Params } from './Params';
2
+ export { type Repository } from './Repository';
3
+ export { FetchListResponse } from './model';
4
+ export { SyncDetail } from './SyncDetail';
@@ -0,0 +1,5 @@
1
+ export declare class FetchListResponse<Model> {
2
+ items: Model[];
3
+ totalItems: number;
4
+ constructor(items: Model[], totalItems: number);
5
+ }
@@ -0,0 +1,6 @@
1
+ export declare abstract class RouteGuard {
2
+ protected constructor();
3
+ checkAccessibility(to: unknown, from: unknown, next: CallableFunction): Promise<void>;
4
+ protected abstract isAccessible(to: unknown, from: unknown): Promise<boolean>;
5
+ protected getDestinationRouteName(): Promise<string>;
6
+ }
@@ -0,0 +1 @@
1
+ export { RouteGuard } from './RouteGuard';
@@ -0,0 +1,4 @@
1
+ import { ClientSearch } from './ClientSearch';
2
+ export declare class ClientArraySearch<T> extends ClientSearch {
3
+ search(items: T[], phrase: string, column: (item: T) => (string | number)[]): T[];
4
+ }
@@ -0,0 +1,3 @@
1
+ export declare abstract class ClientSearch {
2
+ abstract search(items: unknown, phrase: string, column: (item: unknown) => (string | number)[]): unknown;
3
+ }
@@ -0,0 +1,2 @@
1
+ export { ClientSearch } from './client/ClientSearch';
2
+ export { ClientArraySearch } from './client/ClientArraySearch';
@@ -0,0 +1,6 @@
1
+ import { SortOrder } from '../constants';
2
+ export declare class SortDetail<T> {
3
+ key: keyof T;
4
+ order: SortOrder;
5
+ constructor(key: keyof T, order: SortOrder);
6
+ }
@@ -0,0 +1,6 @@
1
+ import { SortOrder } from '../../constants/Constants';
2
+ import { SortStrategy } from '../strategies/SortStrategy';
3
+ export declare class Sorter {
4
+ arrayOfObjectSort<T>(items: T[], by: keyof T, order: SortOrder, strategy?: SortStrategy<T>): T[];
5
+ arraySort(items: number[] | string[], order: SortOrder, strategy?: SortStrategy<string | number>): (string | number)[];
6
+ }
@@ -0,0 +1,4 @@
1
+ export { SortDetail } from './SortDetail';
2
+ export * from './client/Sorter';
3
+ export * from './strategies/SortStrategy';
4
+ export * from './strategies/SimpleSort';
@@ -0,0 +1,5 @@
1
+ import { SortStrategy } from './SortStrategy';
2
+ export declare class SimpleSort<T> implements SortStrategy<T> {
3
+ aSort(items: T[], by?: keyof T): T[];
4
+ bSort(items: T[], by?: keyof T): T[];
5
+ }
@@ -0,0 +1,4 @@
1
+ export interface SortStrategy<T> {
2
+ aSort(items: T[], by?: keyof T): T[];
3
+ bSort(items: T[], by?: keyof T): T[];
4
+ }
@@ -0,0 +1 @@
1
+ export type Nullable<T> = T | null;
@@ -0,0 +1 @@
1
+ export * from './Global';
@@ -0,0 +1,4 @@
1
+ import { Nullable } from '../types';
2
+ export interface Validator<T> {
3
+ validate(value: Nullable<T>): string;
4
+ }
@@ -0,0 +1 @@
1
+ export { type Validator } from './Validator';
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@sarafapp/iron_core",
3
+ "private": false,
4
+ "version": "1.0.17",
5
+ "type": "module",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "main": "./dist/IronCore.umd.cjs",
10
+ "module": "./dist/IronCore.js",
11
+ "scripts": {
12
+ "dev": "vite",
13
+ "build": "vite build",
14
+ "preview": "vite preview"
15
+ },
16
+ "dependencies": {
17
+ "axios": "^1.6.3",
18
+ "dayjs": "^1.11.13",
19
+ "jalaliday": "^2.3.0",
20
+ "json2typescript": "^1.6.1",
21
+ "pinia": "^3.0.2",
22
+ "jalali-plugin-dayjs": "^1.1.4"
23
+ },
24
+ "devDependencies": {
25
+ "typescript": "~5.7.2",
26
+ "vite": "^6.2.0",
27
+ "vite-plugin-dts": "^4.5.4",
28
+ "vue": "^3.5.13"
29
+ },
30
+ "types": "dist/index.d.ts",
31
+ "exports": {
32
+ ".": {
33
+ "import": "./dist/IronCore.js",
34
+ "require": "./dist/IronCore.umd.cjs",
35
+ "types": "./dist/index.d.ts"
36
+ }
37
+ }
38
+ }