@goweekdays/core 2.8.0 → 2.10.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.
- package/CHANGELOG.md +12 -0
- package/dist/index.d.ts +105 -8
- package/dist/index.js +3469 -1862
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3459 -1825
- package/dist/index.mjs.map +1 -1
- package/dist/public/handlebars/org-created.hbs +13 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import * as mongodb from 'mongodb';
|
|
|
4
4
|
import { ObjectId, ClientSession, Db, Collection } from 'mongodb';
|
|
5
5
|
import * as bson from 'bson';
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
+
import * as _paypal_paypal_server_sdk from '@paypal/paypal-server-sdk';
|
|
7
8
|
|
|
8
9
|
declare function useAuthService(): {
|
|
9
10
|
login: ({ email, password }?: {
|
|
@@ -342,6 +343,7 @@ declare function useMemberRepo(): {
|
|
|
342
343
|
}, session?: ClientSession) => Promise<string>;
|
|
343
344
|
updateStatusById: (_id: string | ObjectId, status: string, session?: ClientSession) => Promise<string>;
|
|
344
345
|
deleteById: (_id: string | ObjectId, session?: ClientSession) => Promise<string>;
|
|
346
|
+
updateStatusByOrg: (org: string | ObjectId, status: string, session?: ClientSession) => Promise<string>;
|
|
345
347
|
};
|
|
346
348
|
|
|
347
349
|
declare function useMemberController(): {
|
|
@@ -364,6 +366,7 @@ type TOrg = {
|
|
|
364
366
|
email: string;
|
|
365
367
|
contact?: string;
|
|
366
368
|
createdBy: string | ObjectId;
|
|
369
|
+
promoCode?: string;
|
|
367
370
|
status?: string;
|
|
368
371
|
createdAt?: string | Date;
|
|
369
372
|
updatedAt?: string | Date;
|
|
@@ -394,6 +397,7 @@ declare function useOrgRepo(): {
|
|
|
394
397
|
getByName: (name: string) => Promise<TOrg | null>;
|
|
395
398
|
getByEmail: (email: string) => Promise<TOrg | null>;
|
|
396
399
|
updateById: (_id: string | ObjectId, options: Pick<TOrg, "name" | "description" | "email" | "contact">) => Promise<void>;
|
|
400
|
+
updateStatusById: (_id: string | ObjectId, status: string, session?: ClientSession) => Promise<string>;
|
|
397
401
|
};
|
|
398
402
|
|
|
399
403
|
declare function useOrgService(): {
|
|
@@ -418,8 +422,7 @@ declare function useOrgController(): {
|
|
|
418
422
|
type TPromo = {
|
|
419
423
|
_id?: ObjectId;
|
|
420
424
|
code: string;
|
|
421
|
-
|
|
422
|
-
type: "flat" | "fixed" | "tiered";
|
|
425
|
+
type: "flat" | "fixed" | "volume";
|
|
423
426
|
flatRate?: number;
|
|
424
427
|
fixedRate?: number;
|
|
425
428
|
tiers?: Array<{
|
|
@@ -428,11 +431,12 @@ type TPromo = {
|
|
|
428
431
|
rate: number;
|
|
429
432
|
}>;
|
|
430
433
|
currency: string;
|
|
431
|
-
startDate
|
|
434
|
+
startDate?: Date | string;
|
|
432
435
|
endDate?: Date | string;
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
+
apps?: string[];
|
|
437
|
+
seats?: number;
|
|
438
|
+
usage?: number;
|
|
439
|
+
status?: "active" | "inactive" | "expired";
|
|
436
440
|
createdAt?: Date | string;
|
|
437
441
|
updatedAt?: Date | string;
|
|
438
442
|
deletedAt?: Date | string;
|
|
@@ -451,9 +455,19 @@ declare function usePromoRepo(): {
|
|
|
451
455
|
}) => Promise<TPaginate<TPromo>>;
|
|
452
456
|
getByCode: (code: string) => Promise<TPromo | null>;
|
|
453
457
|
getById: (_id: string | ObjectId) => Promise<TPromo | null>;
|
|
458
|
+
updateById: (_id: string | ObjectId, options: Pick<TPromo, "code" | "apps" | "type" | "flatRate" | "fixedRate" | "tiers" | "currency" | "startDate" | "endDate" | "seats" | "usage">) => Promise<string>;
|
|
454
459
|
deleteById: (_id: string | ObjectId) => Promise<string>;
|
|
455
460
|
};
|
|
456
461
|
|
|
462
|
+
declare function usePromoController(): {
|
|
463
|
+
add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
464
|
+
getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
465
|
+
getByCode: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
466
|
+
getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
467
|
+
updateById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
468
|
+
deleteById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
469
|
+
};
|
|
470
|
+
|
|
457
471
|
type TRole = {
|
|
458
472
|
_id?: ObjectId;
|
|
459
473
|
id?: string | ObjectId;
|
|
@@ -637,6 +651,35 @@ declare function useUtilController(): {
|
|
|
637
651
|
|
|
638
652
|
declare const transactionSchema: Joi.ObjectSchema<any>;
|
|
639
653
|
|
|
654
|
+
interface PaypalWebhookHeaders {
|
|
655
|
+
"paypal-auth-algo"?: string;
|
|
656
|
+
"paypal-cert-url": string;
|
|
657
|
+
"paypal-transmission-id": string;
|
|
658
|
+
"paypal-transmission-sig": string;
|
|
659
|
+
"paypal-transmission-time": string;
|
|
660
|
+
}
|
|
661
|
+
declare function usePaypalService(): {
|
|
662
|
+
addOrder: ({ amount, currency, customId, returnUrl, cancelUrl, action, }?: {
|
|
663
|
+
amount?: number | undefined;
|
|
664
|
+
currency?: string | undefined;
|
|
665
|
+
customId?: string | undefined;
|
|
666
|
+
returnUrl?: string | undefined;
|
|
667
|
+
cancelUrl?: string | undefined;
|
|
668
|
+
action?: string | undefined;
|
|
669
|
+
}) => Promise<_paypal_paypal_server_sdk.ApiResponse<_paypal_paypal_server_sdk.Order>>;
|
|
670
|
+
captureOrder: (id: string) => Promise<_paypal_paypal_server_sdk.ApiResponse<_paypal_paypal_server_sdk.Order>>;
|
|
671
|
+
verifySignature: (rawBody: Buffer | string, headers: PaypalWebhookHeaders, webhookId?: string) => Promise<boolean>;
|
|
672
|
+
createInvoice: (value: {
|
|
673
|
+
email: string;
|
|
674
|
+
amount: number;
|
|
675
|
+
currency: string;
|
|
676
|
+
note?: string;
|
|
677
|
+
title: string;
|
|
678
|
+
dueDate?: string;
|
|
679
|
+
}) => Promise<any>;
|
|
680
|
+
sendInvoice: (invoiceId: string) => Promise<any>;
|
|
681
|
+
};
|
|
682
|
+
|
|
640
683
|
type TVerificationMetadata = {
|
|
641
684
|
name?: string;
|
|
642
685
|
app?: string;
|
|
@@ -794,6 +837,7 @@ type TSubscription = {
|
|
|
794
837
|
currency: string;
|
|
795
838
|
billingCycle: "monthly" | "yearly";
|
|
796
839
|
promoCode?: string;
|
|
840
|
+
retry?: number;
|
|
797
841
|
status?: string;
|
|
798
842
|
nextBillingDate: Date | string;
|
|
799
843
|
createdAt?: Date | string;
|
|
@@ -817,11 +861,17 @@ declare function useSubscriptionRepo(): {
|
|
|
817
861
|
getById: (_id: string | ObjectId) => Promise<TSubscription | null>;
|
|
818
862
|
deleteById: (_id: string | ObjectId) => Promise<string>;
|
|
819
863
|
updateById: (_id: string | ObjectId, options: {
|
|
820
|
-
seats
|
|
864
|
+
seats?: number;
|
|
821
865
|
paidSeats?: number;
|
|
822
866
|
amount?: number;
|
|
823
867
|
promoCode?: string;
|
|
868
|
+
status?: string;
|
|
869
|
+
nextBillingDate?: Date;
|
|
824
870
|
}, session?: ClientSession) => Promise<string>;
|
|
871
|
+
getByStatus: (status?: string, limit?: number, retry?: number) => Promise<TSubscription[]>;
|
|
872
|
+
updateStatusById: (_id: string | ObjectId, status: string, session?: ClientSession) => Promise<string>;
|
|
873
|
+
updateRetryById: (_id: string | ObjectId, retry: number, session?: ClientSession) => Promise<string>;
|
|
874
|
+
getOverdueForSuspension: (limit?: number, daysOverdue?: number) => Promise<TSubscription[]>;
|
|
825
875
|
};
|
|
826
876
|
|
|
827
877
|
declare function useSubscriptionController(): {
|
|
@@ -831,6 +881,20 @@ declare function useSubscriptionController(): {
|
|
|
831
881
|
updateSeats: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
832
882
|
};
|
|
833
883
|
|
|
884
|
+
declare function useSubscriptionService(): {
|
|
885
|
+
updateSeats: ({ id, user, amount, seats, }?: {
|
|
886
|
+
id?: string | undefined;
|
|
887
|
+
user?: string | undefined;
|
|
888
|
+
amount?: number | undefined;
|
|
889
|
+
seats?: number | undefined;
|
|
890
|
+
}) => Promise<string>;
|
|
891
|
+
processInvoices: () => Promise<void>;
|
|
892
|
+
processSuspensions: () => Promise<void>;
|
|
893
|
+
scheduleInvoiceProcessing: () => void;
|
|
894
|
+
scheduleSuspensionProcessing: () => void;
|
|
895
|
+
processPaidInvoice: (invoiceId: string) => Promise<string>;
|
|
896
|
+
};
|
|
897
|
+
|
|
834
898
|
type TSubscriptionTransaction = {
|
|
835
899
|
_id?: ObjectId;
|
|
836
900
|
subscription: string | ObjectId;
|
|
@@ -1023,17 +1087,46 @@ type TJobPost = {
|
|
|
1023
1087
|
deletedAt?: Date;
|
|
1024
1088
|
};
|
|
1025
1089
|
declare const schemaJobPost: Joi.ObjectSchema<any>;
|
|
1090
|
+
declare const schemaJobPostUpdate: Joi.ObjectSchema<any>;
|
|
1026
1091
|
declare function modelJobPost(value: TJobPost): TJobPost;
|
|
1027
1092
|
|
|
1028
1093
|
declare function useJobPostController(): {
|
|
1029
1094
|
add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
1095
|
+
getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
1096
|
+
getJobPostsByOrg: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
1097
|
+
getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
1098
|
+
updateById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
1030
1099
|
deleteById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
1100
|
+
updateStatusById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
1031
1101
|
};
|
|
1032
1102
|
|
|
1033
1103
|
declare function useJobPostRepo(): {
|
|
1034
1104
|
createIndexes: () => Promise<string>;
|
|
1035
1105
|
add: (value: TJobPost, session?: ClientSession) => Promise<ObjectId>;
|
|
1106
|
+
getAll: ({ search, page, limit, status, }?: {
|
|
1107
|
+
search?: string | undefined;
|
|
1108
|
+
page?: number | undefined;
|
|
1109
|
+
limit?: number | undefined;
|
|
1110
|
+
status?: string | undefined;
|
|
1111
|
+
}) => Promise<Record<string, any>>;
|
|
1112
|
+
getJobPostsByOrg: ({ search, page, limit, org, status, }?: {
|
|
1113
|
+
org: string | ObjectId;
|
|
1114
|
+
page: number;
|
|
1115
|
+
limit?: number | undefined;
|
|
1116
|
+
search?: string | undefined;
|
|
1117
|
+
status?: string | undefined;
|
|
1118
|
+
}) => Promise<{
|
|
1119
|
+
items: any[];
|
|
1120
|
+
pages: number;
|
|
1121
|
+
pageRange: string;
|
|
1122
|
+
} | {
|
|
1123
|
+
_id: ObjectId;
|
|
1124
|
+
name: string;
|
|
1125
|
+
}[]>;
|
|
1126
|
+
getById: (_id: string | ObjectId) => Promise<TJobPost>;
|
|
1127
|
+
updateById: (_id: string | ObjectId, options: Pick<TJobPost, "title" | "setup" | "location" | "type" | "description">) => Promise<string>;
|
|
1036
1128
|
deleteById: (_id: string | ObjectId, session?: ClientSession) => Promise<string>;
|
|
1129
|
+
updateStatusById: (_id: string | ObjectId, status: string) => Promise<string>;
|
|
1037
1130
|
};
|
|
1038
1131
|
|
|
1039
1132
|
declare function useJobPostService(): {
|
|
@@ -1050,6 +1143,8 @@ type TLedgerBill = {
|
|
|
1050
1143
|
status: "pending" | "paid" | "overdue";
|
|
1051
1144
|
billingFrom?: string | Date;
|
|
1052
1145
|
billingTo?: string | Date;
|
|
1146
|
+
payerViewUrl?: string;
|
|
1147
|
+
invoice?: string;
|
|
1053
1148
|
paidAt?: string | Date;
|
|
1054
1149
|
dueDate?: string | Date;
|
|
1055
1150
|
createdAt?: string | Date;
|
|
@@ -1072,7 +1167,9 @@ declare function useLedgerBillingRepo(): {
|
|
|
1072
1167
|
status?: string | undefined;
|
|
1073
1168
|
}) => Promise<Record<string, any>>;
|
|
1074
1169
|
getById: (_id: string | ObjectId) => Promise<TLedgerBill | null>;
|
|
1170
|
+
getByInvoice: (invoice: string) => Promise<TLedgerBill | null>;
|
|
1075
1171
|
getSummary: (status: string, org: string | ObjectId) => Promise<bson.Document>;
|
|
1172
|
+
updateStatusById: (_id: string | ObjectId, status: string, session?: ClientSession) => Promise<boolean>;
|
|
1076
1173
|
};
|
|
1077
1174
|
|
|
1078
1175
|
declare function useLedgerBillingController(): {
|
|
@@ -1120,4 +1217,4 @@ declare const XENDIT_BASE_URL: string;
|
|
|
1120
1217
|
declare const DOMAIN: string;
|
|
1121
1218
|
declare const APP_ORG: string;
|
|
1122
1219
|
|
|
1123
|
-
export { ACCESS_TOKEN_EXPIRY, ACCESS_TOKEN_SECRET, APP_ACCOUNT, APP_MAIN, APP_ORG, DEFAULT_USER_EMAIL, DEFAULT_USER_FIRST_NAME, DEFAULT_USER_LAST_NAME, DEFAULT_USER_PASSWORD, DOMAIN, MAILER_EMAIL, MAILER_PASSWORD, MAILER_TRANSPORT_HOST, MAILER_TRANSPORT_PORT, MAILER_TRANSPORT_SECURE, MBuilding, MBuildingUnit, MFile, MONGO_DB, MONGO_URI, PAYPAL_API_URL, PAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET, PAYPAL_WEBHOOK_ID, PORT, REDIS_HOST, REDIS_PASSWORD, REDIS_PORT, REFRESH_TOKEN_EXPIRY, REFRESH_TOKEN_SECRET, SECRET_KEY, SPACES_ACCESS_KEY, SPACES_BUCKET, SPACES_ENDPOINT, SPACES_REGION, SPACES_SECRET_KEY, TApp, TBuilding, TBuildingUnit, TCounter, TFile, TJobPost, TLedgerBill, TMember, TOrg, TPermission, TPermissionGroup, TPlan, TPromo, TRole, TSubscription, TSubscriptionTransaction, TUser, TVerification, TVerificationMetadata, VERIFICATION_FORGET_PASSWORD_DURATION, VERIFICATION_USER_INVITE_DURATION, XENDIT_BASE_URL, XENDIT_SECRET_KEY, currencies, isDev, ledgerBillStatuses, ledgerBillTypes, modelApp, modelJobPost, modelLedgerBill, modelMember, modelOrg, modelPermission, modelPermissionGroup, modelPlan, modelPromo, modelRole, modelSubscription, modelSubscriptionTransaction, modelUser, modelVerification, schemaApp, schemaAppUpdate, schemaBuilding, schemaBuildingUnit, schemaInviteMember, schemaJobPost, schemaLedgerBill, schemaLedgerBillingSummary, schemaMember, schemaMemberRole, schemaMemberStatus, schemaOrg, schemaOrgAdd, schemaOrgUpdate, schemaPermission, schemaPermissionGroup, schemaPermissionGroupUpdate, schemaPermissionUpdate, schemaPlan, schemaPromo, schemaRole, schemaRoleUpdate, schemaSubscription, schemaSubscriptionSeats, schemaSubscriptionTransaction, schemaSubscriptionUpdate, schemaUpdateOptions, schemaUser, schemaVerification, transactionSchema, useAppController, useAppRepo, useAppService, useAuthController, useAuthService, useBuildingController, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useCounterModel, useCounterRepo, useFileController, useFileRepo, useFileService, useGitHubService, useJobPostController, useJobPostRepo, useJobPostService, useLedgerBillingController, useLedgerBillingRepo, useMemberController, useMemberRepo, useOrgController, useOrgRepo, useOrgService, usePermissionController, usePermissionGroupController, usePermissionGroupRepo, usePermissionGroupService, usePermissionRepo, usePermissionService, usePlanController, usePlanRepo, usePlanService, usePromoRepo, useRoleController, useRoleRepo, useRoleService, useSubscriptionController, useSubscriptionRepo, useSubscriptionTransactionController, useSubscriptionTransactionRepo, useUserController, useUserRepo, useUserService, useUtilController, useVerificationController, useVerificationRepo, useVerificationService };
|
|
1220
|
+
export { ACCESS_TOKEN_EXPIRY, ACCESS_TOKEN_SECRET, APP_ACCOUNT, APP_MAIN, APP_ORG, DEFAULT_USER_EMAIL, DEFAULT_USER_FIRST_NAME, DEFAULT_USER_LAST_NAME, DEFAULT_USER_PASSWORD, DOMAIN, MAILER_EMAIL, MAILER_PASSWORD, MAILER_TRANSPORT_HOST, MAILER_TRANSPORT_PORT, MAILER_TRANSPORT_SECURE, MBuilding, MBuildingUnit, MFile, MONGO_DB, MONGO_URI, PAYPAL_API_URL, PAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET, PAYPAL_WEBHOOK_ID, PORT, PaypalWebhookHeaders, REDIS_HOST, REDIS_PASSWORD, REDIS_PORT, REFRESH_TOKEN_EXPIRY, REFRESH_TOKEN_SECRET, SECRET_KEY, SPACES_ACCESS_KEY, SPACES_BUCKET, SPACES_ENDPOINT, SPACES_REGION, SPACES_SECRET_KEY, TApp, TBuilding, TBuildingUnit, TCounter, TFile, TJobPost, TLedgerBill, TMember, TOrg, TPermission, TPermissionGroup, TPlan, TPromo, TRole, TSubscription, TSubscriptionTransaction, TUser, TVerification, TVerificationMetadata, VERIFICATION_FORGET_PASSWORD_DURATION, VERIFICATION_USER_INVITE_DURATION, XENDIT_BASE_URL, XENDIT_SECRET_KEY, currencies, isDev, ledgerBillStatuses, ledgerBillTypes, modelApp, modelJobPost, modelLedgerBill, modelMember, modelOrg, modelPermission, modelPermissionGroup, modelPlan, modelPromo, modelRole, modelSubscription, modelSubscriptionTransaction, modelUser, modelVerification, schemaApp, schemaAppUpdate, schemaBuilding, schemaBuildingUnit, schemaInviteMember, schemaJobPost, schemaJobPostUpdate, schemaLedgerBill, schemaLedgerBillingSummary, schemaMember, schemaMemberRole, schemaMemberStatus, schemaOrg, schemaOrgAdd, schemaOrgUpdate, schemaPermission, schemaPermissionGroup, schemaPermissionGroupUpdate, schemaPermissionUpdate, schemaPlan, schemaPromo, schemaRole, schemaRoleUpdate, schemaSubscription, schemaSubscriptionSeats, schemaSubscriptionTransaction, schemaSubscriptionUpdate, schemaUpdateOptions, schemaUser, schemaVerification, transactionSchema, useAppController, useAppRepo, useAppService, useAuthController, useAuthService, useBuildingController, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useCounterModel, useCounterRepo, useFileController, useFileRepo, useFileService, useGitHubService, useJobPostController, useJobPostRepo, useJobPostService, useLedgerBillingController, useLedgerBillingRepo, useMemberController, useMemberRepo, useOrgController, useOrgRepo, useOrgService, usePaypalService, usePermissionController, usePermissionGroupController, usePermissionGroupRepo, usePermissionGroupService, usePermissionRepo, usePermissionService, usePlanController, usePlanRepo, usePlanService, usePromoController, usePromoRepo, useRoleController, useRoleRepo, useRoleService, useSubscriptionController, useSubscriptionRepo, useSubscriptionService, useSubscriptionTransactionController, useSubscriptionTransactionRepo, useUserController, useUserRepo, useUserService, useUtilController, useVerificationController, useVerificationRepo, useVerificationService };
|