@amohamud23/notihub 1.0.82 → 1.0.84
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 +316 -0
- package/dist/index.d.cts +208 -0
- package/dist/index.js +24 -27
- package/package.json +3 -3
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
Customer: () => CustomerModel_default,
|
|
24
|
+
CustomerMinified: () => CustomerMinifiedModel_default,
|
|
25
|
+
NotiHubStatsHistory: () => NotiHubStatsHistoryModel_default,
|
|
26
|
+
NotiTypeModel: () => NotiTypeModel_default,
|
|
27
|
+
NotificationModel: () => NotificationModel_default,
|
|
28
|
+
NotificationStatsModel: () => NotificationStatsModel_default,
|
|
29
|
+
Subscription: () => SubscriptionModel_default,
|
|
30
|
+
SubscriptionType: () => SubscriptionTypeModel_default,
|
|
31
|
+
UserModel: () => UserModel_default,
|
|
32
|
+
addMonths: () => addMonths,
|
|
33
|
+
getDate: () => getDate,
|
|
34
|
+
getDateFormat: () => getDateFormat
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(src_exports);
|
|
37
|
+
|
|
38
|
+
// src/util/index.ts
|
|
39
|
+
function getDate(dateStr) {
|
|
40
|
+
const date = new Date(dateStr);
|
|
41
|
+
const year = date.getFullYear();
|
|
42
|
+
const month = (date.getMonth() + 1).toString().padStart(2, "0");
|
|
43
|
+
const day = date.getDate().toString().padStart(2, "0");
|
|
44
|
+
const formattedDate = `${month}-${day}-${year}`;
|
|
45
|
+
return formattedDate;
|
|
46
|
+
}
|
|
47
|
+
function getDateFormat(dateStr) {
|
|
48
|
+
const date = new Date(dateStr);
|
|
49
|
+
const now = /* @__PURE__ */ new Date();
|
|
50
|
+
const seconds = Math.floor((now.getTime() - date.getTime()) / 1e3);
|
|
51
|
+
let interval = seconds / 31536e3;
|
|
52
|
+
if (interval > 1) {
|
|
53
|
+
return date.toLocaleDateString("en-US", {
|
|
54
|
+
year: "numeric",
|
|
55
|
+
month: "short",
|
|
56
|
+
day: "numeric"
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
interval = seconds / 2592e3;
|
|
60
|
+
if (interval > 1) {
|
|
61
|
+
return date.toLocaleDateString("en-US", {
|
|
62
|
+
year: "numeric",
|
|
63
|
+
month: "short",
|
|
64
|
+
day: "numeric"
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
interval = seconds / 86400;
|
|
68
|
+
if (interval > 7) {
|
|
69
|
+
return date.toLocaleDateString("en-US", {
|
|
70
|
+
year: "numeric",
|
|
71
|
+
month: "short",
|
|
72
|
+
day: "numeric"
|
|
73
|
+
});
|
|
74
|
+
} else if (interval > 1) {
|
|
75
|
+
return Math.floor(interval) + "d ago";
|
|
76
|
+
}
|
|
77
|
+
interval = seconds / 3600;
|
|
78
|
+
if (interval > 1) {
|
|
79
|
+
return Math.floor(interval) + "h ago";
|
|
80
|
+
}
|
|
81
|
+
interval = seconds / 60;
|
|
82
|
+
if (interval > 1) {
|
|
83
|
+
return Math.floor(interval) + "m ago";
|
|
84
|
+
}
|
|
85
|
+
return Math.floor(seconds) + "s ago";
|
|
86
|
+
}
|
|
87
|
+
function addMonths({ date, months }) {
|
|
88
|
+
date.setMonth(date.getMonth() + months);
|
|
89
|
+
return date;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// src/models/UserModel.ts
|
|
93
|
+
var import_mongoose2 = require("mongoose");
|
|
94
|
+
|
|
95
|
+
// src/models/schemas/UserSchema.ts
|
|
96
|
+
var import_mongoose = require("mongoose");
|
|
97
|
+
var UserSchema = {
|
|
98
|
+
id: { type: import_mongoose.Schema.Types.UUID, default: true },
|
|
99
|
+
name: { type: String, required: true },
|
|
100
|
+
email: { type: String, required: true },
|
|
101
|
+
pushToken: { type: String, required: true },
|
|
102
|
+
signedIn: { type: Boolean, required: true, default: false }
|
|
103
|
+
};
|
|
104
|
+
var UserSchema_default = UserSchema;
|
|
105
|
+
|
|
106
|
+
// src/models/UserModel.ts
|
|
107
|
+
var userSchema = new import_mongoose2.Schema(UserSchema_default, { timestamps: true });
|
|
108
|
+
var UserModel = (0, import_mongoose2.model)("User", userSchema);
|
|
109
|
+
var UserModel_default = UserModel;
|
|
110
|
+
|
|
111
|
+
// src/models/SubscriptionModel.ts
|
|
112
|
+
var import_mongoose5 = require("mongoose");
|
|
113
|
+
|
|
114
|
+
// src/models/schemas/SubscriptionSchema.ts
|
|
115
|
+
var import_mongoose4 = require("mongoose");
|
|
116
|
+
|
|
117
|
+
// src/models/schemas/CustomerMinifiedSchema.ts
|
|
118
|
+
var import_mongoose3 = require("mongoose");
|
|
119
|
+
var CustomerMinifiedSchema = {
|
|
120
|
+
id: { type: import_mongoose3.Schema.Types.UUID, default: true },
|
|
121
|
+
username: { type: String, required: true },
|
|
122
|
+
img: {
|
|
123
|
+
bucket: { type: String, required: true },
|
|
124
|
+
key: { type: String, required: true }
|
|
125
|
+
},
|
|
126
|
+
name: { type: String, required: true }
|
|
127
|
+
};
|
|
128
|
+
var CustomerMinifiedSchema_default = CustomerMinifiedSchema;
|
|
129
|
+
|
|
130
|
+
// src/models/schemas/CustomerSchema.ts
|
|
131
|
+
var CustomerSchema = {
|
|
132
|
+
// id: { type: Schema.Types.UUID, default: true },
|
|
133
|
+
minified: CustomerMinifiedSchema_default,
|
|
134
|
+
paid: { type: Boolean, default: false },
|
|
135
|
+
email: { type: String, required: true },
|
|
136
|
+
verified: { type: Boolean, default: false },
|
|
137
|
+
confirmed: { type: Boolean, default: false }
|
|
138
|
+
};
|
|
139
|
+
var CustomerSchema_default = CustomerSchema;
|
|
140
|
+
|
|
141
|
+
// src/models/schemas/SubscriptionSchema.ts
|
|
142
|
+
var SubscriptionSchema = {
|
|
143
|
+
id: { type: import_mongoose4.Schema.Types.UUID, default: true },
|
|
144
|
+
subscriptionId: { type: String, required: true },
|
|
145
|
+
user: UserSchema_default,
|
|
146
|
+
entity: CustomerSchema_default
|
|
147
|
+
};
|
|
148
|
+
var SubscriptionSchema_default = SubscriptionSchema;
|
|
149
|
+
|
|
150
|
+
// src/models/SubscriptionModel.ts
|
|
151
|
+
var subscriptionSchema = new import_mongoose5.Schema(
|
|
152
|
+
SubscriptionSchema_default,
|
|
153
|
+
{
|
|
154
|
+
timestamps: true
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
var Subscription = (0, import_mongoose5.model)(
|
|
158
|
+
"Subscriptions",
|
|
159
|
+
subscriptionSchema
|
|
160
|
+
);
|
|
161
|
+
var SubscriptionModel_default = Subscription;
|
|
162
|
+
|
|
163
|
+
// src/models/NotiTypeModel.ts
|
|
164
|
+
var import_mongoose7 = require("mongoose");
|
|
165
|
+
|
|
166
|
+
// src/models/schemas/NotiTypeSchema.ts
|
|
167
|
+
var import_mongoose6 = require("mongoose");
|
|
168
|
+
var NotiTypeSchema = {
|
|
169
|
+
id: { type: import_mongoose6.Schema.Types.UUID, default: true },
|
|
170
|
+
entity: CustomerSchema_default,
|
|
171
|
+
type: { type: String, required: true }
|
|
172
|
+
};
|
|
173
|
+
var NotiTypeSchema_default = NotiTypeSchema;
|
|
174
|
+
|
|
175
|
+
// src/models/NotiTypeModel.ts
|
|
176
|
+
var notiTypeSchema = new import_mongoose7.Schema(NotiTypeSchema_default, {
|
|
177
|
+
timestamps: true
|
|
178
|
+
});
|
|
179
|
+
var NotiTypeModel = (0, import_mongoose7.model)("NotiTypes", notiTypeSchema);
|
|
180
|
+
var NotiTypeModel_default = NotiTypeModel;
|
|
181
|
+
|
|
182
|
+
// src/models/NotiHubStatsHistoryModel.ts
|
|
183
|
+
var import_mongoose9 = require("mongoose");
|
|
184
|
+
|
|
185
|
+
// src/models/schemas/NotificationStatsHistorySchema.ts
|
|
186
|
+
var import_mongoose8 = require("mongoose");
|
|
187
|
+
var NotihubStatsHistorySchema = {
|
|
188
|
+
id: { type: import_mongoose8.Schema.Types.UUID, default: true },
|
|
189
|
+
entityId: { type: String, required: true },
|
|
190
|
+
notifications: { type: Number, required: true },
|
|
191
|
+
subscription: { type: Number, required: true },
|
|
192
|
+
views: { type: Number, required: true },
|
|
193
|
+
type: { type: String, required: true }
|
|
194
|
+
};
|
|
195
|
+
var NotificationStatsHistorySchema_default = NotihubStatsHistorySchema;
|
|
196
|
+
|
|
197
|
+
// src/models/NotiHubStatsHistoryModel.ts
|
|
198
|
+
var notihubStatsHistorySchema = new import_mongoose9.Schema(
|
|
199
|
+
NotificationStatsHistorySchema_default,
|
|
200
|
+
{
|
|
201
|
+
timestamps: true
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
var NotiHubStatsHistory = (0, import_mongoose9.model)(
|
|
205
|
+
"INotiHubStatsHistories",
|
|
206
|
+
notihubStatsHistorySchema
|
|
207
|
+
);
|
|
208
|
+
var NotiHubStatsHistoryModel_default = NotiHubStatsHistory;
|
|
209
|
+
|
|
210
|
+
// src/models/NotificationStatsModel.ts
|
|
211
|
+
var import_mongoose11 = require("mongoose");
|
|
212
|
+
|
|
213
|
+
// src/models/schemas/NotificationSchema.ts
|
|
214
|
+
var import_mongoose10 = require("mongoose");
|
|
215
|
+
var NotificationSchema = {
|
|
216
|
+
id: { type: import_mongoose10.Schema.Types.UUID, default: true },
|
|
217
|
+
title: { type: String, required: true },
|
|
218
|
+
message: { type: String, required: true },
|
|
219
|
+
type: { type: String, required: true },
|
|
220
|
+
body: { type: String },
|
|
221
|
+
entityId: { type: String, required: true },
|
|
222
|
+
entityMinified: CustomerMinifiedSchema_default
|
|
223
|
+
};
|
|
224
|
+
var NotificationSchema_default = NotificationSchema;
|
|
225
|
+
|
|
226
|
+
// src/models/NotificationStatsModel.ts
|
|
227
|
+
var notificationSchema = new import_mongoose11.Schema(
|
|
228
|
+
{
|
|
229
|
+
notification: NotificationSchema_default,
|
|
230
|
+
views: { type: Number, default: 0 }
|
|
231
|
+
},
|
|
232
|
+
{ timestamps: true }
|
|
233
|
+
);
|
|
234
|
+
var NotificationStatsModel = (0, import_mongoose11.model)(
|
|
235
|
+
"NotificationStats",
|
|
236
|
+
notificationSchema
|
|
237
|
+
);
|
|
238
|
+
var NotificationStatsModel_default = NotificationStatsModel;
|
|
239
|
+
|
|
240
|
+
// src/models/NotificationModel.ts
|
|
241
|
+
var import_mongoose12 = require("mongoose");
|
|
242
|
+
var notificationSchema2 = new import_mongoose12.Schema(
|
|
243
|
+
{
|
|
244
|
+
title: { type: String, required: true },
|
|
245
|
+
message: { type: String, required: true },
|
|
246
|
+
type: { type: String, required: true },
|
|
247
|
+
body: { type: String },
|
|
248
|
+
entityId: { type: String, required: true },
|
|
249
|
+
entityMinified: CustomerSchema_default
|
|
250
|
+
},
|
|
251
|
+
{ timestamps: true }
|
|
252
|
+
);
|
|
253
|
+
var NotificationModel = (0, import_mongoose12.model)(
|
|
254
|
+
"Notification",
|
|
255
|
+
notificationSchema2
|
|
256
|
+
);
|
|
257
|
+
var NotificationModel_default = NotificationModel;
|
|
258
|
+
|
|
259
|
+
// src/models/CustomerModel.ts
|
|
260
|
+
var import_mongoose13 = require("mongoose");
|
|
261
|
+
var customerSchema = new import_mongoose13.Schema(CustomerSchema_default, {
|
|
262
|
+
timestamps: true
|
|
263
|
+
});
|
|
264
|
+
var Customer = (0, import_mongoose13.model)("Customer", customerSchema);
|
|
265
|
+
var CustomerModel_default = Customer;
|
|
266
|
+
|
|
267
|
+
// src/models/CustomerMinifiedModel.ts
|
|
268
|
+
var import_mongoose14 = require("mongoose");
|
|
269
|
+
var customerMinifiedSchema = new import_mongoose14.Schema(
|
|
270
|
+
CustomerMinifiedSchema_default,
|
|
271
|
+
{ timestamps: true }
|
|
272
|
+
);
|
|
273
|
+
var CustomerMinified = (0, import_mongoose14.model)(
|
|
274
|
+
"CustomerMinified",
|
|
275
|
+
customerMinifiedSchema
|
|
276
|
+
);
|
|
277
|
+
var CustomerMinifiedModel_default = CustomerMinified;
|
|
278
|
+
|
|
279
|
+
// src/models/SubscriptionTypeModel.ts
|
|
280
|
+
var import_mongoose15 = require("mongoose");
|
|
281
|
+
|
|
282
|
+
// src/models/schemas/SubscriptionTypeSchema.ts
|
|
283
|
+
var SubscriptionSchema2 = {
|
|
284
|
+
userId: { type: String, required: true },
|
|
285
|
+
entityId: { type: String, required: true },
|
|
286
|
+
notiTypeId: { type: String, required: true }
|
|
287
|
+
};
|
|
288
|
+
var SubscriptionTypeSchema_default = SubscriptionSchema2;
|
|
289
|
+
|
|
290
|
+
// src/models/SubscriptionTypeModel.ts
|
|
291
|
+
var subscriptionSchema2 = new import_mongoose15.Schema(
|
|
292
|
+
SubscriptionTypeSchema_default,
|
|
293
|
+
{
|
|
294
|
+
timestamps: true
|
|
295
|
+
}
|
|
296
|
+
);
|
|
297
|
+
var SubscriptionType = (0, import_mongoose15.model)(
|
|
298
|
+
"SubscriptionTypes",
|
|
299
|
+
subscriptionSchema2
|
|
300
|
+
);
|
|
301
|
+
var SubscriptionTypeModel_default = SubscriptionType;
|
|
302
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
303
|
+
0 && (module.exports = {
|
|
304
|
+
Customer,
|
|
305
|
+
CustomerMinified,
|
|
306
|
+
NotiHubStatsHistory,
|
|
307
|
+
NotiTypeModel,
|
|
308
|
+
NotificationModel,
|
|
309
|
+
NotificationStatsModel,
|
|
310
|
+
Subscription,
|
|
311
|
+
SubscriptionType,
|
|
312
|
+
UserModel,
|
|
313
|
+
addMonths,
|
|
314
|
+
getDate,
|
|
315
|
+
getDateFormat
|
|
316
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import * as mongoose from 'mongoose';
|
|
2
|
+
import mongoose__default from 'mongoose';
|
|
3
|
+
|
|
4
|
+
type CreateNotiRequestBody = {
|
|
5
|
+
subscriptionId: string;
|
|
6
|
+
userId: string;
|
|
7
|
+
title: string;
|
|
8
|
+
message: string;
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
type CreateSubscriptionRequestBody = {
|
|
12
|
+
subscriptionId: string;
|
|
13
|
+
type: string;
|
|
14
|
+
};
|
|
15
|
+
type CreateUserRequestBody = {
|
|
16
|
+
name: string;
|
|
17
|
+
email: string;
|
|
18
|
+
token: string;
|
|
19
|
+
};
|
|
20
|
+
type ICreateCustomerRequestBody = {
|
|
21
|
+
email: string;
|
|
22
|
+
username: string;
|
|
23
|
+
name: string;
|
|
24
|
+
};
|
|
25
|
+
type ICreateNotiRequestBody = {};
|
|
26
|
+
type INotiHubCustomerMinified = {
|
|
27
|
+
_id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
img: INotiHubImage;
|
|
30
|
+
username: string;
|
|
31
|
+
createdAt: string;
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
};
|
|
34
|
+
type INotiHubCustomer = {
|
|
35
|
+
_id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
email: string;
|
|
38
|
+
minified: INotiHubCustomerMinified;
|
|
39
|
+
verified: boolean;
|
|
40
|
+
paid: boolean;
|
|
41
|
+
confirmed: boolean;
|
|
42
|
+
createdAt: string;
|
|
43
|
+
updatedAt: string;
|
|
44
|
+
};
|
|
45
|
+
type INotiHubNotification = {
|
|
46
|
+
_id?: string;
|
|
47
|
+
title: string;
|
|
48
|
+
message: string;
|
|
49
|
+
type: string;
|
|
50
|
+
entityId: string;
|
|
51
|
+
entityMinified: INotiHubCustomerMinified;
|
|
52
|
+
body: string;
|
|
53
|
+
createdAt: string;
|
|
54
|
+
updatedAt: string;
|
|
55
|
+
};
|
|
56
|
+
type INotiHubNotificationStats = {
|
|
57
|
+
_id?: string;
|
|
58
|
+
notification: INotiHubNotification;
|
|
59
|
+
views: number;
|
|
60
|
+
};
|
|
61
|
+
type INotiHubUser = {
|
|
62
|
+
_id?: string;
|
|
63
|
+
pushToken: string;
|
|
64
|
+
name: string;
|
|
65
|
+
email: string;
|
|
66
|
+
subscriptions: number;
|
|
67
|
+
events: number;
|
|
68
|
+
};
|
|
69
|
+
type INotiHubImage = {
|
|
70
|
+
bucket: string;
|
|
71
|
+
key: string;
|
|
72
|
+
};
|
|
73
|
+
type INotiHubStats = {
|
|
74
|
+
entityRef: string;
|
|
75
|
+
entity: INotiHubCustomer;
|
|
76
|
+
subscription: number;
|
|
77
|
+
notifications: number;
|
|
78
|
+
views: number;
|
|
79
|
+
};
|
|
80
|
+
type INotiHubStatsHistory = {
|
|
81
|
+
entityId: string;
|
|
82
|
+
type: "MONTH" | "YEAR";
|
|
83
|
+
subscription: number;
|
|
84
|
+
notifications: number;
|
|
85
|
+
views: number;
|
|
86
|
+
};
|
|
87
|
+
type INotiType = {
|
|
88
|
+
_id?: string;
|
|
89
|
+
type: string;
|
|
90
|
+
entity: string;
|
|
91
|
+
createdAt: string;
|
|
92
|
+
updatedAt: string;
|
|
93
|
+
};
|
|
94
|
+
type INotiTypeStats = {
|
|
95
|
+
_id?: string;
|
|
96
|
+
notiTypeId: string;
|
|
97
|
+
subscribed: number;
|
|
98
|
+
createdAt: string;
|
|
99
|
+
};
|
|
100
|
+
type IUserSubscription = {
|
|
101
|
+
user: INotiHubUser;
|
|
102
|
+
entity: INotiHubCustomer;
|
|
103
|
+
subscriptionId: string;
|
|
104
|
+
type: "SUBSCRIBED" | "UNSUBSCRIBED";
|
|
105
|
+
createdAt: string;
|
|
106
|
+
updatedAt: string;
|
|
107
|
+
};
|
|
108
|
+
type IUserSubscribeNotifier = {
|
|
109
|
+
userId: string;
|
|
110
|
+
entityId: string;
|
|
111
|
+
notiTypeId: string;
|
|
112
|
+
createdAt: string;
|
|
113
|
+
updatedAt: string;
|
|
114
|
+
};
|
|
115
|
+
type INotiHubUserView = {
|
|
116
|
+
userId: string;
|
|
117
|
+
entityId: string;
|
|
118
|
+
notificationId: string;
|
|
119
|
+
createdAt: string;
|
|
120
|
+
};
|
|
121
|
+
type INotiHubSubscription = {
|
|
122
|
+
_id?: string;
|
|
123
|
+
subscriptionId: string;
|
|
124
|
+
entity: INotiHubCustomer;
|
|
125
|
+
user: INotiHubUser;
|
|
126
|
+
type: "SUBSCRIBED" | "UNSUBSCRIBED";
|
|
127
|
+
createdAt: string;
|
|
128
|
+
updatedAt: string;
|
|
129
|
+
};
|
|
130
|
+
type NotiHubTypes = {
|
|
131
|
+
INotiHubUserView: INotiHubUserView;
|
|
132
|
+
IUserSubscribeNotifier: IUserSubscribeNotifier;
|
|
133
|
+
IUserSubscription: IUserSubscription;
|
|
134
|
+
INotiHubUser: INotiHubUser;
|
|
135
|
+
INotiTypeStats: INotiTypeStats;
|
|
136
|
+
INotiHubImage: INotiHubImage;
|
|
137
|
+
INotiHubSubscription: INotiHubSubscription;
|
|
138
|
+
INotiHubNotificationStats: INotiHubNotificationStats;
|
|
139
|
+
INotiHubNotification: INotiHubNotification;
|
|
140
|
+
INotiHubCustomer: INotiHubCustomer;
|
|
141
|
+
INotiHubCustomerMinified: INotiHubCustomerMinified;
|
|
142
|
+
INotiHubStatsHistory: INotiHubStatsHistory;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
type AddMonths = {
|
|
146
|
+
date: Date;
|
|
147
|
+
months: number;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
declare function getDate(dateStr: string): string;
|
|
151
|
+
declare function getDateFormat(dateStr: string): string;
|
|
152
|
+
declare function addMonths({ date, months }: AddMonths): Date;
|
|
153
|
+
|
|
154
|
+
declare const UserModel: mongoose.Model<INotiHubUser, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubUser> & INotiHubUser & Required<{
|
|
155
|
+
_id: string;
|
|
156
|
+
}> & {
|
|
157
|
+
__v?: number | undefined;
|
|
158
|
+
}, any>;
|
|
159
|
+
|
|
160
|
+
declare const Subscription: mongoose__default.Model<INotiHubSubscription, {}, {}, {}, mongoose__default.Document<unknown, {}, INotiHubSubscription> & INotiHubSubscription & Required<{
|
|
161
|
+
_id: string;
|
|
162
|
+
}> & {
|
|
163
|
+
__v?: number | undefined;
|
|
164
|
+
}, any>;
|
|
165
|
+
|
|
166
|
+
declare const NotiTypeModel: mongoose.Model<INotiType, {}, {}, {}, mongoose.Document<unknown, {}, INotiType> & INotiType & Required<{
|
|
167
|
+
_id: string;
|
|
168
|
+
}> & {
|
|
169
|
+
__v?: number | undefined;
|
|
170
|
+
}, any>;
|
|
171
|
+
|
|
172
|
+
declare const NotiHubStatsHistory: mongoose.Model<INotiHubStatsHistory, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubStatsHistory> & INotiHubStatsHistory & {
|
|
173
|
+
_id: mongoose.Types.ObjectId;
|
|
174
|
+
} & {
|
|
175
|
+
__v?: number | undefined;
|
|
176
|
+
}, any>;
|
|
177
|
+
|
|
178
|
+
declare const NotificationStatsModel: mongoose.Model<INotiHubNotificationStats, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubNotificationStats> & INotiHubNotificationStats & Required<{
|
|
179
|
+
_id: string;
|
|
180
|
+
}> & {
|
|
181
|
+
__v?: number | undefined;
|
|
182
|
+
}, any>;
|
|
183
|
+
|
|
184
|
+
declare const NotificationModel: mongoose.Model<INotiHubNotification, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubNotification> & INotiHubNotification & Required<{
|
|
185
|
+
_id: string;
|
|
186
|
+
}> & {
|
|
187
|
+
__v?: number | undefined;
|
|
188
|
+
}, any>;
|
|
189
|
+
|
|
190
|
+
declare const Customer: mongoose.Model<INotiHubCustomer, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubCustomer> & INotiHubCustomer & Required<{
|
|
191
|
+
_id: string;
|
|
192
|
+
}> & {
|
|
193
|
+
__v?: number | undefined;
|
|
194
|
+
}, any>;
|
|
195
|
+
|
|
196
|
+
declare const CustomerMinified: mongoose.Model<INotiHubCustomerMinified, {}, {}, {}, mongoose.Document<unknown, {}, INotiHubCustomerMinified> & INotiHubCustomerMinified & Required<{
|
|
197
|
+
_id: string;
|
|
198
|
+
}> & {
|
|
199
|
+
__v?: number | undefined;
|
|
200
|
+
}, any>;
|
|
201
|
+
|
|
202
|
+
declare const SubscriptionType: mongoose.Model<IUserSubscribeNotifier, {}, {}, {}, mongoose.Document<unknown, {}, IUserSubscribeNotifier> & IUserSubscribeNotifier & {
|
|
203
|
+
_id: mongoose.Types.ObjectId;
|
|
204
|
+
} & {
|
|
205
|
+
__v?: number | undefined;
|
|
206
|
+
}, any>;
|
|
207
|
+
|
|
208
|
+
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, NotiHubStatsHistory, type NotiHubTypes, NotiTypeModel, NotificationModel, NotificationStatsModel, Subscription, SubscriptionType, UserModel, addMonths, getDate, getDateFormat };
|
package/dist/index.js
CHANGED
|
@@ -72,12 +72,9 @@ var UserModel = model("User", userSchema);
|
|
|
72
72
|
var UserModel_default = UserModel;
|
|
73
73
|
|
|
74
74
|
// src/models/SubscriptionModel.ts
|
|
75
|
-
import { Schema as
|
|
75
|
+
import { Schema as Schema5, model as model3 } from "mongoose";
|
|
76
76
|
|
|
77
77
|
// src/models/schemas/SubscriptionSchema.ts
|
|
78
|
-
import { Schema as Schema5 } from "mongoose";
|
|
79
|
-
|
|
80
|
-
// src/models/schemas/CustomerSchema.ts
|
|
81
78
|
import { Schema as Schema4 } from "mongoose";
|
|
82
79
|
|
|
83
80
|
// src/models/schemas/CustomerMinifiedSchema.ts
|
|
@@ -95,7 +92,7 @@ var CustomerMinifiedSchema_default = CustomerMinifiedSchema;
|
|
|
95
92
|
|
|
96
93
|
// src/models/schemas/CustomerSchema.ts
|
|
97
94
|
var CustomerSchema = {
|
|
98
|
-
id: { type:
|
|
95
|
+
// id: { type: Schema.Types.UUID, default: true },
|
|
99
96
|
minified: CustomerMinifiedSchema_default,
|
|
100
97
|
paid: { type: Boolean, default: false },
|
|
101
98
|
email: { type: String, required: true },
|
|
@@ -106,7 +103,7 @@ var CustomerSchema_default = CustomerSchema;
|
|
|
106
103
|
|
|
107
104
|
// src/models/schemas/SubscriptionSchema.ts
|
|
108
105
|
var SubscriptionSchema = {
|
|
109
|
-
id: { type:
|
|
106
|
+
id: { type: Schema4.Types.UUID, default: true },
|
|
110
107
|
subscriptionId: { type: String, required: true },
|
|
111
108
|
user: UserSchema_default,
|
|
112
109
|
entity: CustomerSchema_default
|
|
@@ -114,7 +111,7 @@ var SubscriptionSchema = {
|
|
|
114
111
|
var SubscriptionSchema_default = SubscriptionSchema;
|
|
115
112
|
|
|
116
113
|
// src/models/SubscriptionModel.ts
|
|
117
|
-
var subscriptionSchema = new
|
|
114
|
+
var subscriptionSchema = new Schema5(
|
|
118
115
|
SubscriptionSchema_default,
|
|
119
116
|
{
|
|
120
117
|
timestamps: true
|
|
@@ -127,31 +124,31 @@ var Subscription = model3(
|
|
|
127
124
|
var SubscriptionModel_default = Subscription;
|
|
128
125
|
|
|
129
126
|
// src/models/NotiTypeModel.ts
|
|
130
|
-
import { Schema as
|
|
127
|
+
import { Schema as Schema7, model as model4 } from "mongoose";
|
|
131
128
|
|
|
132
129
|
// src/models/schemas/NotiTypeSchema.ts
|
|
133
|
-
import { Schema as
|
|
130
|
+
import { Schema as Schema6 } from "mongoose";
|
|
134
131
|
var NotiTypeSchema = {
|
|
135
|
-
id: { type:
|
|
132
|
+
id: { type: Schema6.Types.UUID, default: true },
|
|
136
133
|
entity: CustomerSchema_default,
|
|
137
134
|
type: { type: String, required: true }
|
|
138
135
|
};
|
|
139
136
|
var NotiTypeSchema_default = NotiTypeSchema;
|
|
140
137
|
|
|
141
138
|
// src/models/NotiTypeModel.ts
|
|
142
|
-
var notiTypeSchema = new
|
|
139
|
+
var notiTypeSchema = new Schema7(NotiTypeSchema_default, {
|
|
143
140
|
timestamps: true
|
|
144
141
|
});
|
|
145
142
|
var NotiTypeModel = model4("NotiTypes", notiTypeSchema);
|
|
146
143
|
var NotiTypeModel_default = NotiTypeModel;
|
|
147
144
|
|
|
148
145
|
// src/models/NotiHubStatsHistoryModel.ts
|
|
149
|
-
import { Schema as
|
|
146
|
+
import { Schema as Schema9, model as model5 } from "mongoose";
|
|
150
147
|
|
|
151
148
|
// src/models/schemas/NotificationStatsHistorySchema.ts
|
|
152
|
-
import { Schema as
|
|
149
|
+
import { Schema as Schema8 } from "mongoose";
|
|
153
150
|
var NotihubStatsHistorySchema = {
|
|
154
|
-
id: { type:
|
|
151
|
+
id: { type: Schema8.Types.UUID, default: true },
|
|
155
152
|
entityId: { type: String, required: true },
|
|
156
153
|
notifications: { type: Number, required: true },
|
|
157
154
|
subscription: { type: Number, required: true },
|
|
@@ -161,7 +158,7 @@ var NotihubStatsHistorySchema = {
|
|
|
161
158
|
var NotificationStatsHistorySchema_default = NotihubStatsHistorySchema;
|
|
162
159
|
|
|
163
160
|
// src/models/NotiHubStatsHistoryModel.ts
|
|
164
|
-
var notihubStatsHistorySchema = new
|
|
161
|
+
var notihubStatsHistorySchema = new Schema9(
|
|
165
162
|
NotificationStatsHistorySchema_default,
|
|
166
163
|
{
|
|
167
164
|
timestamps: true
|
|
@@ -174,12 +171,12 @@ var NotiHubStatsHistory = model5(
|
|
|
174
171
|
var NotiHubStatsHistoryModel_default = NotiHubStatsHistory;
|
|
175
172
|
|
|
176
173
|
// src/models/NotificationStatsModel.ts
|
|
177
|
-
import { Schema as
|
|
174
|
+
import { Schema as Schema11, model as model6 } from "mongoose";
|
|
178
175
|
|
|
179
176
|
// src/models/schemas/NotificationSchema.ts
|
|
180
|
-
import { Schema as
|
|
177
|
+
import { Schema as Schema10 } from "mongoose";
|
|
181
178
|
var NotificationSchema = {
|
|
182
|
-
id: { type:
|
|
179
|
+
id: { type: Schema10.Types.UUID, default: true },
|
|
183
180
|
title: { type: String, required: true },
|
|
184
181
|
message: { type: String, required: true },
|
|
185
182
|
type: { type: String, required: true },
|
|
@@ -190,7 +187,7 @@ var NotificationSchema = {
|
|
|
190
187
|
var NotificationSchema_default = NotificationSchema;
|
|
191
188
|
|
|
192
189
|
// src/models/NotificationStatsModel.ts
|
|
193
|
-
var notificationSchema = new
|
|
190
|
+
var notificationSchema = new Schema11(
|
|
194
191
|
{
|
|
195
192
|
notification: NotificationSchema_default,
|
|
196
193
|
views: { type: Number, default: 0 }
|
|
@@ -204,8 +201,8 @@ var NotificationStatsModel = model6(
|
|
|
204
201
|
var NotificationStatsModel_default = NotificationStatsModel;
|
|
205
202
|
|
|
206
203
|
// src/models/NotificationModel.ts
|
|
207
|
-
import { Schema as
|
|
208
|
-
var notificationSchema2 = new
|
|
204
|
+
import { Schema as Schema12, model as model7 } from "mongoose";
|
|
205
|
+
var notificationSchema2 = new Schema12(
|
|
209
206
|
{
|
|
210
207
|
title: { type: String, required: true },
|
|
211
208
|
message: { type: String, required: true },
|
|
@@ -223,16 +220,16 @@ var NotificationModel = model7(
|
|
|
223
220
|
var NotificationModel_default = NotificationModel;
|
|
224
221
|
|
|
225
222
|
// src/models/CustomerModel.ts
|
|
226
|
-
import { Schema as
|
|
227
|
-
var customerSchema = new
|
|
223
|
+
import { Schema as Schema13, model as model8 } from "mongoose";
|
|
224
|
+
var customerSchema = new Schema13(CustomerSchema_default, {
|
|
228
225
|
timestamps: true
|
|
229
226
|
});
|
|
230
227
|
var Customer = model8("Customer", customerSchema);
|
|
231
228
|
var CustomerModel_default = Customer;
|
|
232
229
|
|
|
233
230
|
// src/models/CustomerMinifiedModel.ts
|
|
234
|
-
import { Schema as
|
|
235
|
-
var customerMinifiedSchema = new
|
|
231
|
+
import { Schema as Schema14, model as model9 } from "mongoose";
|
|
232
|
+
var customerMinifiedSchema = new Schema14(
|
|
236
233
|
CustomerMinifiedSchema_default,
|
|
237
234
|
{ timestamps: true }
|
|
238
235
|
);
|
|
@@ -243,7 +240,7 @@ var CustomerMinified = model9(
|
|
|
243
240
|
var CustomerMinifiedModel_default = CustomerMinified;
|
|
244
241
|
|
|
245
242
|
// src/models/SubscriptionTypeModel.ts
|
|
246
|
-
import { Schema as
|
|
243
|
+
import { Schema as Schema15, model as model10 } from "mongoose";
|
|
247
244
|
|
|
248
245
|
// src/models/schemas/SubscriptionTypeSchema.ts
|
|
249
246
|
var SubscriptionSchema2 = {
|
|
@@ -254,7 +251,7 @@ var SubscriptionSchema2 = {
|
|
|
254
251
|
var SubscriptionTypeSchema_default = SubscriptionSchema2;
|
|
255
252
|
|
|
256
253
|
// src/models/SubscriptionTypeModel.ts
|
|
257
|
-
var subscriptionSchema2 = new
|
|
254
|
+
var subscriptionSchema2 = new Schema15(
|
|
258
255
|
SubscriptionTypeSchema_default,
|
|
259
256
|
{
|
|
260
257
|
timestamps: true
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amohamud23/notihub",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.84",
|
|
4
4
|
"description": "Notihub Package",
|
|
5
|
-
"main": "./dist/index.
|
|
6
|
-
"types": "./dist/index.d.
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"types": "./dist/index.d.cts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "tsup",
|