@react-pakistan/util-functions 1.24.64 → 1.24.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/api/stellar-solutions/app-user/index.d.ts +63 -14
- package/api/stellar-solutions/app-user/index.js +106 -52
- package/api/stellar-solutions/bank/index.d.ts +65 -16
- package/api/stellar-solutions/bank/index.js +115 -65
- package/api/stellar-solutions/branch/index.d.ts +64 -15
- package/api/stellar-solutions/branch/index.js +119 -65
- package/api/stellar-solutions/company/index.d.ts +58 -24
- package/api/stellar-solutions/company/index.js +106 -78
- package/api/stellar-solutions/company-report/index.d.ts +12 -5
- package/api/stellar-solutions/company-report/index.js +12 -7
- package/api/stellar-solutions/contact/index.d.ts +54 -20
- package/api/stellar-solutions/contact/index.js +109 -88
- package/api/stellar-solutions/currency/index.d.ts +63 -14
- package/api/stellar-solutions/currency/index.js +113 -61
- package/api/stellar-solutions/customer/index.d.ts +70 -28
- package/api/stellar-solutions/customer/index.js +131 -101
- package/api/stellar-solutions/expense/index.d.ts +58 -22
- package/api/stellar-solutions/expense/index.js +128 -92
- package/api/stellar-solutions/expense-category/index.d.ts +58 -22
- package/api/stellar-solutions/expense-category/index.js +125 -86
- package/api/stellar-solutions/lead/index.js +0 -1
- package/api/stellar-solutions/menu-order/index.d.ts +29 -7
- package/api/stellar-solutions/menu-order/index.js +74 -27
- package/api/stellar-solutions/payment/index.d.ts +62 -27
- package/api/stellar-solutions/payment/index.js +144 -123
- package/api/stellar-solutions/payment-mode/index.d.ts +44 -12
- package/api/stellar-solutions/payment-mode/index.js +115 -49
- package/api/stellar-solutions/preference/index.d.ts +14 -3
- package/api/stellar-solutions/preference/index.js +44 -14
- package/api/stellar-solutions/product/index.d.ts +46 -31
- package/api/stellar-solutions/product/index.js +142 -113
- package/api/stellar-solutions/product-category/index.d.ts +44 -27
- package/api/stellar-solutions/product-category/index.js +123 -87
- package/api/stellar-solutions/profile/index.d.ts +48 -17
- package/api/stellar-solutions/profile/index.js +124 -65
- package/api/stellar-solutions/quote-invoice/index.d.ts +67 -8
- package/api/stellar-solutions/quote-invoice/index.js +123 -57
- package/api/stellar-solutions/quote-invoice-report/index.d.ts +12 -5
- package/api/stellar-solutions/quote-invoice-report/index.js +10 -5
- package/api/stellar-solutions/tax/index.d.ts +46 -14
- package/api/stellar-solutions/tax/index.js +135 -63
- package/api/stellar-solutions/type.d.ts +292 -177
- package/api/stellar-solutions/type.js +93 -1
- package/constants/countries-timezones.js +0 -1
- package/constants/currencies.js +0 -1
- package/general/basic-get.js +22 -21
- package/general/basic-post.js +19 -18
- package/general/calculate-pages.js +3 -1
- package/general/check-even-odd-length.js +3 -2
- package/general/delete-image-from-private-supabase.js +0 -1
- package/general/delete-image-from-public-supabase.js +0 -1
- package/general/dynamic-page-limit.js +3 -2
- package/general/enum-to-text.js +7 -4
- package/general/fetch-data.js +0 -1
- package/general/fetch-supabase-image.js +0 -1
- package/general/fetch-supabase-private-assets.js +15 -14
- package/general/format-date.js +8 -8
- package/general/format-number.js +3 -2
- package/general/format-time.js +3 -2
- package/general/full-year-range.js +2 -2
- package/general/generate-blog-schema.d.ts +3 -3
- package/general/generate-blog-schema.js +20 -13
- package/general/generate-breadcrumb-schema.d.ts +4 -4
- package/general/generate-breadcrumb-schema.js +9 -10
- package/general/generate-faq-schema.d.ts +5 -5
- package/general/generate-faq-schema.js +18 -11
- package/general/generate-grid.js +0 -1
- package/general/generate-organization-schema.d.ts +3 -3
- package/general/generate-organization-schema.js +25 -18
- package/general/get-available-page-limit.js +2 -2
- package/general/get-calendar-dates.js +14 -3
- package/general/get-full-name.d.ts +1 -1
- package/general/get-number-of-days-in-month.d.ts +1 -1
- package/general/get-pathname.js +4 -1
- package/general/is-odd.js +1 -1
- package/general/is-previous-button-disabled.js +3 -1
- package/general/parse-frontmatter.js +0 -1
- package/general/remove-data-image-prefix.js +3 -2
- package/general/repeat-times.js +0 -1
- package/general/resolve-current-date.js +1 -2
- package/general/resolve-grid.js +3 -2
- package/general/slugify.js +11 -9
- package/general/text-to-enum.js +6 -1
- package/general/text-to-sentence-case.js +3 -1
- package/general/time-out.js +5 -4
- package/general/truncate-text.js +3 -1
- package/general/upload-blob-to-private-supabase.js +2 -2
- package/general/upload-blob-to-public-supabase.js +2 -2
- package/general/upload-image-to-private-supabase.js +2 -2
- package/general/upload-image-to-public-supabase.js +2 -2
- package/general/validate-email.js +1 -1
- package/hooks/use-fetch.js +11 -12
- package/hooks/use-module-entity.js +5 -6
- package/hooks/use-sticky.js +0 -1
- package/hooks/with-seo.d.ts +1 -1
- package/hooks/with-seo.js +3 -4
- package/local-storage/get-storage-value.js +0 -1
- package/package.json +22 -13
- package/setupTests.js +1 -2
- package/storybook/generate-sitemap.js +0 -1
- package/storybook/preview.js +1 -4
- package/storybook/react-design-story-script.js +0 -2
- package/storybook/react-emoji-collection.js +8 -6
- package/storybook/react-emoji-story-script.js +0 -2
- package/storybook/react-icon-collection.js +4 -3
- package/storybook/react-icon-story-script.js +0 -2
- package/storybook/react-logo-collection.js +4 -3
- package/storybook/react-logo-story-script.js +0 -2
- package/storybook/responsive-component.js +14 -7
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
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
|
+
};
|
|
3
13
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
14
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
15
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -37,86 +47,148 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
47
|
}
|
|
38
48
|
};
|
|
39
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.deleteTax = exports.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
exports.deleteTax = exports.updateTax = exports.unitTaxById = exports.listTax = void 0;
|
|
51
|
+
/**
|
|
52
|
+
* Retrieves a paginated list of taxes
|
|
53
|
+
* @param {ListTaxArgs} args - Object containing prisma client, pagination, and filter options
|
|
54
|
+
* @returns {Promise<[number, Array<TaxBE>]>} Tuple of [total count, tax array]
|
|
55
|
+
*/
|
|
56
|
+
var listTax = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
57
|
+
var skip, _c, count, data;
|
|
58
|
+
var _d = _b.currentPage, currentPage = _d === void 0 ? 1 : _d, _e = _b.include, include = _e === void 0 ? {} : _e, _f = _b.orderBy, orderBy = _f === void 0 ? { createdAt: 'desc' } : _f, _g = _b.pageLimit, pageLimit = _g === void 0 ? 10 : _g, prisma = _b.prisma, _h = _b.queryWhere, queryWhere = _h === void 0 ? {} : _h;
|
|
59
|
+
return __generator(this, function (_j) {
|
|
60
|
+
switch (_j.label) {
|
|
61
|
+
case 0:
|
|
62
|
+
if (currentPage < 1) {
|
|
63
|
+
throw new Error('Current page must be greater than or equal to 1');
|
|
64
|
+
}
|
|
65
|
+
if (pageLimit < 1) {
|
|
66
|
+
throw new Error('Page limit must be greater than or equal to 1');
|
|
67
|
+
}
|
|
68
|
+
skip = (currentPage - 1) * pageLimit;
|
|
69
|
+
return [4 /*yield*/, Promise.all([
|
|
70
|
+
prisma.tax.count({
|
|
71
|
+
where: queryWhere,
|
|
72
|
+
}),
|
|
73
|
+
prisma.tax.findMany({
|
|
74
|
+
include: include,
|
|
75
|
+
orderBy: orderBy,
|
|
76
|
+
skip: skip,
|
|
77
|
+
take: pageLimit,
|
|
78
|
+
where: queryWhere,
|
|
79
|
+
}),
|
|
80
|
+
])];
|
|
51
81
|
case 1:
|
|
52
|
-
|
|
53
|
-
return [2 /*return*/,
|
|
82
|
+
_c = _j.sent(), count = _c[0], data = _c[1];
|
|
83
|
+
return [2 /*return*/, [count, data]];
|
|
54
84
|
}
|
|
55
85
|
});
|
|
56
86
|
}); };
|
|
57
|
-
exports.
|
|
58
|
-
|
|
87
|
+
exports.listTax = listTax;
|
|
88
|
+
/**
|
|
89
|
+
* Retrieves a single tax by its ID
|
|
90
|
+
* @param {UnitTaxByIdArgs} args - Object containing prisma client, tax ID, and optional filters
|
|
91
|
+
* @returns {Promise<TaxBE | null>} Tax or null if not found
|
|
92
|
+
*/
|
|
93
|
+
var unitTaxById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
59
94
|
var tax;
|
|
60
|
-
var prisma = _b.prisma,
|
|
61
|
-
return __generator(this, function (
|
|
62
|
-
switch (
|
|
63
|
-
case 0:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
95
|
+
var id = _b.id, _c = _b.include, include = _c === void 0 ? {} : _c, prisma = _b.prisma, _d = _b.queryWhere, queryWhere = _d === void 0 ? {} : _d;
|
|
96
|
+
return __generator(this, function (_e) {
|
|
97
|
+
switch (_e.label) {
|
|
98
|
+
case 0:
|
|
99
|
+
if (!id) {
|
|
100
|
+
throw new Error('Tax ID is required');
|
|
101
|
+
}
|
|
102
|
+
if (queryWhere.id && queryWhere.id !== id) {
|
|
103
|
+
throw new Error('ID mismatch between parameter and queryWhere');
|
|
104
|
+
}
|
|
105
|
+
return [4 /*yield*/, prisma.tax.findUnique({
|
|
106
|
+
include: include,
|
|
107
|
+
where: __assign({ id: id }, queryWhere),
|
|
108
|
+
})];
|
|
68
109
|
case 1:
|
|
69
|
-
tax =
|
|
110
|
+
tax = _e.sent();
|
|
70
111
|
return [2 /*return*/, tax];
|
|
71
112
|
}
|
|
72
113
|
});
|
|
73
114
|
}); };
|
|
74
|
-
exports.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
115
|
+
exports.unitTaxById = unitTaxById;
|
|
116
|
+
/**
|
|
117
|
+
* Creates or updates a tax
|
|
118
|
+
* @param {UpdateTaxArgs} args - Object containing prisma client and tax data
|
|
119
|
+
* @returns {Promise<TaxBE>} Created or updated tax
|
|
120
|
+
*/
|
|
121
|
+
var updateTax = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
122
|
+
var taxData, tax;
|
|
123
|
+
var description = _b.description, enabled = _b.enabled, id = _b.id, _c = _b.include, include = _c === void 0 ? {} : _c, isDefault = _b.isDefault, preferenceId = _b.preferenceId, prisma = _b.prisma, _d = _b.queryWhere, queryWhere = _d === void 0 ? {} : _d, taxName = _b.taxName, taxRate = _b.taxRate;
|
|
124
|
+
return __generator(this, function (_e) {
|
|
125
|
+
switch (_e.label) {
|
|
126
|
+
case 0:
|
|
127
|
+
if (!id) {
|
|
128
|
+
throw new Error('Tax ID is required');
|
|
129
|
+
}
|
|
130
|
+
if (!preferenceId) {
|
|
131
|
+
throw new Error('Preference ID is required');
|
|
132
|
+
}
|
|
133
|
+
if (!taxName) {
|
|
134
|
+
throw new Error('Tax name is required');
|
|
135
|
+
}
|
|
136
|
+
if (!taxRate) {
|
|
137
|
+
throw new Error('Tax rate is required');
|
|
138
|
+
}
|
|
139
|
+
if (typeof enabled !== 'boolean') {
|
|
140
|
+
throw new Error('Enabled must be a boolean');
|
|
141
|
+
}
|
|
142
|
+
if (typeof isDefault !== 'boolean') {
|
|
143
|
+
throw new Error('Is default must be a boolean');
|
|
144
|
+
}
|
|
145
|
+
if (queryWhere.id && queryWhere.id !== id) {
|
|
146
|
+
throw new Error('ID mismatch between parameter and queryWhere');
|
|
147
|
+
}
|
|
148
|
+
taxData = {
|
|
149
|
+
description: description || null,
|
|
150
|
+
enabled: enabled,
|
|
151
|
+
isDefault: isDefault,
|
|
152
|
+
preferenceId: preferenceId,
|
|
153
|
+
taxName: taxName,
|
|
154
|
+
taxRate: taxRate,
|
|
155
|
+
};
|
|
156
|
+
return [4 /*yield*/, prisma.tax.upsert({
|
|
157
|
+
include: include,
|
|
158
|
+
where: __assign({ id: id }, queryWhere),
|
|
159
|
+
update: taxData,
|
|
160
|
+
create: __assign({ id: id }, taxData),
|
|
161
|
+
})];
|
|
101
162
|
case 1:
|
|
102
|
-
tax =
|
|
163
|
+
tax = _e.sent();
|
|
103
164
|
return [2 /*return*/, tax];
|
|
104
165
|
}
|
|
105
166
|
});
|
|
106
167
|
}); };
|
|
107
|
-
exports.
|
|
168
|
+
exports.updateTax = updateTax;
|
|
169
|
+
/**
|
|
170
|
+
* Deletes a tax by ID
|
|
171
|
+
* @param {DeleteTaxArgs} args - Object containing prisma client, tax ID, and optional filters
|
|
172
|
+
* @returns {Promise<TaxBE>} Deleted tax
|
|
173
|
+
*/
|
|
108
174
|
var deleteTax = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
109
175
|
var tax;
|
|
110
|
-
var prisma = _b.prisma,
|
|
111
|
-
return __generator(this, function (
|
|
112
|
-
switch (
|
|
113
|
-
case 0:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
176
|
+
var id = _b.id, _c = _b.include, include = _c === void 0 ? {} : _c, prisma = _b.prisma, _d = _b.queryWhere, queryWhere = _d === void 0 ? {} : _d;
|
|
177
|
+
return __generator(this, function (_e) {
|
|
178
|
+
switch (_e.label) {
|
|
179
|
+
case 0:
|
|
180
|
+
if (!id) {
|
|
181
|
+
throw new Error('Tax ID is required');
|
|
182
|
+
}
|
|
183
|
+
if (queryWhere.id && queryWhere.id !== id) {
|
|
184
|
+
throw new Error('ID mismatch between parameter and queryWhere');
|
|
185
|
+
}
|
|
186
|
+
return [4 /*yield*/, prisma.tax.delete({
|
|
187
|
+
include: include,
|
|
188
|
+
where: __assign({ id: id }, queryWhere),
|
|
189
|
+
})];
|
|
118
190
|
case 1:
|
|
119
|
-
tax =
|
|
191
|
+
tax = _e.sent();
|
|
120
192
|
return [2 /*return*/, tax];
|
|
121
193
|
}
|
|
122
194
|
});
|