@react-pakistan/util-functions 1.22.35 → 1.22.37

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.
@@ -0,0 +1,31 @@
1
+ interface AppUserBE {
2
+ createdAt: string;
3
+ email: string;
4
+ firstName: string;
5
+ id: string;
6
+ lastName: string;
7
+ updatedAt: string;
8
+ }
9
+ interface GetAppUsersArgs {
10
+ prisma: any;
11
+ }
12
+ interface GetAppUserByIdArgs {
13
+ id: string;
14
+ prisma: any;
15
+ }
16
+ interface PostAppUserArgs {
17
+ prisma: any;
18
+ id: string;
19
+ email: string;
20
+ firstName: string;
21
+ lastName: string;
22
+ }
23
+ interface DeleteAppUserArgs {
24
+ prisma: any;
25
+ id: string;
26
+ }
27
+ export declare const getAppUsers: ({ prisma }: GetAppUsersArgs) => Promise<Array<AppUserBE>>;
28
+ export declare const getAppUserById: ({ prisma, id }: GetAppUserByIdArgs) => Promise<AppUserBE>;
29
+ export declare const postAppUser: ({ prisma, id, email, firstName, lastName, }: PostAppUserArgs) => Promise<Array<AppUserBE>>;
30
+ export declare const deleteAppUser: ({ prisma, id }: DeleteAppUserArgs) => Promise<AppUserBE>;
31
+ export {};
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.deleteAppUser = exports.postAppUser = exports.getAppUserById = exports.getAppUsers = void 0;
14
+ const getAppUsers = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma }) {
15
+ const appUsers = yield prisma.stellarAppUser.findMany({
16
+ orderBy: {
17
+ createdAt: 'desc',
18
+ },
19
+ });
20
+ return appUsers;
21
+ });
22
+ exports.getAppUsers = getAppUsers;
23
+ const getAppUserById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ prisma, id }) {
24
+ const appUser = yield prisma.stellarAppUser.findUnique({
25
+ where: {
26
+ id,
27
+ },
28
+ });
29
+ return appUser;
30
+ });
31
+ exports.getAppUserById = getAppUserById;
32
+ const postAppUser = (_c) => __awaiter(void 0, [_c], void 0, function* ({ prisma, id, email, firstName, lastName, }) {
33
+ const appUser = yield prisma.stellarAppUser.upsert({
34
+ where: {
35
+ id,
36
+ },
37
+ update: {
38
+ email,
39
+ firstName,
40
+ lastName,
41
+ },
42
+ create: {
43
+ email,
44
+ firstName,
45
+ lastName,
46
+ },
47
+ });
48
+ return appUser;
49
+ });
50
+ exports.postAppUser = postAppUser;
51
+ const deleteAppUser = (_d) => __awaiter(void 0, [_d], void 0, function* ({ prisma, id }) {
52
+ const appUser = yield prisma.stellarAppUser.delete({
53
+ where: {
54
+ id,
55
+ },
56
+ });
57
+ return appUser;
58
+ });
59
+ exports.deleteAppUser = deleteAppUser;
@@ -0,0 +1,41 @@
1
+ interface BankingDetailBE {
2
+ accountNumber: string;
3
+ accountTitle: string;
4
+ bankAddress: string;
5
+ bankName: string;
6
+ createdAt: string;
7
+ enabled: boolean;
8
+ iban: string;
9
+ id: string;
10
+ swiftCode: string;
11
+ updatedAt: string;
12
+ }
13
+ interface GetBankingDetailsArgs {
14
+ prisma: any;
15
+ }
16
+ interface GetBankingDetailByIdArgs {
17
+ id: string;
18
+ prisma: any;
19
+ }
20
+ interface PostBankingDetailArgs {
21
+ accountNumber: string;
22
+ accountTitle: string;
23
+ bankAddress: string;
24
+ bankName: string;
25
+ createdAt: string;
26
+ enabled: boolean;
27
+ iban: string;
28
+ id: string;
29
+ preferenceId: string;
30
+ prisma: any;
31
+ swiftCode: string;
32
+ }
33
+ interface DeleteBankingDetailArgs {
34
+ id: string;
35
+ prisma: any;
36
+ }
37
+ export declare const getBankingDetails: ({ prisma }: GetBankingDetailsArgs) => Promise<Array<BankingDetailBE>>;
38
+ export declare const getBankingDetailById: ({ prisma, id }: GetBankingDetailByIdArgs) => Promise<BankingDetailBE>;
39
+ export declare const postBankingDetail: ({ prisma, accountNumber, accountTitle, bankAddress, bankName, enabled, iban, id, preferenceId, swiftCode, }: PostBankingDetailArgs) => Promise<Array<BankingDetailBE>>;
40
+ export declare const deleteBankingDetail: ({ prisma, id, }: DeleteBankingDetailArgs) => Promise<BankingDetailBE>;
41
+ export {};
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.deleteBankingDetail = exports.postBankingDetail = exports.getBankingDetailById = exports.getBankingDetails = void 0;
14
+ const getBankingDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma }) {
15
+ const bankingDetails = yield prisma.stellarBankingDetail.findMany({
16
+ orderBy: {
17
+ createdAt: 'desc',
18
+ },
19
+ });
20
+ return bankingDetails;
21
+ });
22
+ exports.getBankingDetails = getBankingDetails;
23
+ const getBankingDetailById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ prisma, id }) {
24
+ const bankingDetail = yield prisma.stellarBankingDetail.findUnique({
25
+ where: {
26
+ id,
27
+ },
28
+ });
29
+ return bankingDetail;
30
+ });
31
+ exports.getBankingDetailById = getBankingDetailById;
32
+ const postBankingDetail = (_c) => __awaiter(void 0, [_c], void 0, function* ({ prisma, accountNumber, accountTitle, bankAddress, bankName, enabled, iban, id, preferenceId, swiftCode, }) {
33
+ const bankingDetail = yield prisma.stellarBankingDetail.upsert({
34
+ where: {
35
+ id,
36
+ },
37
+ update: {
38
+ accountNumber,
39
+ accountTitle,
40
+ bankAddress,
41
+ bankName,
42
+ enabled,
43
+ iban,
44
+ preferenceId,
45
+ swiftCode,
46
+ },
47
+ create: {
48
+ accountNumber,
49
+ accountTitle,
50
+ bankAddress,
51
+ bankName,
52
+ enabled,
53
+ iban,
54
+ preferenceId,
55
+ swiftCode,
56
+ },
57
+ });
58
+ return bankingDetail;
59
+ });
60
+ exports.postBankingDetail = postBankingDetail;
61
+ const deleteBankingDetail = (_d) => __awaiter(void 0, [_d], void 0, function* ({ prisma, id, }) {
62
+ const bankingDetail = yield prisma.stellarBankingDetail.delete({
63
+ where: {
64
+ id,
65
+ },
66
+ });
67
+ return bankingDetail;
68
+ });
69
+ exports.deleteBankingDetail = deleteBankingDetail;
@@ -0,0 +1,40 @@
1
+ interface BranchBE {
2
+ branchAddress: string;
3
+ branchName: string;
4
+ createdAt: string;
5
+ enabled: boolean;
6
+ id: string;
7
+ isDefault: boolean;
8
+ personEmail: string;
9
+ personName: string;
10
+ personPhone: string;
11
+ updatedAt: string;
12
+ }
13
+ interface GetBranchesArgs {
14
+ prisma: any;
15
+ }
16
+ interface GetBranchByIdArgs {
17
+ id: string;
18
+ prisma: any;
19
+ }
20
+ interface PostBranchArgs {
21
+ prisma: any;
22
+ branchAddress: string;
23
+ branchName: string;
24
+ enabled: boolean;
25
+ id: string;
26
+ isDefault: boolean;
27
+ personEmail: string;
28
+ personName: string;
29
+ personPhone: string;
30
+ preferenceId: string;
31
+ }
32
+ interface DeleteBranchArgs {
33
+ id: string;
34
+ prisma: any;
35
+ }
36
+ export declare const getBranches: ({ prisma }: GetBranchesArgs) => Promise<Array<BranchBE>>;
37
+ export declare const getBranchById: ({ prisma, id }: GetBranchByIdArgs) => Promise<BranchBE>;
38
+ export declare const postBranch: ({ prisma, branchAddress, branchName, enabled, id, isDefault, personEmail, personName, personPhone, preferenceId, }: PostBranchArgs) => Promise<Array<BranchBE>>;
39
+ export declare const deleteBranch: ({ prisma, id, }: DeleteBranchArgs) => Promise<BranchBE>;
40
+ export {};
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.deleteBranch = exports.postBranch = exports.getBranchById = exports.getBranches = void 0;
14
+ const getBranches = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma }) {
15
+ const branches = yield prisma.stellarBranch.findMany({
16
+ orderBy: {
17
+ createdAt: 'desc',
18
+ },
19
+ });
20
+ return branches;
21
+ });
22
+ exports.getBranches = getBranches;
23
+ const getBranchById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ prisma, id }) {
24
+ const branch = yield prisma.stellarBranch.findUnique({
25
+ where: {
26
+ id,
27
+ },
28
+ });
29
+ return branch;
30
+ });
31
+ exports.getBranchById = getBranchById;
32
+ const postBranch = (_c) => __awaiter(void 0, [_c], void 0, function* ({ prisma, branchAddress, branchName, enabled, id, isDefault, personEmail, personName, personPhone, preferenceId, }) {
33
+ const branch = yield prisma.stellarBranch.upsert({
34
+ where: {
35
+ id,
36
+ },
37
+ update: {
38
+ branchAddress,
39
+ branchName,
40
+ enabled,
41
+ isDefault,
42
+ personEmail,
43
+ personName,
44
+ personPhone,
45
+ preferenceId,
46
+ },
47
+ create: {
48
+ branchAddress,
49
+ branchName,
50
+ enabled,
51
+ isDefault,
52
+ personEmail,
53
+ personName,
54
+ personPhone,
55
+ preferenceId,
56
+ },
57
+ });
58
+ return branch;
59
+ });
60
+ exports.postBranch = postBranch;
61
+ const deleteBranch = (_d) => __awaiter(void 0, [_d], void 0, function* ({ prisma, id, }) {
62
+ const branch = yield prisma.stellarBranch.delete({
63
+ where: {
64
+ id,
65
+ },
66
+ });
67
+ return branch;
68
+ });
69
+ exports.deleteBranch = deleteBranch;
@@ -0,0 +1,43 @@
1
+ interface CompanyBE {
2
+ country: string;
3
+ email: string;
4
+ id: string;
5
+ name: string;
6
+ phone: boolean;
7
+ updatedAt: string;
8
+ website: boolean;
9
+ }
10
+ interface GetCompaniesArgs {
11
+ prisma: any;
12
+ }
13
+ interface GetCompanyByIdArgs {
14
+ id: string;
15
+ prisma: any;
16
+ }
17
+ interface PostCompaniesArgs {
18
+ currentPage: number;
19
+ pageLimit: number;
20
+ prisma: any;
21
+ queryWhere: {
22
+ [key: string]: any;
23
+ };
24
+ }
25
+ interface PostCompanyArgs {
26
+ prisma: any;
27
+ country: string;
28
+ email: string;
29
+ name: boolean;
30
+ id: string;
31
+ phone: boolean;
32
+ website: string;
33
+ }
34
+ interface DeleteCompanyArgs {
35
+ id: string;
36
+ prisma: any;
37
+ }
38
+ export declare const getCompanies: ({ prisma }: GetCompaniesArgs) => Promise<Array<CompanyBE>>;
39
+ export declare const getCompanyById: ({ prisma, id }: GetCompanyByIdArgs) => Promise<CompanyBE>;
40
+ export declare const postCompanies: ({ prisma, queryWhere, pageLimit, currentPage, }: PostCompaniesArgs) => Promise<Array<CompanyBE>>;
41
+ export declare const postCompany: ({ prisma, country, email, name, id, phone, website, }: PostCompanyArgs) => Promise<Array<CompanyBE>>;
42
+ export declare const deleteCompany: ({ prisma, id, }: DeleteCompanyArgs) => Promise<CompanyBE>;
43
+ export {};
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-explicit-any, no-restricted-globals */
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ 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.stellarCompany.findMany({
16
+ orderBy: {
17
+ createdAt: 'desc',
18
+ },
19
+ });
20
+ return companies;
21
+ });
22
+ exports.getCompanies = getCompanies;
23
+ const getCompanyById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ prisma, id }) {
24
+ const company = yield prisma.stellarCompany.findUnique({
25
+ where: {
26
+ id,
27
+ },
28
+ });
29
+ return company;
30
+ });
31
+ exports.getCompanyById = getCompanyById;
32
+ const postCompanies = (_c) => __awaiter(void 0, [_c], void 0, function* ({ prisma, queryWhere, pageLimit, currentPage, }) {
33
+ const companies = yield prisma.$transaction([
34
+ prisma.stellarCompany.count({
35
+ where: queryWhere,
36
+ }),
37
+ prisma.stellarCompany.findMany({
38
+ orderBy: {
39
+ createdAt: 'desc',
40
+ },
41
+ include: {
42
+ contacts: true,
43
+ },
44
+ where: queryWhere,
45
+ take: pageLimit,
46
+ skip: currentPage === 1 ? 0 : currentPage - 1 * pageLimit,
47
+ }),
48
+ ]);
49
+ return companies;
50
+ });
51
+ exports.postCompanies = postCompanies;
52
+ const postCompany = (_d) => __awaiter(void 0, [_d], void 0, function* ({ prisma, country, email, name, id, phone, website, }) {
53
+ const company = yield prisma.stellarCompany.upsert({
54
+ where: {
55
+ id,
56
+ },
57
+ update: {
58
+ country,
59
+ email,
60
+ name,
61
+ phone,
62
+ website,
63
+ },
64
+ create: {
65
+ country,
66
+ email,
67
+ name,
68
+ phone,
69
+ website,
70
+ },
71
+ });
72
+ return company;
73
+ });
74
+ exports.postCompany = postCompany;
75
+ const deleteCompany = (_e) => __awaiter(void 0, [_e], void 0, function* ({ prisma, id, }) {
76
+ const company = yield prisma.stellarCompany.delete({
77
+ where: {
78
+ id,
79
+ },
80
+ });
81
+ return company;
82
+ });
83
+ exports.deleteCompany = deleteCompany;
package/index.d.ts CHANGED
@@ -1,3 +1,7 @@
1
+ export * from './api/stellar-solutions/app-user';
2
+ export * from './api/stellar-solutions/banking-detail';
3
+ export * from './api/stellar-solutions/branch';
4
+ export * from './api/stellar-solutions/company';
1
5
  export * from './api/stellar-solutions/customer';
2
6
  export * from './api/cors';
3
7
  export * from './constants';
package/index.js CHANGED
@@ -14,6 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./api/stellar-solutions/app-user"), exports);
18
+ __exportStar(require("./api/stellar-solutions/banking-detail"), exports);
19
+ __exportStar(require("./api/stellar-solutions/branch"), exports);
20
+ __exportStar(require("./api/stellar-solutions/company"), exports);
17
21
  __exportStar(require("./api/stellar-solutions/customer"), exports);
18
22
  __exportStar(require("./api/cors"), exports);
19
23
  __exportStar(require("./constants"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.22.35",
3
+ "version": "1.22.37",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {