@react-pakistan/util-functions 1.23.32 → 1.23.34

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 (105) hide show
  1. package/api/cors/index.js +6 -6
  2. package/api/stellar-solutions/app-user/index.js +97 -38
  3. package/api/stellar-solutions/banking-detail/index.js +107 -48
  4. package/api/stellar-solutions/branch/index.js +107 -48
  5. package/api/stellar-solutions/company/index.js +124 -57
  6. package/api/stellar-solutions/company-report/index.js +48 -13
  7. package/api/stellar-solutions/contact/index.js +132 -65
  8. package/api/stellar-solutions/currency/index.js +101 -42
  9. package/api/stellar-solutions/customer/index.js +149 -74
  10. package/api/stellar-solutions/expense/index.js +132 -65
  11. package/api/stellar-solutions/expense-category/index.js +133 -66
  12. package/api/stellar-solutions/lead/index.js +132 -65
  13. package/api/stellar-solutions/menu-order/index.js +97 -38
  14. package/api/stellar-solutions/payment/index.js +135 -77
  15. package/api/stellar-solutions/payment-mode/index.js +90 -31
  16. package/api/stellar-solutions/preference/index.js +71 -28
  17. package/api/stellar-solutions/product/index.js +144 -77
  18. package/api/stellar-solutions/product-category/index.js +130 -63
  19. package/api/stellar-solutions/profile/index.js +152 -77
  20. package/api/stellar-solutions/quote-invoice/index.js +280 -201
  21. package/api/stellar-solutions/quote-invoice-report/index.js +48 -13
  22. package/api/stellar-solutions/tax/index.js +103 -44
  23. package/constants/react-pakistan.js +11 -22
  24. package/constants/social-media-sizes.js +33 -32
  25. package/general/basic-get.js +68 -6
  26. package/general/basic-post.js +55 -6
  27. package/general/camel-to-sentence-case.js +3 -3
  28. package/general/check-even-odd-length.js +1 -1
  29. package/general/create-date.js +4 -4
  30. package/general/dynamic-page-limit.js +15 -4
  31. package/general/enum-to-text.js +2 -2
  32. package/general/fetch-supabase-image.js +53 -15
  33. package/general/format-date.js +13 -12
  34. package/general/generate-blog-schema.js +10 -9
  35. package/general/generate-breadcrumb-schema.js +5 -4
  36. package/general/generate-faq-schema.js +5 -3
  37. package/general/generate-grid.js +2 -2
  38. package/general/generate-organization-schema.js +14 -13
  39. package/general/get-day-name.js +1 -1
  40. package/general/get-full-name.js +4 -1
  41. package/general/get-href.js +1 -1
  42. package/general/get-month-name.js +1 -1
  43. package/general/get-pathname.js +1 -1
  44. package/general/index.d.ts +2 -2
  45. package/general/index.js +2 -2
  46. package/general/is-next-button-disabled.js +1 -1
  47. package/general/is-odd.js +1 -1
  48. package/general/is-previous-button-disabled.js +1 -1
  49. package/general/remove-data-image-prefix.js +2 -2
  50. package/general/repeat-times.js +3 -3
  51. package/general/resolve-anchor-link.js +4 -4
  52. package/general/resolve-current-date.js +2 -2
  53. package/general/resolve-grid.js +1 -1
  54. package/general/resolve-initials.js +2 -2
  55. package/general/set-timezone.js +6 -3
  56. package/general/slugify.js +2 -2
  57. package/general/text-to-enum.js +1 -1
  58. package/general/text-to-sentence-case.js +1 -1
  59. package/general/truncate-text.js +1 -1
  60. package/general/upload-blob-to-private-supabase.d.ts +11 -0
  61. package/general/upload-blob-to-private-supabase.js +62 -0
  62. package/general/upload-blob-to-public-supabase.d.ts +11 -0
  63. package/general/upload-blob-to-public-supabase.js +62 -0
  64. package/general/upload-image-to-private-supabase.js +51 -15
  65. package/general/upload-image-to-public-supabase.js +51 -15
  66. package/general/url-to-sentence-case.js +4 -4
  67. package/general/validate-comment.js +1 -1
  68. package/general/validate-email.js +2 -2
  69. package/general/validate-name.js +1 -1
  70. package/hooks/index.d.ts +0 -1
  71. package/hooks/index.js +0 -1
  72. package/hooks/use-change.js +14 -5
  73. package/hooks/use-debounce.js +7 -6
  74. package/hooks/use-fetch.js +82 -31
  75. package/hooks/use-force-render.js +3 -3
  76. package/hooks/use-ip-geo-location.js +57 -22
  77. package/hooks/use-is-mobile.js +6 -6
  78. package/hooks/use-position.js +16 -16
  79. package/hooks/use-sticky.js +9 -8
  80. package/hooks/use-toggle-state.js +6 -5
  81. package/hooks/use-window-event-listener.js +4 -4
  82. package/local-storage/get-storage-value.js +2 -2
  83. package/local-storage/remove-storage-value.js +1 -1
  84. package/local-storage/set-storage-value.js +1 -1
  85. package/package.json +1 -1
  86. package/storybook/generate-sitemap.js +6 -22
  87. package/storybook/preview.js +13 -2
  88. package/storybook/react-design-story-script.js +7 -11
  89. package/storybook/react-emoji-collection.js +23 -33
  90. package/storybook/react-emoji-story-script.js +9 -13
  91. package/storybook/react-emoji-story-template.js +1 -46
  92. package/storybook/react-icon-collection.js +17 -27
  93. package/storybook/react-icon-story-script.js +9 -13
  94. package/storybook/react-icon-story-template.js +1 -46
  95. package/storybook/react-logo-collection.js +17 -27
  96. package/storybook/react-logo-story-script.js +9 -13
  97. package/storybook/react-logo-story-template.js +1 -46
  98. package/storybook/responsive-component.js +11 -46
  99. package/storybook/theme.js +4 -4
  100. package/general/upload-image-blob-to-private-supabase.d.ts +0 -11
  101. package/general/upload-image-blob-to-private-supabase.js +0 -27
  102. package/general/upload-image-blob-to-public-supabase.d.ts +0 -11
  103. package/general/upload-image-blob-to-public-supabase.js +0 -27
  104. package/hooks/with-seo.d.ts +0 -9
  105. package/hooks/with-seo.js +0 -43
@@ -9,71 +9,138 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  step((generator = generator.apply(thisArg, _arguments || [])).next());
10
10
  });
11
11
  };
12
+ var __generator = (this && this.__generator) || function (thisArg, body) {
13
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
14
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
15
+ function verb(n) { return function (v) { return step([n, v]); }; }
16
+ function step(op) {
17
+ if (f) throw new TypeError("Generator is already executing.");
18
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
19
+ 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;
20
+ if (y = 0, t) op = [op[0] & 2, t.value];
21
+ switch (op[0]) {
22
+ case 0: case 1: t = op; break;
23
+ case 4: _.label++; return { value: op[1], done: false };
24
+ case 5: _.label++; y = op[1]; op = [0]; continue;
25
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
26
+ default:
27
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
28
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
29
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
30
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
31
+ if (t[2]) _.ops.pop();
32
+ _.trys.pop(); continue;
33
+ }
34
+ op = body.call(thisArg, _);
35
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
36
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
37
+ }
38
+ };
12
39
  Object.defineProperty(exports, "__esModule", { value: true });
13
40
  exports.deleteCompany = exports.postCompany = exports.postCompanies = exports.getCompanyById = exports.getCompanies = void 0;
14
- const getCompanies = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, }) {
15
- const companies = yield prisma.company.findMany({
16
- orderBy: {
17
- createdAt: 'desc',
18
- },
41
+ var getCompanies = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
42
+ var companies;
43
+ var prisma = _b.prisma;
44
+ return __generator(this, function (_c) {
45
+ switch (_c.label) {
46
+ case 0: return [4 /*yield*/, prisma.company.findMany({
47
+ orderBy: {
48
+ createdAt: 'desc',
49
+ },
50
+ })];
51
+ case 1:
52
+ companies = _c.sent();
53
+ return [2 /*return*/, companies];
54
+ }
19
55
  });
20
- return companies;
21
- });
56
+ }); };
22
57
  exports.getCompanies = getCompanies;
23
- const getCompanyById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ prisma, id, }) {
24
- const company = yield prisma.company.findUnique({
25
- where: {
26
- id,
27
- },
58
+ var getCompanyById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
59
+ var company;
60
+ var prisma = _b.prisma, id = _b.id;
61
+ return __generator(this, function (_c) {
62
+ switch (_c.label) {
63
+ case 0: return [4 /*yield*/, prisma.company.findUnique({
64
+ where: {
65
+ id: id,
66
+ },
67
+ })];
68
+ case 1:
69
+ company = _c.sent();
70
+ return [2 /*return*/, company];
71
+ }
28
72
  });
29
- return company;
30
- });
73
+ }); };
31
74
  exports.getCompanyById = getCompanyById;
32
- const postCompanies = (_c) => __awaiter(void 0, [_c], void 0, function* ({ currentPage, include, orderBy, pageLimit, prisma, queryWhere, }) {
33
- const companies = yield prisma.$transaction([
34
- prisma.company.count({
35
- where: queryWhere,
36
- }),
37
- prisma.company.findMany({
38
- orderBy,
39
- include,
40
- where: queryWhere,
41
- take: pageLimit,
42
- skip: (currentPage - 1) * pageLimit,
43
- }),
44
- ]);
45
- return companies;
46
- });
75
+ var postCompanies = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
76
+ var companies;
77
+ var currentPage = _b.currentPage, include = _b.include, orderBy = _b.orderBy, pageLimit = _b.pageLimit, prisma = _b.prisma, queryWhere = _b.queryWhere;
78
+ return __generator(this, function (_c) {
79
+ switch (_c.label) {
80
+ case 0: return [4 /*yield*/, prisma.$transaction([
81
+ prisma.company.count({
82
+ where: queryWhere,
83
+ }),
84
+ prisma.company.findMany({
85
+ orderBy: orderBy,
86
+ include: include,
87
+ where: queryWhere,
88
+ take: pageLimit,
89
+ skip: (currentPage - 1) * pageLimit,
90
+ }),
91
+ ])];
92
+ case 1:
93
+ companies = _c.sent();
94
+ return [2 /*return*/, companies];
95
+ }
96
+ });
97
+ }); };
47
98
  exports.postCompanies = postCompanies;
48
- const postCompany = (_d) => __awaiter(void 0, [_d], void 0, function* ({ prisma, country, email, name, id, phone, website, }) {
49
- const company = yield prisma.company.upsert({
50
- where: {
51
- id,
52
- },
53
- update: {
54
- country,
55
- email,
56
- name,
57
- phone,
58
- website,
59
- },
60
- create: {
61
- country,
62
- email,
63
- name,
64
- phone,
65
- website,
66
- },
99
+ var postCompany = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
100
+ var company;
101
+ var prisma = _b.prisma, country = _b.country, email = _b.email, name = _b.name, id = _b.id, phone = _b.phone, website = _b.website;
102
+ return __generator(this, function (_c) {
103
+ switch (_c.label) {
104
+ case 0: return [4 /*yield*/, prisma.company.upsert({
105
+ where: {
106
+ id: id,
107
+ },
108
+ update: {
109
+ country: country,
110
+ email: email,
111
+ name: name,
112
+ phone: phone,
113
+ website: website,
114
+ },
115
+ create: {
116
+ country: country,
117
+ email: email,
118
+ name: name,
119
+ phone: phone,
120
+ website: website,
121
+ },
122
+ })];
123
+ case 1:
124
+ company = _c.sent();
125
+ return [2 /*return*/, company];
126
+ }
67
127
  });
68
- return company;
69
- });
128
+ }); };
70
129
  exports.postCompany = postCompany;
71
- const deleteCompany = (_e) => __awaiter(void 0, [_e], void 0, function* ({ prisma, id, }) {
72
- const company = yield prisma.company.delete({
73
- where: {
74
- id,
75
- },
130
+ var deleteCompany = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
131
+ var company;
132
+ var prisma = _b.prisma, id = _b.id;
133
+ return __generator(this, function (_c) {
134
+ switch (_c.label) {
135
+ case 0: return [4 /*yield*/, prisma.company.delete({
136
+ where: {
137
+ id: id,
138
+ },
139
+ })];
140
+ case 1:
141
+ company = _c.sent();
142
+ return [2 /*return*/, company];
143
+ }
76
144
  });
77
- return company;
78
- });
145
+ }); };
79
146
  exports.deleteCompany = deleteCompany;
@@ -9,19 +9,54 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  step((generator = generator.apply(thisArg, _arguments || [])).next());
10
10
  });
11
11
  };
12
+ var __generator = (this && this.__generator) || function (thisArg, body) {
13
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
14
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
15
+ function verb(n) { return function (v) { return step([n, v]); }; }
16
+ function step(op) {
17
+ if (f) throw new TypeError("Generator is already executing.");
18
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
19
+ 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;
20
+ if (y = 0, t) op = [op[0] & 2, t.value];
21
+ switch (op[0]) {
22
+ case 0: case 1: t = op; break;
23
+ case 4: _.label++; return { value: op[1], done: false };
24
+ case 5: _.label++; y = op[1]; op = [0]; continue;
25
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
26
+ default:
27
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
28
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
29
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
30
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
31
+ if (t[2]) _.ops.pop();
32
+ _.trys.pop(); continue;
33
+ }
34
+ op = body.call(thisArg, _);
35
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
36
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
37
+ }
38
+ };
12
39
  Object.defineProperty(exports, "__esModule", { value: true });
13
40
  exports.postCompaniesReport = void 0;
14
- const postCompaniesReport = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, queryWhere, orderBy, include, }) {
15
- const companies = yield prisma.$transaction([
16
- prisma.company.count({
17
- where: queryWhere,
18
- }),
19
- prisma.company.findMany({
20
- include,
21
- orderBy,
22
- where: queryWhere,
23
- }),
24
- ]);
25
- return companies;
26
- });
41
+ var postCompaniesReport = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
42
+ var companies;
43
+ var prisma = _b.prisma, queryWhere = _b.queryWhere, orderBy = _b.orderBy, include = _b.include;
44
+ return __generator(this, function (_c) {
45
+ switch (_c.label) {
46
+ case 0: return [4 /*yield*/, prisma.$transaction([
47
+ prisma.company.count({
48
+ where: queryWhere,
49
+ }),
50
+ prisma.company.findMany({
51
+ include: include,
52
+ orderBy: orderBy,
53
+ where: queryWhere,
54
+ }),
55
+ ])];
56
+ case 1:
57
+ companies = _c.sent();
58
+ return [2 /*return*/, companies];
59
+ }
60
+ });
61
+ }); };
27
62
  exports.postCompaniesReport = postCompaniesReport;
@@ -9,79 +9,146 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  step((generator = generator.apply(thisArg, _arguments || [])).next());
10
10
  });
11
11
  };
12
+ var __generator = (this && this.__generator) || function (thisArg, body) {
13
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
14
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
15
+ function verb(n) { return function (v) { return step([n, v]); }; }
16
+ function step(op) {
17
+ if (f) throw new TypeError("Generator is already executing.");
18
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
19
+ 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;
20
+ if (y = 0, t) op = [op[0] & 2, t.value];
21
+ switch (op[0]) {
22
+ case 0: case 1: t = op; break;
23
+ case 4: _.label++; return { value: op[1], done: false };
24
+ case 5: _.label++; y = op[1]; op = [0]; continue;
25
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
26
+ default:
27
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
28
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
29
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
30
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
31
+ if (t[2]) _.ops.pop();
32
+ _.trys.pop(); continue;
33
+ }
34
+ op = body.call(thisArg, _);
35
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
36
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
37
+ }
38
+ };
12
39
  Object.defineProperty(exports, "__esModule", { value: true });
13
40
  exports.deleteContact = exports.postContact = exports.postContacts = exports.getContactById = exports.getContacts = void 0;
14
- const getContacts = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, }) {
15
- const contacts = yield prisma.contact.findMany({
16
- orderBy: {
17
- createdAt: 'desc',
18
- },
19
- include: {
20
- company: true,
21
- },
41
+ var getContacts = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
42
+ var contacts;
43
+ var prisma = _b.prisma;
44
+ return __generator(this, function (_c) {
45
+ switch (_c.label) {
46
+ case 0: return [4 /*yield*/, prisma.contact.findMany({
47
+ orderBy: {
48
+ createdAt: 'desc',
49
+ },
50
+ include: {
51
+ company: true,
52
+ },
53
+ })];
54
+ case 1:
55
+ contacts = _c.sent();
56
+ return [2 /*return*/, contacts];
57
+ }
22
58
  });
23
- return contacts;
24
- });
59
+ }); };
25
60
  exports.getContacts = getContacts;
26
- const getContactById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ prisma, id }) {
27
- const contact = yield prisma.contact.findUnique({
28
- where: {
29
- id,
30
- },
31
- include: {
32
- company: true,
33
- },
61
+ var getContactById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
62
+ var contact;
63
+ var prisma = _b.prisma, id = _b.id;
64
+ return __generator(this, function (_c) {
65
+ switch (_c.label) {
66
+ case 0: return [4 /*yield*/, prisma.contact.findUnique({
67
+ where: {
68
+ id: id,
69
+ },
70
+ include: {
71
+ company: true,
72
+ },
73
+ })];
74
+ case 1:
75
+ contact = _c.sent();
76
+ return [2 /*return*/, contact];
77
+ }
34
78
  });
35
- return contact;
36
- });
79
+ }); };
37
80
  exports.getContactById = getContactById;
38
- const postContacts = (_c) => __awaiter(void 0, [_c], void 0, function* ({ currentPage, include, orderBy, pageLimit, prisma, queryWhere, }) {
39
- const contacts = yield prisma.$transaction([
40
- prisma.contact.count({
41
- where: queryWhere,
42
- }),
43
- prisma.contact.findMany({
44
- orderBy,
45
- include,
46
- where: queryWhere,
47
- take: pageLimit,
48
- skip: (currentPage - 1) * pageLimit,
49
- }),
50
- ]);
51
- return contacts;
52
- });
81
+ var postContacts = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
82
+ var contacts;
83
+ var currentPage = _b.currentPage, include = _b.include, orderBy = _b.orderBy, pageLimit = _b.pageLimit, prisma = _b.prisma, queryWhere = _b.queryWhere;
84
+ return __generator(this, function (_c) {
85
+ switch (_c.label) {
86
+ case 0: return [4 /*yield*/, prisma.$transaction([
87
+ prisma.contact.count({
88
+ where: queryWhere,
89
+ }),
90
+ prisma.contact.findMany({
91
+ orderBy: orderBy,
92
+ include: include,
93
+ where: queryWhere,
94
+ take: pageLimit,
95
+ skip: (currentPage - 1) * pageLimit,
96
+ }),
97
+ ])];
98
+ case 1:
99
+ contacts = _c.sent();
100
+ return [2 /*return*/, contacts];
101
+ }
102
+ });
103
+ }); };
53
104
  exports.postContacts = postContacts;
54
- const postContact = (_d) => __awaiter(void 0, [_d], void 0, function* ({ prisma, id, companyId, country, email, firstName, lastName, phone, }) {
55
- const contact = yield prisma.contact.upsert({
56
- where: {
57
- id,
58
- },
59
- update: {
60
- companyId,
61
- country,
62
- email,
63
- firstName,
64
- lastName,
65
- phone,
66
- },
67
- create: {
68
- companyId,
69
- country,
70
- email,
71
- firstName,
72
- lastName,
73
- phone,
74
- },
105
+ var postContact = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
106
+ var contact;
107
+ var prisma = _b.prisma, id = _b.id, companyId = _b.companyId, country = _b.country, email = _b.email, firstName = _b.firstName, lastName = _b.lastName, phone = _b.phone;
108
+ return __generator(this, function (_c) {
109
+ switch (_c.label) {
110
+ case 0: return [4 /*yield*/, prisma.contact.upsert({
111
+ where: {
112
+ id: id,
113
+ },
114
+ update: {
115
+ companyId: companyId,
116
+ country: country,
117
+ email: email,
118
+ firstName: firstName,
119
+ lastName: lastName,
120
+ phone: phone,
121
+ },
122
+ create: {
123
+ companyId: companyId,
124
+ country: country,
125
+ email: email,
126
+ firstName: firstName,
127
+ lastName: lastName,
128
+ phone: phone,
129
+ },
130
+ })];
131
+ case 1:
132
+ contact = _c.sent();
133
+ return [2 /*return*/, contact];
134
+ }
75
135
  });
76
- return contact;
77
- });
136
+ }); };
78
137
  exports.postContact = postContact;
79
- const deleteContact = (_e) => __awaiter(void 0, [_e], void 0, function* ({ prisma, id }) {
80
- const contact = yield prisma.contact.delete({
81
- where: {
82
- id,
83
- },
138
+ var deleteContact = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
139
+ var contact;
140
+ var prisma = _b.prisma, id = _b.id;
141
+ return __generator(this, function (_c) {
142
+ switch (_c.label) {
143
+ case 0: return [4 /*yield*/, prisma.contact.delete({
144
+ where: {
145
+ id: id,
146
+ },
147
+ })];
148
+ case 1:
149
+ contact = _c.sent();
150
+ return [2 /*return*/, contact];
151
+ }
84
152
  });
85
- return contact;
86
- });
153
+ }); };
87
154
  exports.deleteContact = deleteContact;
@@ -9,55 +9,114 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  step((generator = generator.apply(thisArg, _arguments || [])).next());
10
10
  });
11
11
  };
12
+ var __generator = (this && this.__generator) || function (thisArg, body) {
13
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
14
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
15
+ function verb(n) { return function (v) { return step([n, v]); }; }
16
+ function step(op) {
17
+ if (f) throw new TypeError("Generator is already executing.");
18
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
19
+ 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;
20
+ if (y = 0, t) op = [op[0] & 2, t.value];
21
+ switch (op[0]) {
22
+ case 0: case 1: t = op; break;
23
+ case 4: _.label++; return { value: op[1], done: false };
24
+ case 5: _.label++; y = op[1]; op = [0]; continue;
25
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
26
+ default:
27
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
28
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
29
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
30
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
31
+ if (t[2]) _.ops.pop();
32
+ _.trys.pop(); continue;
33
+ }
34
+ op = body.call(thisArg, _);
35
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
36
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
37
+ }
38
+ };
12
39
  Object.defineProperty(exports, "__esModule", { value: true });
13
40
  exports.deleteCurrency = exports.postCurrency = exports.getCurrencyById = exports.getCurrencies = void 0;
14
- const getCurrencies = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, }) {
15
- const customers = yield prisma.currency.findMany({
16
- orderBy: {
17
- createdAt: 'desc',
18
- },
41
+ var getCurrencies = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
42
+ var customers;
43
+ var prisma = _b.prisma;
44
+ return __generator(this, function (_c) {
45
+ switch (_c.label) {
46
+ case 0: return [4 /*yield*/, prisma.currency.findMany({
47
+ orderBy: {
48
+ createdAt: 'desc',
49
+ },
50
+ })];
51
+ case 1:
52
+ customers = _c.sent();
53
+ return [2 /*return*/, customers];
54
+ }
19
55
  });
20
- return customers;
21
- });
56
+ }); };
22
57
  exports.getCurrencies = getCurrencies;
23
- const getCurrencyById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ id, prisma, }) {
24
- const currency = yield prisma.currency.findUnique({
25
- where: {
26
- id,
27
- },
58
+ var getCurrencyById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
59
+ var currency;
60
+ var id = _b.id, prisma = _b.prisma;
61
+ return __generator(this, function (_c) {
62
+ switch (_c.label) {
63
+ case 0: return [4 /*yield*/, prisma.currency.findUnique({
64
+ where: {
65
+ id: id,
66
+ },
67
+ })];
68
+ case 1:
69
+ currency = _c.sent();
70
+ return [2 /*return*/, currency];
71
+ }
28
72
  });
29
- return currency;
30
- });
73
+ }); };
31
74
  exports.getCurrencyById = getCurrencyById;
32
- const postCurrency = (_c) => __awaiter(void 0, [_c], void 0, function* ({ code, enabled, id, isDefault, label, preferenceId, prisma, }) {
33
- const currency = yield prisma.currency.upsert({
34
- where: {
35
- id,
36
- },
37
- update: {
38
- code,
39
- enabled,
40
- isDefault,
41
- label,
42
- preferenceId,
43
- },
44
- create: {
45
- code,
46
- enabled,
47
- isDefault,
48
- label,
49
- preferenceId,
50
- },
75
+ var postCurrency = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
76
+ var currency;
77
+ var code = _b.code, enabled = _b.enabled, id = _b.id, isDefault = _b.isDefault, label = _b.label, preferenceId = _b.preferenceId, prisma = _b.prisma;
78
+ return __generator(this, function (_c) {
79
+ switch (_c.label) {
80
+ case 0: return [4 /*yield*/, prisma.currency.upsert({
81
+ where: {
82
+ id: id,
83
+ },
84
+ update: {
85
+ code: code,
86
+ enabled: enabled,
87
+ isDefault: isDefault,
88
+ label: label,
89
+ preferenceId: preferenceId,
90
+ },
91
+ create: {
92
+ code: code,
93
+ enabled: enabled,
94
+ isDefault: isDefault,
95
+ label: label,
96
+ preferenceId: preferenceId,
97
+ },
98
+ })];
99
+ case 1:
100
+ currency = _c.sent();
101
+ return [2 /*return*/, currency];
102
+ }
51
103
  });
52
- return currency;
53
- });
104
+ }); };
54
105
  exports.postCurrency = postCurrency;
55
- const deleteCurrency = (_d) => __awaiter(void 0, [_d], void 0, function* ({ id, prisma, }) {
56
- const currency = yield prisma.currency.delete({
57
- where: {
58
- id,
59
- },
106
+ var deleteCurrency = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
107
+ var currency;
108
+ var id = _b.id, prisma = _b.prisma;
109
+ return __generator(this, function (_c) {
110
+ switch (_c.label) {
111
+ case 0: return [4 /*yield*/, prisma.currency.delete({
112
+ where: {
113
+ id: id,
114
+ },
115
+ })];
116
+ case 1:
117
+ currency = _c.sent();
118
+ return [2 /*return*/, currency];
119
+ }
60
120
  });
61
- return currency;
62
- });
121
+ }); };
63
122
  exports.deleteCurrency = deleteCurrency;