@amohamud23/notihub 1.0.152 → 1.0.154
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/dist/index.cjs +14 -0
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +13 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -51,6 +51,7 @@ __export(src_exports, {
|
|
|
51
51
|
UserModel: () => UserModel_default,
|
|
52
52
|
ViewsModel: () => ViewsModel_default,
|
|
53
53
|
addMonths: () => addMonths,
|
|
54
|
+
formatResponse: () => formatResponse,
|
|
54
55
|
getDate: () => getDate,
|
|
55
56
|
getDateFormat: () => getDateFormat,
|
|
56
57
|
handleError: () => handleError,
|
|
@@ -147,6 +148,18 @@ var handleSuccess = (data, res, statusCode = 200) => {
|
|
|
147
148
|
res.status(statusCode).json(response);
|
|
148
149
|
};
|
|
149
150
|
|
|
151
|
+
// src/util/responseUtils.ts
|
|
152
|
+
var formatResponse = (data, message = "Success", error, statusCode = 200) => {
|
|
153
|
+
const response = {
|
|
154
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
155
|
+
data: data || null,
|
|
156
|
+
message,
|
|
157
|
+
statusCode,
|
|
158
|
+
error
|
|
159
|
+
};
|
|
160
|
+
return response;
|
|
161
|
+
};
|
|
162
|
+
|
|
150
163
|
// src/models/UserModel.ts
|
|
151
164
|
var import_mongoose = require("mongoose");
|
|
152
165
|
|
|
@@ -837,6 +850,7 @@ var InvalidPushToken = "4009";
|
|
|
837
850
|
UserModel,
|
|
838
851
|
ViewsModel,
|
|
839
852
|
addMonths,
|
|
853
|
+
formatResponse,
|
|
840
854
|
getDate,
|
|
841
855
|
getDateFormat,
|
|
842
856
|
handleError,
|
package/dist/index.d.cts
CHANGED
|
@@ -229,6 +229,8 @@ declare const handleError: (error: any, res: Response$1, req?: any) => void;
|
|
|
229
229
|
*/
|
|
230
230
|
declare const handleSuccess: <T>(data: T, res: Response$1, statusCode?: number) => void;
|
|
231
231
|
|
|
232
|
+
declare const formatResponse: (data: any, message: string | undefined, error: any, statusCode?: number) => Response;
|
|
233
|
+
|
|
232
234
|
declare const UserModel: mongoose.Model<INotiHubUser, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubUser> & INotiHubUser & {
|
|
233
235
|
_id: mongoose.Types.ObjectId;
|
|
234
236
|
} & {
|
|
@@ -424,4 +426,4 @@ declare namespace errorcodes {
|
|
|
424
426
|
export { errorcodes_CustomerNotFound as CustomerNotFound, errorcodes_DocumentNotFound as DocumentNotFound, errorcodes_InvalidEmail as InvalidEmail, errorcodes_InvalidName as InvalidName, errorcodes_InvalidPassword as InvalidPassword, errorcodes_InvalidPushToken as InvalidPushToken, errorcodes_UserNotFound as UserNotFound };
|
|
425
427
|
}
|
|
426
428
|
|
|
427
|
-
export { type CreateNotiRequestBody, type CreateSubscriptionRequestBody, type CreateUserRequestBody, Customer$1 as Customer, CustomerMetadata, CustomerMinified, CustomerNotiHubStats, DocumentNotFoundException, errorcodes as ErrorCode, type ICreateCustomerRequestBody, type ICreateNotiRequestBody, type INotiHubCustomer, type INotiHubCustomerMetadata, type INotiHubCustomerMinified, type INotiHubImage, type INotiHubNotification, type INotiHubNotificationStats, type INotiHubPaymentSession, type INotiHubStats, type INotiHubStatsHistory, type INotiHubStripeSubscription, type INotiHubSubscription, type INotiHubSubscriptionActivity, type INotiHubUser, type INotiHubUserView, type INotiType, type INotiTypeStats, type IUserSubscribeNotifier, type IUserSubscription, client as MongooseClient, NotiHubStatsHistory, type NotiHubTypes, NotiTypeModel, NotiTypeStatsModel, NotificationModel, NotificationStatsModel as NotificationStats, PaymentSessionModel, type Response, StripScriptionModel, Subscription, SubscriptionActivity, SubscriptionType, TABLES, UserModel, ViewsModel, addMonths, getDate, getDateFormat, handleError, handleSuccess };
|
|
429
|
+
export { type CreateNotiRequestBody, type CreateSubscriptionRequestBody, type CreateUserRequestBody, Customer$1 as Customer, CustomerMetadata, CustomerMinified, CustomerNotiHubStats, DocumentNotFoundException, errorcodes as ErrorCode, type ICreateCustomerRequestBody, type ICreateNotiRequestBody, type INotiHubCustomer, type INotiHubCustomerMetadata, type INotiHubCustomerMinified, type INotiHubImage, type INotiHubNotification, type INotiHubNotificationStats, type INotiHubPaymentSession, type INotiHubStats, type INotiHubStatsHistory, type INotiHubStripeSubscription, type INotiHubSubscription, type INotiHubSubscriptionActivity, type INotiHubUser, type INotiHubUserView, type INotiType, type INotiTypeStats, type IUserSubscribeNotifier, type IUserSubscription, client as MongooseClient, NotiHubStatsHistory, type NotiHubTypes, NotiTypeModel, NotiTypeStatsModel, NotificationModel, NotificationStatsModel as NotificationStats, PaymentSessionModel, type Response, StripScriptionModel, Subscription, SubscriptionActivity, SubscriptionType, TABLES, UserModel, ViewsModel, addMonths, formatResponse, getDate, getDateFormat, handleError, handleSuccess };
|
package/dist/index.d.ts
CHANGED
|
@@ -229,6 +229,8 @@ declare const handleError: (error: any, res: Response$1, req?: any) => void;
|
|
|
229
229
|
*/
|
|
230
230
|
declare const handleSuccess: <T>(data: T, res: Response$1, statusCode?: number) => void;
|
|
231
231
|
|
|
232
|
+
declare const formatResponse: (data: any, message: string | undefined, error: any, statusCode?: number) => Response;
|
|
233
|
+
|
|
232
234
|
declare const UserModel: mongoose.Model<INotiHubUser, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubUser> & INotiHubUser & {
|
|
233
235
|
_id: mongoose.Types.ObjectId;
|
|
234
236
|
} & {
|
|
@@ -424,4 +426,4 @@ declare namespace errorcodes {
|
|
|
424
426
|
export { errorcodes_CustomerNotFound as CustomerNotFound, errorcodes_DocumentNotFound as DocumentNotFound, errorcodes_InvalidEmail as InvalidEmail, errorcodes_InvalidName as InvalidName, errorcodes_InvalidPassword as InvalidPassword, errorcodes_InvalidPushToken as InvalidPushToken, errorcodes_UserNotFound as UserNotFound };
|
|
425
427
|
}
|
|
426
428
|
|
|
427
|
-
export { type CreateNotiRequestBody, type CreateSubscriptionRequestBody, type CreateUserRequestBody, Customer$1 as Customer, CustomerMetadata, CustomerMinified, CustomerNotiHubStats, DocumentNotFoundException, errorcodes as ErrorCode, type ICreateCustomerRequestBody, type ICreateNotiRequestBody, type INotiHubCustomer, type INotiHubCustomerMetadata, type INotiHubCustomerMinified, type INotiHubImage, type INotiHubNotification, type INotiHubNotificationStats, type INotiHubPaymentSession, type INotiHubStats, type INotiHubStatsHistory, type INotiHubStripeSubscription, type INotiHubSubscription, type INotiHubSubscriptionActivity, type INotiHubUser, type INotiHubUserView, type INotiType, type INotiTypeStats, type IUserSubscribeNotifier, type IUserSubscription, client as MongooseClient, NotiHubStatsHistory, type NotiHubTypes, NotiTypeModel, NotiTypeStatsModel, NotificationModel, NotificationStatsModel as NotificationStats, PaymentSessionModel, type Response, StripScriptionModel, Subscription, SubscriptionActivity, SubscriptionType, TABLES, UserModel, ViewsModel, addMonths, getDate, getDateFormat, handleError, handleSuccess };
|
|
429
|
+
export { type CreateNotiRequestBody, type CreateSubscriptionRequestBody, type CreateUserRequestBody, Customer$1 as Customer, CustomerMetadata, CustomerMinified, CustomerNotiHubStats, DocumentNotFoundException, errorcodes as ErrorCode, type ICreateCustomerRequestBody, type ICreateNotiRequestBody, type INotiHubCustomer, type INotiHubCustomerMetadata, type INotiHubCustomerMinified, type INotiHubImage, type INotiHubNotification, type INotiHubNotificationStats, type INotiHubPaymentSession, type INotiHubStats, type INotiHubStatsHistory, type INotiHubStripeSubscription, type INotiHubSubscription, type INotiHubSubscriptionActivity, type INotiHubUser, type INotiHubUserView, type INotiType, type INotiTypeStats, type IUserSubscribeNotifier, type IUserSubscription, client as MongooseClient, NotiHubStatsHistory, type NotiHubTypes, NotiTypeModel, NotiTypeStatsModel, NotificationModel, NotificationStatsModel as NotificationStats, PaymentSessionModel, type Response, StripScriptionModel, Subscription, SubscriptionActivity, SubscriptionType, TABLES, UserModel, ViewsModel, addMonths, formatResponse, getDate, getDateFormat, handleError, handleSuccess };
|
package/dist/index.js
CHANGED
|
@@ -93,6 +93,18 @@ var handleSuccess = (data, res, statusCode = 200) => {
|
|
|
93
93
|
res.status(statusCode).json(response);
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
+
// src/util/responseUtils.ts
|
|
97
|
+
var formatResponse = (data, message = "Success", error, statusCode = 200) => {
|
|
98
|
+
const response = {
|
|
99
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
100
|
+
data: data || null,
|
|
101
|
+
message,
|
|
102
|
+
statusCode,
|
|
103
|
+
error
|
|
104
|
+
};
|
|
105
|
+
return response;
|
|
106
|
+
};
|
|
107
|
+
|
|
96
108
|
// src/models/UserModel.ts
|
|
97
109
|
import { Schema, model } from "mongoose";
|
|
98
110
|
|
|
@@ -793,6 +805,7 @@ export {
|
|
|
793
805
|
UserModel_default as UserModel,
|
|
794
806
|
ViewsModel_default as ViewsModel,
|
|
795
807
|
addMonths,
|
|
808
|
+
formatResponse,
|
|
796
809
|
getDate,
|
|
797
810
|
getDateFormat,
|
|
798
811
|
handleError,
|