@react-pakistan/util-functions 1.24.99 → 1.25.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.
Files changed (73) hide show
  1. package/api/stellar-solutions/app-user/index.d.ts +9 -9
  2. package/api/stellar-solutions/app-user/index.js +4 -4
  3. package/api/stellar-solutions/bank/cache.d.ts +99 -0
  4. package/api/stellar-solutions/bank/cache.js +256 -0
  5. package/api/stellar-solutions/bank/index.d.ts +10 -10
  6. package/api/stellar-solutions/bank/index.js +19 -4
  7. package/api/stellar-solutions/branch/cache.d.ts +97 -0
  8. package/api/stellar-solutions/branch/cache.js +256 -0
  9. package/api/stellar-solutions/branch/index.d.ts +10 -10
  10. package/api/stellar-solutions/branch/index.js +19 -4
  11. package/api/stellar-solutions/company/cache.d.ts +106 -0
  12. package/api/stellar-solutions/company/cache.js +307 -0
  13. package/api/stellar-solutions/company/index.d.ts +10 -10
  14. package/api/stellar-solutions/company/index.js +19 -4
  15. package/api/stellar-solutions/company-report/index.d.ts +3 -3
  16. package/api/stellar-solutions/company-report/index.js +1 -1
  17. package/api/stellar-solutions/constants.d.ts +12 -0
  18. package/api/stellar-solutions/constants.js +13 -1
  19. package/api/stellar-solutions/contact/cache.d.ts +108 -0
  20. package/api/stellar-solutions/contact/cache.js +307 -0
  21. package/api/stellar-solutions/contact/index.d.ts +10 -10
  22. package/api/stellar-solutions/contact/index.js +19 -4
  23. package/api/stellar-solutions/currency/cache.d.ts +99 -0
  24. package/api/stellar-solutions/currency/cache.js +256 -0
  25. package/api/stellar-solutions/currency/index.d.ts +10 -10
  26. package/api/stellar-solutions/currency/index.js +19 -4
  27. package/api/stellar-solutions/customer/cache.d.ts +108 -0
  28. package/api/stellar-solutions/customer/cache.js +307 -0
  29. package/api/stellar-solutions/customer/index.d.ts +12 -12
  30. package/api/stellar-solutions/customer/index.js +20 -5
  31. package/api/stellar-solutions/expense/cache.d.ts +106 -0
  32. package/api/stellar-solutions/expense/cache.js +307 -0
  33. package/api/stellar-solutions/expense/index.d.ts +10 -10
  34. package/api/stellar-solutions/expense/index.js +19 -4
  35. package/api/stellar-solutions/expense-category/cache.d.ts +94 -0
  36. package/api/stellar-solutions/expense-category/cache.js +280 -0
  37. package/api/stellar-solutions/expense-category/index.d.ts +10 -10
  38. package/api/stellar-solutions/expense-category/index.js +19 -4
  39. package/api/stellar-solutions/lead/index.d.ts +9 -9
  40. package/api/stellar-solutions/lead/index.js +4 -4
  41. package/api/stellar-solutions/menu-order/index.d.ts +9 -9
  42. package/api/stellar-solutions/menu-order/index.js +4 -4
  43. package/api/stellar-solutions/payment/index.d.ts +9 -9
  44. package/api/stellar-solutions/payment/index.js +4 -4
  45. package/api/stellar-solutions/payment-mode/cache.d.ts +97 -0
  46. package/api/stellar-solutions/payment-mode/cache.js +256 -0
  47. package/api/stellar-solutions/payment-mode/index.d.ts +10 -10
  48. package/api/stellar-solutions/payment-mode/index.js +19 -4
  49. package/api/stellar-solutions/preference/cache.d.ts +85 -0
  50. package/api/stellar-solutions/preference/cache.js +229 -0
  51. package/api/stellar-solutions/preference/index.d.ts +6 -6
  52. package/api/stellar-solutions/preference/index.js +17 -2
  53. package/api/stellar-solutions/product/cache.d.ts +9 -9
  54. package/api/stellar-solutions/product/cache.js +4 -4
  55. package/api/stellar-solutions/product/index.d.ts +9 -9
  56. package/api/stellar-solutions/product/index.js +4 -4
  57. package/api/stellar-solutions/product-category/cache.d.ts +9 -9
  58. package/api/stellar-solutions/product-category/cache.js +4 -4
  59. package/api/stellar-solutions/product-category/index.d.ts +9 -9
  60. package/api/stellar-solutions/product-category/index.js +4 -4
  61. package/api/stellar-solutions/profile/index.d.ts +13 -13
  62. package/api/stellar-solutions/profile/index.js +6 -6
  63. package/api/stellar-solutions/quote-invoice/index.d.ts +9 -9
  64. package/api/stellar-solutions/quote-invoice/index.js +4 -4
  65. package/api/stellar-solutions/quote-invoice-report/index.d.ts +3 -3
  66. package/api/stellar-solutions/quote-invoice-report/index.js +1 -1
  67. package/api/stellar-solutions/tax/cache.d.ts +97 -0
  68. package/api/stellar-solutions/tax/cache.js +256 -0
  69. package/api/stellar-solutions/tax/index.d.ts +10 -10
  70. package/api/stellar-solutions/tax/index.js +19 -4
  71. package/api/stellar-solutions/type.d.ts +57 -46
  72. package/api/stellar-solutions/type.js +11 -0
  73. package/package.json +1 -1
@@ -0,0 +1,280 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
24
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
50
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
51
+ if (ar || !(i in from)) {
52
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
53
+ ar[i] = from[i];
54
+ }
55
+ }
56
+ return to.concat(ar || Array.prototype.slice.call(from));
57
+ };
58
+ Object.defineProperty(exports, "__esModule", { value: true });
59
+ exports.isExpenseCategoriesCacheStale = exports.preloadExpenseCategories = exports.invalidateExpenseCategoriesCache = exports.getCachedExpenseCategoryById = exports.getCachedExpenseCategories = exports.getCachedExpenseCategoriesSync = void 0;
60
+ var constants_1 = require("../constants");
61
+ var type_1 = require("../type");
62
+ var api_methods_1 = require("../../../constants/api-methods");
63
+ var fetch_data_1 = require("../../../general/fetch-data");
64
+ var get_storage_value_1 = require("../../../local-storage/get-storage-value");
65
+ var set_storage_value_1 = require("../../../local-storage/set-storage-value");
66
+ /**
67
+ * Synchronous utility function to get expense categories from cache only
68
+ * Returns cached data immediately if available and fresh, otherwise returns empty array
69
+ * Does not trigger any API calls
70
+ *
71
+ * @returns ExpenseCategoryBE[] - Array of cached expense categories or empty array wrapper ({count, items})
72
+ *
73
+ * @example
74
+ * const expenseCategories = getCachedExpenseCategoriesSync();
75
+ * if (expenseCategories.items.length > 0) {
76
+ * console.log(expenseCategories.items[0].name);
77
+ * }
78
+ */
79
+ var getCachedExpenseCategoriesSync = function () {
80
+ try {
81
+ var cachedData = (0, get_storage_value_1.getStorageValue)(type_1.LS_KEYS.EXPENSE_CATEGORIES);
82
+ if (!cachedData) {
83
+ return { count: 0, items: [] };
84
+ }
85
+ var currentTime = new Date().getTime();
86
+ var cachedTime = new Date(cachedData.cachedAt).getTime();
87
+ var ageInMs = currentTime - cachedTime;
88
+ // If cached data is less than 1 day old, return it
89
+ if (ageInMs < constants_1.ONE_DAY_IN_MS) {
90
+ return {
91
+ count: cachedData.expenseCategories.length,
92
+ items: cachedData.expenseCategories,
93
+ };
94
+ }
95
+ return { count: 0, items: [] };
96
+ }
97
+ catch (error) {
98
+ console.error('Error getting cached expense categories:', error);
99
+ return { count: 0, items: [] };
100
+ }
101
+ };
102
+ exports.getCachedExpenseCategoriesSync = getCachedExpenseCategoriesSync;
103
+ /**
104
+ * Utility function to get expense categories from cache or fetch from API
105
+ *
106
+ * This function manages a localStorage cache of expense categories with the following logic:
107
+ * - If expense categories exist in cache and are less than 1 day old, return cached version
108
+ * - If expense categories exist but are older than 1 day, fetch fresh data and update cache
109
+ * - If expense categories don't exist in cache, fetch from API and cache them
110
+ *
111
+ * @param searchQuery - Optional search query to filter expense categories
112
+ * @param filters - Optional filters object to apply additional filtering (bypasses cache)
113
+ * @param pageLimit - Number of expense categories to fetch (default: 100)
114
+ * @returns Promise<{count:number, items: ExpenseCategoryBE[]}> - Paged expense categories
115
+ *
116
+ * @example
117
+ * const expenseCategories = await getCachedExpenseCategories();
118
+ * console.log(expenseCategories.items[0].name);
119
+ *
120
+ * // With search
121
+ * const filtered = await getCachedExpenseCategories('Travel');
122
+ *
123
+ * // With filters
124
+ * const filteredByColor = await getCachedExpenseCategories(undefined, { color: '#FF0000' });
125
+ */
126
+ var getCachedExpenseCategories = function (searchQuery_1, filters_1) {
127
+ var args_1 = [];
128
+ for (var _i = 2; _i < arguments.length; _i++) {
129
+ args_1[_i - 2] = arguments[_i];
130
+ }
131
+ return __awaiter(void 0, __spreadArray([searchQuery_1, filters_1], args_1, true), void 0, function (searchQuery, filters, pageLimit) {
132
+ var response_1, cachedData, currentTime, cachedTime, ageInMs, response, updatedCache, error_1;
133
+ var _a;
134
+ if (pageLimit === void 0) { pageLimit = 100; }
135
+ return __generator(this, function (_b) {
136
+ switch (_b.label) {
137
+ case 0:
138
+ _b.trys.push([0, 4, , 5]);
139
+ if (!((searchQuery && searchQuery.trim()) ||
140
+ (filters && Object.keys(filters).length > 0))) return [3 /*break*/, 2];
141
+ return [4 /*yield*/, (0, fetch_data_1.fetchData)({
142
+ url: constants_1.API_ROUTES.EXPENSE_CATEGORIES,
143
+ body: JSON.stringify(__assign(__assign({ searchQuery: searchQuery }, filters), { pageLimit: pageLimit, currentPage: 1 })),
144
+ method: api_methods_1.API_METHODS.POST,
145
+ })];
146
+ case 1:
147
+ response_1 = _b.sent();
148
+ return [2 /*return*/, (response_1 === null || response_1 === void 0 ? void 0 : response_1.data) || { count: 0, items: [] }];
149
+ case 2:
150
+ cachedData = (0, get_storage_value_1.getStorageValue)(type_1.LS_KEYS.EXPENSE_CATEGORIES);
151
+ currentTime = new Date().getTime();
152
+ // Check if cached data exists and is still fresh
153
+ if (cachedData) {
154
+ cachedTime = new Date(cachedData.cachedAt).getTime();
155
+ ageInMs = currentTime - cachedTime;
156
+ // If cached data is less than 1 day old, return it
157
+ if (ageInMs < constants_1.ONE_DAY_IN_MS) {
158
+ return [2 /*return*/, {
159
+ count: cachedData.expenseCategories.length,
160
+ items: cachedData.expenseCategories,
161
+ }];
162
+ }
163
+ }
164
+ return [4 /*yield*/, (0, fetch_data_1.fetchData)({
165
+ url: constants_1.API_ROUTES.EXPENSE_CATEGORIES,
166
+ body: JSON.stringify({
167
+ pageLimit: pageLimit,
168
+ currentPage: 1,
169
+ }),
170
+ method: api_methods_1.API_METHODS.POST,
171
+ })];
172
+ case 3:
173
+ response = _b.sent();
174
+ if ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.items) {
175
+ updatedCache = {
176
+ expenseCategories: response.data.items,
177
+ cachedAt: new Date().toISOString(),
178
+ };
179
+ (0, set_storage_value_1.setStorageValue)(type_1.LS_KEYS.EXPENSE_CATEGORIES, updatedCache);
180
+ return [2 /*return*/, response.data];
181
+ }
182
+ return [2 /*return*/, { count: 0, items: [] }];
183
+ case 4:
184
+ error_1 = _b.sent();
185
+ console.error('Error fetching expense categories:', error_1);
186
+ return [2 /*return*/, { count: 0, items: [] }];
187
+ case 5: return [2 /*return*/];
188
+ }
189
+ });
190
+ });
191
+ };
192
+ exports.getCachedExpenseCategories = getCachedExpenseCategories;
193
+ /**
194
+ * Utility function to get a specific expense category by ID from cache
195
+ * If not found in cache, returns null (does not trigger API call)
196
+ *
197
+ * @param categoryId - The ID of the expense category to retrieve
198
+ * @returns ExpenseCategoryBE | null - The expense category or null if not found
199
+ *
200
+ * @example
201
+ * const category = getCachedExpenseCategoryById('cat-123');
202
+ * if (category) {
203
+ * console.log(category.name);
204
+ * }
205
+ */
206
+ var getCachedExpenseCategoryById = function (categoryId) {
207
+ if (!categoryId) {
208
+ return null;
209
+ }
210
+ try {
211
+ var categories = (0, exports.getCachedExpenseCategoriesSync)().items;
212
+ return categories.find(function (cat) { return cat.id === categoryId; }) || null;
213
+ }
214
+ catch (error) {
215
+ console.error('Error getting cached expense category by ID:', error);
216
+ return null;
217
+ }
218
+ };
219
+ exports.getCachedExpenseCategoryById = getCachedExpenseCategoryById;
220
+ /**
221
+ * Utility function to invalidate (remove) expense categories from cache
222
+ * Useful when expense categories have been updated and you want to force a refresh
223
+ *
224
+ * @example
225
+ * invalidateExpenseCategoriesCache();
226
+ * const freshCategories = await getCachedExpenseCategories();
227
+ */
228
+ var invalidateExpenseCategoriesCache = function () {
229
+ try {
230
+ localStorage.removeItem(type_1.LS_KEYS.EXPENSE_CATEGORIES);
231
+ }
232
+ catch (error) {
233
+ console.error('Error invalidating expense categories cache:', error);
234
+ }
235
+ };
236
+ exports.invalidateExpenseCategoriesCache = invalidateExpenseCategoriesCache;
237
+ /**
238
+ * Utility function to preload expense categories into cache
239
+ * Useful to call on app initialization or login
240
+ *
241
+ * @returns Promise<{count:number, items: ExpenseCategoryBE[]}> - Array of preloaded expense categories
242
+ *
243
+ * @example
244
+ * // On app initialization
245
+ * await preloadExpenseCategories();
246
+ */
247
+ var preloadExpenseCategories = function () { return __awaiter(void 0, void 0, void 0, function () {
248
+ return __generator(this, function (_a) {
249
+ return [2 /*return*/, (0, exports.getCachedExpenseCategories)()];
250
+ });
251
+ }); };
252
+ exports.preloadExpenseCategories = preloadExpenseCategories;
253
+ /**
254
+ * Utility function to check if expense categories cache is stale
255
+ * Returns true if cache is older than 1 day or doesn't exist
256
+ *
257
+ * @returns boolean - True if cache is stale or doesn't exist
258
+ *
259
+ * @example
260
+ * if (isExpenseCategoriesCacheStale()) {
261
+ * await getCachedExpenseCategories(); // This will fetch fresh data
262
+ * }
263
+ */
264
+ var isExpenseCategoriesCacheStale = function () {
265
+ try {
266
+ var cachedData = (0, get_storage_value_1.getStorageValue)(type_1.LS_KEYS.EXPENSE_CATEGORIES);
267
+ if (!cachedData) {
268
+ return true;
269
+ }
270
+ var currentTime = new Date().getTime();
271
+ var cachedTime = new Date(cachedData.cachedAt).getTime();
272
+ var ageInMs = currentTime - cachedTime;
273
+ return ageInMs >= constants_1.ONE_DAY_IN_MS;
274
+ }
275
+ catch (error) {
276
+ console.error('Error checking expense categories cache staleness:', error);
277
+ return true;
278
+ }
279
+ };
280
+ exports.isExpenseCategoriesCacheStale = isExpenseCategoriesCacheStale;
@@ -1,4 +1,5 @@
1
- import { ExpenseCategoryTypeBE } from '../type';
1
+ export * from './cache';
2
+ import { ExpenseCategoryBE } from '../type';
2
3
  type PrismaClient = any;
3
4
  export interface ListExpenseCategoryArgs {
4
5
  currentPage?: number;
@@ -28,26 +29,25 @@ export interface DeleteExpenseCategoryArgs {
28
29
  /**
29
30
  * Retrieves expense categories with pagination and filtering
30
31
  * @param {ListExpenseCategoryArgs} args - Object containing prisma client, pagination, and query options
31
- * @returns {Promise<[number, Array<ExpenseCategoryTypeBE>]>} Tuple containing total count and array of expense categories
32
+ * @returns {Promise<[number, Array<ExpenseCategoryBE>]>} Tuple containing total count and array of expense categories
32
33
  */
33
- export declare const listExpenseCategory: ({ currentPage, includeExpenses, orderByColumn, orderByDirection, pageLimit, prisma, searchQuery, }: ListExpenseCategoryArgs) => Promise<[number, Array<ExpenseCategoryTypeBE>]>;
34
+ export declare const listExpenseCategory: ({ currentPage, includeExpenses, orderByColumn, orderByDirection, pageLimit, prisma, searchQuery, }: ListExpenseCategoryArgs) => Promise<[number, Array<ExpenseCategoryBE>]>;
34
35
  /**
35
36
  * Retrieves a single expense category by ID
36
37
  * @param {UnitExpenseCategoryByIdArgs} args - Object containing prisma client, expense category id, and optional query parameters
37
- * @returns {Promise<ExpenseCategoryTypeBE | null>} Expense category with optional relations if found, null otherwise
38
+ * @returns {Promise<ExpenseCategoryBE | null>} Expense category with optional relations if found, null otherwise
38
39
  */
39
- export declare const unitExpenseCategoryById: ({ id, includeExpenses, prisma, }: UnitExpenseCategoryByIdArgs) => Promise<ExpenseCategoryTypeBE | null>;
40
+ export declare const unitExpenseCategoryById: ({ id, includeExpenses, prisma, }: UnitExpenseCategoryByIdArgs) => Promise<ExpenseCategoryBE | null>;
40
41
  /**
41
42
  * Creates or updates an expense category using upsert
42
43
  * @param {UpdateExpenseCategoryArgs} args - Object containing prisma client and expense category data
43
- * @returns {Promise<ExpenseCategoryTypeBE>} Created or updated expense category
44
+ * @returns {Promise<ExpenseCategoryBE>} Created or updated expense category
44
45
  */
45
- export declare const updateExpenseCategory: ({ color, description, id, name, prisma, }: UpdateExpenseCategoryArgs) => Promise<ExpenseCategoryTypeBE>;
46
+ export declare const updateExpenseCategory: ({ color, description, id, name, prisma, }: UpdateExpenseCategoryArgs) => Promise<ExpenseCategoryBE>;
46
47
  /**
47
48
  * Deletes an expense category by ID
48
49
  * @param {DeleteExpenseCategoryArgs} args - Object containing prisma client, expense category id, and optional query parameters
49
- * @returns {Promise<ExpenseCategoryTypeBE>} Deleted expense category
50
+ * @returns {Promise<ExpenseCategoryBE>} Deleted expense category
50
51
  * @throws {Error} If expense category ID is not provided or expense category not found
51
52
  */
52
- export declare const deleteExpenseCategory: ({ id, prisma, }: DeleteExpenseCategoryArgs) => Promise<ExpenseCategoryTypeBE>;
53
- export {};
53
+ export declare const deleteExpenseCategory: ({ id, prisma, }: DeleteExpenseCategoryArgs) => Promise<ExpenseCategoryBE>;
@@ -10,6 +10,20 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
+ };
13
27
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
28
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
29
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -57,11 +71,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
57
71
  };
58
72
  Object.defineProperty(exports, "__esModule", { value: true });
59
73
  exports.deleteExpenseCategory = exports.updateExpenseCategory = exports.unitExpenseCategoryById = exports.listExpenseCategory = void 0;
74
+ __exportStar(require("./cache"), exports);
60
75
  var multi_part_search_1 = require("../../../general/multi-part-search");
61
76
  /**
62
77
  * Retrieves expense categories with pagination and filtering
63
78
  * @param {ListExpenseCategoryArgs} args - Object containing prisma client, pagination, and query options
64
- * @returns {Promise<[number, Array<ExpenseCategoryTypeBE>]>} Tuple containing total count and array of expense categories
79
+ * @returns {Promise<[number, Array<ExpenseCategoryBE>]>} Tuple containing total count and array of expense categories
65
80
  */
66
81
  var listExpenseCategory = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
67
82
  var include, orderBy, idSearchQuery, nameSearchQuery, descriptionSearchQuery, where, _c, count, items;
@@ -119,7 +134,7 @@ exports.listExpenseCategory = listExpenseCategory;
119
134
  /**
120
135
  * Retrieves a single expense category by ID
121
136
  * @param {UnitExpenseCategoryByIdArgs} args - Object containing prisma client, expense category id, and optional query parameters
122
- * @returns {Promise<ExpenseCategoryTypeBE | null>} Expense category with optional relations if found, null otherwise
137
+ * @returns {Promise<ExpenseCategoryBE | null>} Expense category with optional relations if found, null otherwise
123
138
  */
124
139
  var unitExpenseCategoryById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
125
140
  var include, where, expenseCategory;
@@ -150,7 +165,7 @@ exports.unitExpenseCategoryById = unitExpenseCategoryById;
150
165
  /**
151
166
  * Creates or updates an expense category using upsert
152
167
  * @param {UpdateExpenseCategoryArgs} args - Object containing prisma client and expense category data
153
- * @returns {Promise<ExpenseCategoryTypeBE>} Created or updated expense category
168
+ * @returns {Promise<ExpenseCategoryBE>} Created or updated expense category
154
169
  */
155
170
  var updateExpenseCategory = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
156
171
  var expenseCategoryData, where, expenseCategory;
@@ -187,7 +202,7 @@ exports.updateExpenseCategory = updateExpenseCategory;
187
202
  /**
188
203
  * Deletes an expense category by ID
189
204
  * @param {DeleteExpenseCategoryArgs} args - Object containing prisma client, expense category id, and optional query parameters
190
- * @returns {Promise<ExpenseCategoryTypeBE>} Deleted expense category
205
+ * @returns {Promise<ExpenseCategoryBE>} Deleted expense category
191
206
  * @throws {Error} If expense category ID is not provided or expense category not found
192
207
  */
193
208
  var deleteExpenseCategory = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
@@ -1,4 +1,4 @@
1
- import { LeadTypeBE } from '../type';
1
+ import { LeadBE } from '../type';
2
2
  type PrismaClient = any;
3
3
  export interface ListLeadArgs {
4
4
  currentPage?: number;
@@ -27,25 +27,25 @@ export interface DeleteLeadArgs {
27
27
  /**
28
28
  * Retrieves a paginated list of leads
29
29
  * @param {ListLeadArgs} args - Object containing prisma client, pagination, filtering, and ordering options
30
- * @returns {Promise<[number, Array<LeadTypeBE>]>} Tuple containing total count and array of leads
30
+ * @returns {Promise<[number, Array<LeadBE>]>} Tuple containing total count and array of leads
31
31
  */
32
- export declare const listLead: ({ currentPage, orderByColumn, orderByDirection, pageLimit, prisma, searchQuery, }: ListLeadArgs) => Promise<[number, Array<LeadTypeBE>]>;
32
+ export declare const listLead: ({ currentPage, orderByColumn, orderByDirection, pageLimit, prisma, searchQuery, }: ListLeadArgs) => Promise<[number, Array<LeadBE>]>;
33
33
  /**
34
34
  * Retrieves a single lead by its ID
35
35
  * @param {UnitLeadByIdArgs} args - Object containing prisma client and lead ID
36
- * @returns {Promise<LeadTypeBE | null>} Lead or null if not found
36
+ * @returns {Promise<LeadBE | null>} Lead or null if not found
37
37
  */
38
- export declare const unitLeadById: ({ id, prisma, }: UnitLeadByIdArgs) => Promise<LeadTypeBE | null>;
38
+ export declare const unitLeadById: ({ id, prisma, }: UnitLeadByIdArgs) => Promise<LeadBE | null>;
39
39
  /**
40
40
  * Updates an existing lead using upsert
41
41
  * @param {UpdateLeadArgs} args - Object containing prisma client and lead data
42
- * @returns {Promise<LeadTypeBE>} Updated lead
42
+ * @returns {Promise<LeadBE>} Updated lead
43
43
  */
44
- export declare const updateLead: ({ id, notes, prisma, source, status, type, }: UpdateLeadArgs) => Promise<LeadTypeBE>;
44
+ export declare const updateLead: ({ id, notes, prisma, source, status, type, }: UpdateLeadArgs) => Promise<LeadBE>;
45
45
  /**
46
46
  * Deletes a lead by ID
47
47
  * @param {DeleteLeadArgs} args - Object containing prisma client and lead ID
48
- * @returns {Promise<LeadTypeBE>} Deleted lead
48
+ * @returns {Promise<LeadBE>} Deleted lead
49
49
  */
50
- export declare const deleteLead: ({ id, prisma, }: DeleteLeadArgs) => Promise<LeadTypeBE>;
50
+ export declare const deleteLead: ({ id, prisma, }: DeleteLeadArgs) => Promise<LeadBE>;
51
51
  export {};
@@ -61,7 +61,7 @@ var multi_part_search_1 = require("../../../general/multi-part-search");
61
61
  /**
62
62
  * Retrieves a paginated list of leads
63
63
  * @param {ListLeadArgs} args - Object containing prisma client, pagination, filtering, and ordering options
64
- * @returns {Promise<[number, Array<LeadTypeBE>]>} Tuple containing total count and array of leads
64
+ * @returns {Promise<[number, Array<LeadBE>]>} Tuple containing total count and array of leads
65
65
  */
66
66
  var listLead = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
67
67
  var include, orderBy, idSearchQuery, notesSearchQuery, where, _c, count, items;
@@ -113,7 +113,7 @@ exports.listLead = listLead;
113
113
  /**
114
114
  * Retrieves a single lead by its ID
115
115
  * @param {UnitLeadByIdArgs} args - Object containing prisma client and lead ID
116
- * @returns {Promise<LeadTypeBE | null>} Lead or null if not found
116
+ * @returns {Promise<LeadBE | null>} Lead or null if not found
117
117
  */
118
118
  var unitLeadById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
119
119
  var include, where, lead;
@@ -142,7 +142,7 @@ exports.unitLeadById = unitLeadById;
142
142
  /**
143
143
  * Updates an existing lead using upsert
144
144
  * @param {UpdateLeadArgs} args - Object containing prisma client and lead data
145
- * @returns {Promise<LeadTypeBE>} Updated lead
145
+ * @returns {Promise<LeadBE>} Updated lead
146
146
  */
147
147
  var updateLead = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
148
148
  var leadData, where, lead;
@@ -180,7 +180,7 @@ exports.updateLead = updateLead;
180
180
  /**
181
181
  * Deletes a lead by ID
182
182
  * @param {DeleteLeadArgs} args - Object containing prisma client and lead ID
183
- * @returns {Promise<LeadTypeBE>} Deleted lead
183
+ * @returns {Promise<LeadBE>} Deleted lead
184
184
  */
185
185
  var deleteLead = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
186
186
  var where, lead;
@@ -1,4 +1,4 @@
1
- import { MenuOrderTypeBE } from '../type';
1
+ import { MenuOrderBE } from '../type';
2
2
  type PrismaClient = any;
3
3
  export interface ListMenuOrderArgs {
4
4
  currentPage?: number;
@@ -28,26 +28,26 @@ export interface DeleteMenuOrderArgs {
28
28
  /**
29
29
  * Retrieves paginated menu orders with count
30
30
  * @param {ListMenuOrderArgs} args - Object containing prisma client and pagination parameters
31
- * @returns {Promise<[number, Array<MenuOrderTypeBE>]>} Tuple of total count and menu orders array
31
+ * @returns {Promise<[number, Array<MenuOrderBE>]>} Tuple of total count and menu orders array
32
32
  */
33
- export declare const listMenuOrder: ({ currentPage, orderByColumn, orderByDirection, pageLimit, prisma, searchQuery, }: ListMenuOrderArgs) => Promise<[number, Array<MenuOrderTypeBE>]>;
33
+ export declare const listMenuOrder: ({ currentPage, orderByColumn, orderByDirection, pageLimit, prisma, searchQuery, }: ListMenuOrderArgs) => Promise<[number, Array<MenuOrderBE>]>;
34
34
  /**
35
35
  * Retrieves a single menu order by ID
36
36
  * @param {UnitMenuOrderByIdArgs} args - Object containing prisma client and menu order id
37
- * @returns {Promise<MenuOrderTypeBE | null>} Menu order if found, null otherwise
37
+ * @returns {Promise<MenuOrderBE | null>} Menu order if found, null otherwise
38
38
  */
39
- export declare const unitMenuOrderById: ({ id, includePreference, prisma, }: UnitMenuOrderByIdArgs) => Promise<MenuOrderTypeBE | null>;
39
+ export declare const unitMenuOrderById: ({ id, includePreference, prisma, }: UnitMenuOrderByIdArgs) => Promise<MenuOrderBE | null>;
40
40
  /**
41
41
  * Updates an existing menu order
42
42
  * @param {UpdateMenuOrderArgs} args - Object containing prisma client and menu order data
43
- * @returns {Promise<MenuOrderTypeBE>} Updated menu order
43
+ * @returns {Promise<MenuOrderBE>} Updated menu order
44
44
  */
45
- export declare const updateMenuOrder: ({ id, label, order, preferenceId, prisma, }: UpdateMenuOrderArgs) => Promise<MenuOrderTypeBE>;
45
+ export declare const updateMenuOrder: ({ id, label, order, preferenceId, prisma, }: UpdateMenuOrderArgs) => Promise<MenuOrderBE>;
46
46
  /**
47
47
  * Deletes a menu order by ID
48
48
  * @param {DeleteMenuOrderArgs} args - Object containing prisma client and menu order id
49
- * @returns {Promise<MenuOrderTypeBE>} Deleted menu order
49
+ * @returns {Promise<MenuOrderBE>} Deleted menu order
50
50
  * @throws {Error} If menu order ID is not provided or menu order not found
51
51
  */
52
- export declare const deleteMenuOrder: ({ id, prisma, }: DeleteMenuOrderArgs) => Promise<MenuOrderTypeBE>;
52
+ export declare const deleteMenuOrder: ({ id, prisma, }: DeleteMenuOrderArgs) => Promise<MenuOrderBE>;
53
53
  export {};
@@ -61,7 +61,7 @@ var multi_part_search_1 = require("../../../general/multi-part-search");
61
61
  /**
62
62
  * Retrieves paginated menu orders with count
63
63
  * @param {ListMenuOrderArgs} args - Object containing prisma client and pagination parameters
64
- * @returns {Promise<[number, Array<MenuOrderTypeBE>]>} Tuple of total count and menu orders array
64
+ * @returns {Promise<[number, Array<MenuOrderBE>]>} Tuple of total count and menu orders array
65
65
  */
66
66
  var listMenuOrder = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
67
67
  var orderBy, idSearchQuery, labelSearchQuery, where, _c, count, items;
@@ -111,7 +111,7 @@ exports.listMenuOrder = listMenuOrder;
111
111
  /**
112
112
  * Retrieves a single menu order by ID
113
113
  * @param {UnitMenuOrderByIdArgs} args - Object containing prisma client and menu order id
114
- * @returns {Promise<MenuOrderTypeBE | null>} Menu order if found, null otherwise
114
+ * @returns {Promise<MenuOrderBE | null>} Menu order if found, null otherwise
115
115
  */
116
116
  var unitMenuOrderById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
117
117
  var include, where, menuOrder;
@@ -142,7 +142,7 @@ exports.unitMenuOrderById = unitMenuOrderById;
142
142
  /**
143
143
  * Updates an existing menu order
144
144
  * @param {UpdateMenuOrderArgs} args - Object containing prisma client and menu order data
145
- * @returns {Promise<MenuOrderTypeBE>} Updated menu order
145
+ * @returns {Promise<MenuOrderBE>} Updated menu order
146
146
  */
147
147
  var updateMenuOrder = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
148
148
  var menuOrderData, where, menuOrder;
@@ -177,7 +177,7 @@ exports.updateMenuOrder = updateMenuOrder;
177
177
  /**
178
178
  * Deletes a menu order by ID
179
179
  * @param {DeleteMenuOrderArgs} args - Object containing prisma client and menu order id
180
- * @returns {Promise<MenuOrderTypeBE>} Deleted menu order
180
+ * @returns {Promise<MenuOrderBE>} Deleted menu order
181
181
  * @throws {Error} If menu order ID is not provided or menu order not found
182
182
  */
183
183
  var deleteMenuOrder = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
@@ -1,4 +1,4 @@
1
- import { PaymentTypeBE } from '../type';
1
+ import { PaymentBE } from '../type';
2
2
  type PrismaClient = any;
3
3
  export interface ListPaymentArgs {
4
4
  currentPage?: number;
@@ -41,25 +41,25 @@ export interface DeletePaymentArgs {
41
41
  /**
42
42
  * Retrieves a paginated list of payments
43
43
  * @param {ListPaymentArgs} args - Object containing prisma client, pagination, filtering, and ordering options
44
- * @returns {Promise<[number, Array<PaymentTypeBE>]>} Tuple containing total count and array of payments
44
+ * @returns {Promise<[number, Array<PaymentBE>]>} Tuple containing total count and array of payments
45
45
  */
46
- export declare const listPayment: ({ currentPage, includePaymentMode, includeQuoteInvoice, orderByColumn, orderByDirection, pageLimit, prisma, searchQuery, }: ListPaymentArgs) => Promise<[number, Array<PaymentTypeBE>]>;
46
+ export declare const listPayment: ({ currentPage, includePaymentMode, includeQuoteInvoice, orderByColumn, orderByDirection, pageLimit, prisma, searchQuery, }: ListPaymentArgs) => Promise<[number, Array<PaymentBE>]>;
47
47
  /**
48
48
  * Retrieves a single payment by its ID
49
49
  * @param {UnitPaymentByIdArgs} args - Object containing prisma client, payment ID, and optional query parameters
50
- * @returns {Promise<PaymentTypeBE | null>} Payment or null if not found
50
+ * @returns {Promise<PaymentBE | null>} Payment or null if not found
51
51
  */
52
- export declare const unitPaymentById: ({ id, includePaymentMode, includeQuoteInvoice, prisma, }: UnitPaymentByIdArgs) => Promise<PaymentTypeBE | null>;
52
+ export declare const unitPaymentById: ({ id, includePaymentMode, includeQuoteInvoice, prisma, }: UnitPaymentByIdArgs) => Promise<PaymentBE | null>;
53
53
  /**
54
54
  * Updates a payment using upsert
55
55
  * @param {UpdatePaymentArgs} args - Object containing prisma client and payment data
56
- * @returns {Promise<PaymentTypeBE>} Updated payment
56
+ * @returns {Promise<PaymentBE>} Updated payment
57
57
  */
58
- export declare const updatePayment: ({ amount, attachment, balance, currency, date, description, id, paymentModeId, paymentType, prisma, quoteInvoiceId, ref, }: UpdatePaymentArgs) => Promise<PaymentTypeBE>;
58
+ export declare const updatePayment: ({ amount, attachment, balance, currency, date, description, id, paymentModeId, paymentType, prisma, quoteInvoiceId, ref, }: UpdatePaymentArgs) => Promise<PaymentBE>;
59
59
  /**
60
60
  * Deletes a payment by ID
61
61
  * @param {DeletePaymentArgs} args - Object containing prisma client and payment ID
62
- * @returns {Promise<PaymentTypeBE>} Deleted payment
62
+ * @returns {Promise<PaymentBE>} Deleted payment
63
63
  */
64
- export declare const deletePayment: ({ id, prisma, }: DeletePaymentArgs) => Promise<PaymentTypeBE>;
64
+ export declare const deletePayment: ({ id, prisma, }: DeletePaymentArgs) => Promise<PaymentBE>;
65
65
  export {};
@@ -62,7 +62,7 @@ var type_1 = require("../type");
62
62
  /**
63
63
  * Retrieves a paginated list of payments
64
64
  * @param {ListPaymentArgs} args - Object containing prisma client, pagination, filtering, and ordering options
65
- * @returns {Promise<[number, Array<PaymentTypeBE>]>} Tuple containing total count and array of payments
65
+ * @returns {Promise<[number, Array<PaymentBE>]>} Tuple containing total count and array of payments
66
66
  */
67
67
  var listPayment = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
68
68
  var include, orderBy, idSearchQuery, descriptionSearchQuery, refSearchQuery, where, _c, count, items;
@@ -121,7 +121,7 @@ exports.listPayment = listPayment;
121
121
  /**
122
122
  * Retrieves a single payment by its ID
123
123
  * @param {UnitPaymentByIdArgs} args - Object containing prisma client, payment ID, and optional query parameters
124
- * @returns {Promise<PaymentTypeBE | null>} Payment or null if not found
124
+ * @returns {Promise<PaymentBE | null>} Payment or null if not found
125
125
  */
126
126
  var unitPaymentById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
127
127
  var include, where, payment;
@@ -151,7 +151,7 @@ exports.unitPaymentById = unitPaymentById;
151
151
  /**
152
152
  * Updates a payment using upsert
153
153
  * @param {UpdatePaymentArgs} args - Object containing prisma client and payment data
154
- * @returns {Promise<PaymentTypeBE>} Updated payment
154
+ * @returns {Promise<PaymentBE>} Updated payment
155
155
  */
156
156
  var updatePayment = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
157
157
  var paymentData, where, payment;
@@ -206,7 +206,7 @@ exports.updatePayment = updatePayment;
206
206
  /**
207
207
  * Deletes a payment by ID
208
208
  * @param {DeletePaymentArgs} args - Object containing prisma client and payment ID
209
- * @returns {Promise<PaymentTypeBE>} Deleted payment
209
+ * @returns {Promise<PaymentBE>} Deleted payment
210
210
  */
211
211
  var deletePayment = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
212
212
  var where, payment;