@amohamud23/notihub 1.0.85 → 1.0.87
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 +9 -4
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +48 -64
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -32,6 +32,7 @@ var src_exports = {};
|
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
Customer: () => CustomerModel_default,
|
|
34
34
|
CustomerMinified: () => CustomerMinifiedModel_default,
|
|
35
|
+
MongooseClient: () => MongooseClient_default,
|
|
35
36
|
NotiHubStatsHistory: () => NotiHubStatsHistoryModel_default,
|
|
36
37
|
NotiTypeModel: () => NotiTypeModel_default,
|
|
37
38
|
NotificationModel: () => NotificationModel_default,
|
|
@@ -44,7 +45,6 @@ __export(src_exports, {
|
|
|
44
45
|
getDateFormat: () => getDateFormat
|
|
45
46
|
});
|
|
46
47
|
module.exports = __toCommonJS(src_exports);
|
|
47
|
-
var import_mongoose16 = __toESM(require("mongoose"), 1);
|
|
48
48
|
|
|
49
49
|
// src/util/index.ts
|
|
50
50
|
function getDate(dateStr) {
|
|
@@ -311,17 +311,22 @@ var SubscriptionType = (0, import_mongoose15.model)(
|
|
|
311
311
|
);
|
|
312
312
|
var SubscriptionTypeModel_default = SubscriptionType;
|
|
313
313
|
|
|
314
|
-
// src/
|
|
315
|
-
import_mongoose16
|
|
314
|
+
// src/client/MongooseClient.ts
|
|
315
|
+
var import_mongoose16 = __toESM(require("mongoose"), 1);
|
|
316
|
+
var Connect = () => import_mongoose16.default.connect(
|
|
316
317
|
"mongodb+srv://admin:YF6ImNWyAMUUu72I@nftcluster.llzxp.mongodb.net/test?authSource=admin&replicaSet=atlas-p5dddq-shard-0&readPreference=primary&ssl=true",
|
|
317
318
|
{ dbName: "notihub" }
|
|
318
|
-
).then(() =>
|
|
319
|
+
).then(() => {
|
|
320
|
+
console.log("Database Connected!");
|
|
321
|
+
}).catch((err) => {
|
|
319
322
|
console.error(`Error Connecting to the Database: ${err}`);
|
|
320
323
|
});
|
|
324
|
+
var MongooseClient_default = Connect;
|
|
321
325
|
// Annotate the CommonJS export names for ESM import in node:
|
|
322
326
|
0 && (module.exports = {
|
|
323
327
|
Customer,
|
|
324
328
|
CustomerMinified,
|
|
329
|
+
MongooseClient,
|
|
325
330
|
NotiHubStatsHistory,
|
|
326
331
|
NotiTypeModel,
|
|
327
332
|
NotificationModel,
|
package/dist/index.d.cts
CHANGED
|
@@ -205,4 +205,6 @@ declare const SubscriptionType: mongoose.Model<IUserSubscribeNotifier, {}, {}, {
|
|
|
205
205
|
__v?: number | undefined;
|
|
206
206
|
}, any>;
|
|
207
207
|
|
|
208
|
-
|
|
208
|
+
declare const Connect: () => Promise<void>;
|
|
209
|
+
|
|
210
|
+
export { type CreateNotiRequestBody, type CreateSubscriptionRequestBody, type CreateUserRequestBody, Customer, CustomerMinified, type ICreateCustomerRequestBody, type ICreateNotiRequestBody, type INotiHubCustomer, type INotiHubCustomerMinified, type INotiHubImage, type INotiHubNotification, type INotiHubNotificationStats, type INotiHubStats, type INotiHubStatsHistory, type INotiHubSubscription, type INotiHubUser, type INotiHubUserView, type INotiType, type INotiTypeStats, type IUserSubscribeNotifier, type IUserSubscription, Connect as MongooseClient, NotiHubStatsHistory, type NotiHubTypes, NotiTypeModel, NotificationModel, NotificationStatsModel, Subscription, SubscriptionType, UserModel, addMonths, getDate, getDateFormat };
|
package/dist/index.d.ts
CHANGED
|
@@ -205,4 +205,6 @@ declare const SubscriptionType: mongoose.Model<IUserSubscribeNotifier, {}, {}, {
|
|
|
205
205
|
__v?: number | undefined;
|
|
206
206
|
}, any>;
|
|
207
207
|
|
|
208
|
-
|
|
208
|
+
declare const Connect: () => Promise<void>;
|
|
209
|
+
|
|
210
|
+
export { type CreateNotiRequestBody, type CreateSubscriptionRequestBody, type CreateUserRequestBody, Customer, CustomerMinified, type ICreateCustomerRequestBody, type ICreateNotiRequestBody, type INotiHubCustomer, type INotiHubCustomerMinified, type INotiHubImage, type INotiHubNotification, type INotiHubNotificationStats, type INotiHubStats, type INotiHubStatsHistory, type INotiHubSubscription, type INotiHubUser, type INotiHubUserView, type INotiType, type INotiTypeStats, type IUserSubscribeNotifier, type IUserSubscription, Connect as MongooseClient, NotiHubStatsHistory, type NotiHubTypes, NotiTypeModel, NotificationModel, NotificationStatsModel, Subscription, SubscriptionType, UserModel, addMonths, getDate, getDateFormat };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
// src/index.ts
|
|
2
|
-
import mongoose3 from "mongoose";
|
|
3
|
-
|
|
4
1
|
// src/util/index.ts
|
|
5
2
|
function getDate(dateStr) {
|
|
6
3
|
const date = new Date(dateStr);
|
|
@@ -19,7 +16,7 @@ function getDateFormat(dateStr) {
|
|
|
19
16
|
return date.toLocaleDateString("en-US", {
|
|
20
17
|
year: "numeric",
|
|
21
18
|
month: "short",
|
|
22
|
-
day: "numeric"
|
|
19
|
+
day: "numeric",
|
|
23
20
|
});
|
|
24
21
|
}
|
|
25
22
|
interval = seconds / 2592e3;
|
|
@@ -27,7 +24,7 @@ function getDateFormat(dateStr) {
|
|
|
27
24
|
return date.toLocaleDateString("en-US", {
|
|
28
25
|
year: "numeric",
|
|
29
26
|
month: "short",
|
|
30
|
-
day: "numeric"
|
|
27
|
+
day: "numeric",
|
|
31
28
|
});
|
|
32
29
|
}
|
|
33
30
|
interval = seconds / 86400;
|
|
@@ -35,7 +32,7 @@ function getDateFormat(dateStr) {
|
|
|
35
32
|
return date.toLocaleDateString("en-US", {
|
|
36
33
|
year: "numeric",
|
|
37
34
|
month: "short",
|
|
38
|
-
day: "numeric"
|
|
35
|
+
day: "numeric",
|
|
39
36
|
});
|
|
40
37
|
} else if (interval > 1) {
|
|
41
38
|
return Math.floor(interval) + "d ago";
|
|
@@ -65,7 +62,7 @@ var UserSchema = {
|
|
|
65
62
|
name: { type: String, required: true },
|
|
66
63
|
email: { type: String, required: true },
|
|
67
64
|
pushToken: { type: String, required: true },
|
|
68
|
-
signedIn: { type: Boolean, required: true, default: false }
|
|
65
|
+
signedIn: { type: Boolean, required: true, default: false },
|
|
69
66
|
};
|
|
70
67
|
var UserSchema_default = UserSchema;
|
|
71
68
|
|
|
@@ -87,9 +84,9 @@ var CustomerMinifiedSchema = {
|
|
|
87
84
|
username: { type: String, required: true },
|
|
88
85
|
img: {
|
|
89
86
|
bucket: { type: String, required: true },
|
|
90
|
-
key: { type: String, required: true }
|
|
87
|
+
key: { type: String, required: true },
|
|
91
88
|
},
|
|
92
|
-
name: { type: String, required: true }
|
|
89
|
+
name: { type: String, required: true },
|
|
93
90
|
};
|
|
94
91
|
var CustomerMinifiedSchema_default = CustomerMinifiedSchema;
|
|
95
92
|
|
|
@@ -100,7 +97,7 @@ var CustomerSchema = {
|
|
|
100
97
|
paid: { type: Boolean, default: false },
|
|
101
98
|
email: { type: String, required: true },
|
|
102
99
|
verified: { type: Boolean, default: false },
|
|
103
|
-
confirmed: { type: Boolean, default: false }
|
|
100
|
+
confirmed: { type: Boolean, default: false },
|
|
104
101
|
};
|
|
105
102
|
var CustomerSchema_default = CustomerSchema;
|
|
106
103
|
|
|
@@ -109,21 +106,15 @@ var SubscriptionSchema = {
|
|
|
109
106
|
id: { type: Schema4.Types.UUID, default: true },
|
|
110
107
|
subscriptionId: { type: String, required: true },
|
|
111
108
|
user: UserSchema_default,
|
|
112
|
-
entity: CustomerSchema_default
|
|
109
|
+
entity: CustomerSchema_default,
|
|
113
110
|
};
|
|
114
111
|
var SubscriptionSchema_default = SubscriptionSchema;
|
|
115
112
|
|
|
116
113
|
// src/models/SubscriptionModel.ts
|
|
117
|
-
var subscriptionSchema = new Schema5(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
);
|
|
123
|
-
var Subscription = model3(
|
|
124
|
-
"Subscriptions",
|
|
125
|
-
subscriptionSchema
|
|
126
|
-
);
|
|
114
|
+
var subscriptionSchema = new Schema5(SubscriptionSchema_default, {
|
|
115
|
+
timestamps: true,
|
|
116
|
+
});
|
|
117
|
+
var Subscription = model3("Subscriptions", subscriptionSchema);
|
|
127
118
|
var SubscriptionModel_default = Subscription;
|
|
128
119
|
|
|
129
120
|
// src/models/NotiTypeModel.ts
|
|
@@ -134,13 +125,13 @@ import { Schema as Schema6 } from "mongoose";
|
|
|
134
125
|
var NotiTypeSchema = {
|
|
135
126
|
id: { type: Schema6.Types.UUID, default: true },
|
|
136
127
|
entity: CustomerSchema_default,
|
|
137
|
-
type: { type: String, required: true }
|
|
128
|
+
type: { type: String, required: true },
|
|
138
129
|
};
|
|
139
130
|
var NotiTypeSchema_default = NotiTypeSchema;
|
|
140
131
|
|
|
141
132
|
// src/models/NotiTypeModel.ts
|
|
142
133
|
var notiTypeSchema = new Schema7(NotiTypeSchema_default, {
|
|
143
|
-
timestamps: true
|
|
134
|
+
timestamps: true,
|
|
144
135
|
});
|
|
145
136
|
var NotiTypeModel = model4("NotiTypes", notiTypeSchema);
|
|
146
137
|
var NotiTypeModel_default = NotiTypeModel;
|
|
@@ -156,7 +147,7 @@ var NotihubStatsHistorySchema = {
|
|
|
156
147
|
notifications: { type: Number, required: true },
|
|
157
148
|
subscription: { type: Number, required: true },
|
|
158
149
|
views: { type: Number, required: true },
|
|
159
|
-
type: { type: String, required: true }
|
|
150
|
+
type: { type: String, required: true },
|
|
160
151
|
};
|
|
161
152
|
var NotificationStatsHistorySchema_default = NotihubStatsHistorySchema;
|
|
162
153
|
|
|
@@ -164,7 +155,7 @@ var NotificationStatsHistorySchema_default = NotihubStatsHistorySchema;
|
|
|
164
155
|
var notihubStatsHistorySchema = new Schema9(
|
|
165
156
|
NotificationStatsHistorySchema_default,
|
|
166
157
|
{
|
|
167
|
-
timestamps: true
|
|
158
|
+
timestamps: true,
|
|
168
159
|
}
|
|
169
160
|
);
|
|
170
161
|
var NotiHubStatsHistory = model5(
|
|
@@ -185,7 +176,7 @@ var NotificationSchema = {
|
|
|
185
176
|
type: { type: String, required: true },
|
|
186
177
|
body: { type: String },
|
|
187
178
|
entityId: { type: String, required: true },
|
|
188
|
-
entityMinified: CustomerMinifiedSchema_default
|
|
179
|
+
entityMinified: CustomerMinifiedSchema_default,
|
|
189
180
|
};
|
|
190
181
|
var NotificationSchema_default = NotificationSchema;
|
|
191
182
|
|
|
@@ -193,14 +184,11 @@ var NotificationSchema_default = NotificationSchema;
|
|
|
193
184
|
var notificationSchema = new Schema11(
|
|
194
185
|
{
|
|
195
186
|
notification: NotificationSchema_default,
|
|
196
|
-
views: { type: Number, default: 0 }
|
|
187
|
+
views: { type: Number, default: 0 },
|
|
197
188
|
},
|
|
198
189
|
{ timestamps: true }
|
|
199
190
|
);
|
|
200
|
-
var NotificationStatsModel = model6(
|
|
201
|
-
"NotificationStats",
|
|
202
|
-
notificationSchema
|
|
203
|
-
);
|
|
191
|
+
var NotificationStatsModel = model6("NotificationStats", notificationSchema);
|
|
204
192
|
var NotificationStatsModel_default = NotificationStatsModel;
|
|
205
193
|
|
|
206
194
|
// src/models/NotificationModel.ts
|
|
@@ -212,34 +200,27 @@ var notificationSchema2 = new Schema12(
|
|
|
212
200
|
type: { type: String, required: true },
|
|
213
201
|
body: { type: String },
|
|
214
202
|
entityId: { type: String, required: true },
|
|
215
|
-
entityMinified: CustomerSchema_default
|
|
203
|
+
entityMinified: CustomerSchema_default,
|
|
216
204
|
},
|
|
217
205
|
{ timestamps: true }
|
|
218
206
|
);
|
|
219
|
-
var NotificationModel = model7(
|
|
220
|
-
"Notification",
|
|
221
|
-
notificationSchema2
|
|
222
|
-
);
|
|
207
|
+
var NotificationModel = model7("Notification", notificationSchema2);
|
|
223
208
|
var NotificationModel_default = NotificationModel;
|
|
224
209
|
|
|
225
210
|
// src/models/CustomerModel.ts
|
|
226
211
|
import { Schema as Schema13, model as model8 } from "mongoose";
|
|
227
212
|
var customerSchema = new Schema13(CustomerSchema_default, {
|
|
228
|
-
timestamps: true
|
|
213
|
+
timestamps: true,
|
|
229
214
|
});
|
|
230
215
|
var Customer = model8("Customer", customerSchema);
|
|
231
216
|
var CustomerModel_default = Customer;
|
|
232
217
|
|
|
233
218
|
// src/models/CustomerMinifiedModel.ts
|
|
234
219
|
import { Schema as Schema14, model as model9 } from "mongoose";
|
|
235
|
-
var customerMinifiedSchema = new Schema14(
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
);
|
|
239
|
-
var CustomerMinified = model9(
|
|
240
|
-
"CustomerMinified",
|
|
241
|
-
customerMinifiedSchema
|
|
242
|
-
);
|
|
220
|
+
var customerMinifiedSchema = new Schema14(CustomerMinifiedSchema_default, {
|
|
221
|
+
timestamps: true,
|
|
222
|
+
});
|
|
223
|
+
var CustomerMinified = model9("CustomerMinified", customerMinifiedSchema);
|
|
243
224
|
var CustomerMinifiedModel_default = CustomerMinified;
|
|
244
225
|
|
|
245
226
|
// src/models/SubscriptionTypeModel.ts
|
|
@@ -249,33 +230,36 @@ import { Schema as Schema15, model as model10 } from "mongoose";
|
|
|
249
230
|
var SubscriptionSchema2 = {
|
|
250
231
|
userId: { type: String, required: true },
|
|
251
232
|
entityId: { type: String, required: true },
|
|
252
|
-
notiTypeId: { type: String, required: true }
|
|
233
|
+
notiTypeId: { type: String, required: true },
|
|
253
234
|
};
|
|
254
235
|
var SubscriptionTypeSchema_default = SubscriptionSchema2;
|
|
255
236
|
|
|
256
237
|
// src/models/SubscriptionTypeModel.ts
|
|
257
|
-
var subscriptionSchema2 = new Schema15(
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
262
|
-
);
|
|
263
|
-
var SubscriptionType = model10(
|
|
264
|
-
"SubscriptionTypes",
|
|
265
|
-
subscriptionSchema2
|
|
266
|
-
);
|
|
238
|
+
var subscriptionSchema2 = new Schema15(SubscriptionTypeSchema_default, {
|
|
239
|
+
timestamps: true,
|
|
240
|
+
});
|
|
241
|
+
var SubscriptionType = model10("SubscriptionTypes", subscriptionSchema2);
|
|
267
242
|
var SubscriptionTypeModel_default = SubscriptionType;
|
|
268
243
|
|
|
269
|
-
// src/
|
|
270
|
-
mongoose3
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
244
|
+
// src/client/MongooseClient.ts
|
|
245
|
+
import mongoose3 from "mongoose";
|
|
246
|
+
var Connect = () =>
|
|
247
|
+
mongoose3
|
|
248
|
+
.connect(
|
|
249
|
+
"mongodb+srv://admin:YF6ImNWyAMUUu72I@nftcluster.llzxp.mongodb.net/test?authSource=admin&replicaSet=atlas-p5dddq-shard-0&readPreference=primary&ssl=true",
|
|
250
|
+
{ dbName: "notihub" }
|
|
251
|
+
)
|
|
252
|
+
.then(() => {
|
|
253
|
+
console.log("Database Connected!");
|
|
254
|
+
})
|
|
255
|
+
.catch((err) => {
|
|
256
|
+
console.error(`Error Connecting to the Database: ${err}`);
|
|
257
|
+
});
|
|
258
|
+
var MongooseClient_default = Connect;
|
|
276
259
|
export {
|
|
277
260
|
CustomerModel_default as Customer,
|
|
278
261
|
CustomerMinifiedModel_default as CustomerMinified,
|
|
262
|
+
MongooseClient_default as MongooseClient,
|
|
279
263
|
NotiHubStatsHistoryModel_default as NotiHubStatsHistory,
|
|
280
264
|
NotiTypeModel_default as NotiTypeModel,
|
|
281
265
|
NotificationModel_default as NotificationModel,
|
|
@@ -285,5 +269,5 @@ export {
|
|
|
285
269
|
UserModel_default as UserModel,
|
|
286
270
|
addMonths,
|
|
287
271
|
getDate,
|
|
288
|
-
getDateFormat
|
|
272
|
+
getDateFormat,
|
|
289
273
|
};
|