@sankira-dev/event-types 0.0.1
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.d.ts +233 -0
- package/dist/index.js +96 -0
- package/package.json +23 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
export declare const NotificationEntityTypeSchema: z.ZodEnum<["comment", "post", "space", "user"]>;
|
|
3
|
+
export type NotificationEntityType = z.infer<typeof NotificationEntityTypeSchema>;
|
|
4
|
+
export declare const NotificationEventTypeSchema: z.ZodEnum<["comment_replied", "comment_voted", "post_replied", "post_voted", "user_followed", "user_mentioned"]>;
|
|
5
|
+
export type NotificationEventType = z.infer<typeof NotificationEventTypeSchema>;
|
|
6
|
+
export declare const NotificationActorSchema: z.ZodObject<{
|
|
7
|
+
full_name: z.ZodString;
|
|
8
|
+
id: z.ZodNumber;
|
|
9
|
+
profile_picture_url: z.ZodOptional<z.ZodString>;
|
|
10
|
+
username: z.ZodString;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
id: number;
|
|
13
|
+
username: string;
|
|
14
|
+
full_name: string;
|
|
15
|
+
profile_picture_url?: string | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
id: number;
|
|
18
|
+
username: string;
|
|
19
|
+
full_name: string;
|
|
20
|
+
profile_picture_url?: string | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
export type NotificationActor = z.infer<typeof NotificationActorSchema>;
|
|
23
|
+
export declare const PasswordResetSchema: z.ZodObject<{
|
|
24
|
+
email: z.ZodString;
|
|
25
|
+
reset_link: z.ZodString;
|
|
26
|
+
sent_at: z.ZodDate;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
email: string;
|
|
29
|
+
reset_link: string;
|
|
30
|
+
sent_at: Date;
|
|
31
|
+
}, {
|
|
32
|
+
email: string;
|
|
33
|
+
reset_link: string;
|
|
34
|
+
sent_at: Date;
|
|
35
|
+
}>;
|
|
36
|
+
export type PasswordReset = z.infer<typeof PasswordResetSchema>;
|
|
37
|
+
export declare const SignupLinkRequestedSchema: z.ZodObject<{
|
|
38
|
+
email: z.ZodString;
|
|
39
|
+
sent_at: z.ZodDate;
|
|
40
|
+
signup_link: z.ZodString;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
email: string;
|
|
43
|
+
sent_at: Date;
|
|
44
|
+
signup_link: string;
|
|
45
|
+
}, {
|
|
46
|
+
email: string;
|
|
47
|
+
sent_at: Date;
|
|
48
|
+
signup_link: string;
|
|
49
|
+
}>;
|
|
50
|
+
export type SignupLinkRequested = z.infer<typeof SignupLinkRequestedSchema>;
|
|
51
|
+
export declare const TwoFactorOtpRequestedSchema: z.ZodObject<{
|
|
52
|
+
email: z.ZodString;
|
|
53
|
+
otp: z.ZodString;
|
|
54
|
+
sent_at: z.ZodDate;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
email: string;
|
|
57
|
+
sent_at: Date;
|
|
58
|
+
otp: string;
|
|
59
|
+
}, {
|
|
60
|
+
email: string;
|
|
61
|
+
sent_at: Date;
|
|
62
|
+
otp: string;
|
|
63
|
+
}>;
|
|
64
|
+
export type TwoFactorOtpRequested = z.infer<typeof TwoFactorOtpRequestedSchema>;
|
|
65
|
+
export declare const WriterApplicationSubmittedSchema: z.ZodObject<{
|
|
66
|
+
application_id: z.ZodNumber;
|
|
67
|
+
email: z.ZodString;
|
|
68
|
+
full_name: z.ZodString;
|
|
69
|
+
submitted_at: z.ZodDate;
|
|
70
|
+
user_id: z.ZodNumber;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
email: string;
|
|
73
|
+
full_name: string;
|
|
74
|
+
application_id: number;
|
|
75
|
+
submitted_at: Date;
|
|
76
|
+
user_id: number;
|
|
77
|
+
}, {
|
|
78
|
+
email: string;
|
|
79
|
+
full_name: string;
|
|
80
|
+
application_id: number;
|
|
81
|
+
submitted_at: Date;
|
|
82
|
+
user_id: number;
|
|
83
|
+
}>;
|
|
84
|
+
export type WriterApplicationSubmitted = z.infer<typeof WriterApplicationSubmittedSchema>;
|
|
85
|
+
export declare const DigestItemSchema: z.ZodObject<{
|
|
86
|
+
actors: z.ZodArray<z.ZodObject<{
|
|
87
|
+
full_name: z.ZodString;
|
|
88
|
+
id: z.ZodNumber;
|
|
89
|
+
profile_picture_url: z.ZodOptional<z.ZodString>;
|
|
90
|
+
username: z.ZodString;
|
|
91
|
+
}, "strip", z.ZodTypeAny, {
|
|
92
|
+
id: number;
|
|
93
|
+
username: string;
|
|
94
|
+
full_name: string;
|
|
95
|
+
profile_picture_url?: string | undefined;
|
|
96
|
+
}, {
|
|
97
|
+
id: number;
|
|
98
|
+
username: string;
|
|
99
|
+
full_name: string;
|
|
100
|
+
profile_picture_url?: string | undefined;
|
|
101
|
+
}>, "many">;
|
|
102
|
+
count: z.ZodNumber;
|
|
103
|
+
entity_id: z.ZodNumber;
|
|
104
|
+
entity_slug: z.ZodString;
|
|
105
|
+
entity_type: z.ZodEnum<["comment", "post", "space", "user"]>;
|
|
106
|
+
event_type: z.ZodEnum<["comment_replied", "comment_voted", "post_replied", "post_voted", "user_followed", "user_mentioned"]>;
|
|
107
|
+
last_activity: z.ZodDate;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
actors: {
|
|
110
|
+
id: number;
|
|
111
|
+
username: string;
|
|
112
|
+
full_name: string;
|
|
113
|
+
profile_picture_url?: string | undefined;
|
|
114
|
+
}[];
|
|
115
|
+
count: number;
|
|
116
|
+
entity_id: number;
|
|
117
|
+
entity_slug: string;
|
|
118
|
+
entity_type: "user" | "comment" | "post" | "space";
|
|
119
|
+
event_type: "comment_replied" | "comment_voted" | "post_replied" | "post_voted" | "user_followed" | "user_mentioned";
|
|
120
|
+
last_activity: Date;
|
|
121
|
+
}, {
|
|
122
|
+
actors: {
|
|
123
|
+
id: number;
|
|
124
|
+
username: string;
|
|
125
|
+
full_name: string;
|
|
126
|
+
profile_picture_url?: string | undefined;
|
|
127
|
+
}[];
|
|
128
|
+
count: number;
|
|
129
|
+
entity_id: number;
|
|
130
|
+
entity_slug: string;
|
|
131
|
+
entity_type: "user" | "comment" | "post" | "space";
|
|
132
|
+
event_type: "comment_replied" | "comment_voted" | "post_replied" | "post_voted" | "user_followed" | "user_mentioned";
|
|
133
|
+
last_activity: Date;
|
|
134
|
+
}>;
|
|
135
|
+
export type DigestItem = z.infer<typeof DigestItemSchema>;
|
|
136
|
+
export declare const EmailDigestSchema: z.ZodObject<{
|
|
137
|
+
date: z.ZodDate;
|
|
138
|
+
email: z.ZodString;
|
|
139
|
+
first_name: z.ZodString;
|
|
140
|
+
items: z.ZodArray<z.ZodObject<{
|
|
141
|
+
actors: z.ZodArray<z.ZodObject<{
|
|
142
|
+
full_name: z.ZodString;
|
|
143
|
+
id: z.ZodNumber;
|
|
144
|
+
profile_picture_url: z.ZodOptional<z.ZodString>;
|
|
145
|
+
username: z.ZodString;
|
|
146
|
+
}, "strip", z.ZodTypeAny, {
|
|
147
|
+
id: number;
|
|
148
|
+
username: string;
|
|
149
|
+
full_name: string;
|
|
150
|
+
profile_picture_url?: string | undefined;
|
|
151
|
+
}, {
|
|
152
|
+
id: number;
|
|
153
|
+
username: string;
|
|
154
|
+
full_name: string;
|
|
155
|
+
profile_picture_url?: string | undefined;
|
|
156
|
+
}>, "many">;
|
|
157
|
+
count: z.ZodNumber;
|
|
158
|
+
entity_id: z.ZodNumber;
|
|
159
|
+
entity_slug: z.ZodString;
|
|
160
|
+
entity_type: z.ZodEnum<["comment", "post", "space", "user"]>;
|
|
161
|
+
event_type: z.ZodEnum<["comment_replied", "comment_voted", "post_replied", "post_voted", "user_followed", "user_mentioned"]>;
|
|
162
|
+
last_activity: z.ZodDate;
|
|
163
|
+
}, "strip", z.ZodTypeAny, {
|
|
164
|
+
actors: {
|
|
165
|
+
id: number;
|
|
166
|
+
username: string;
|
|
167
|
+
full_name: string;
|
|
168
|
+
profile_picture_url?: string | undefined;
|
|
169
|
+
}[];
|
|
170
|
+
count: number;
|
|
171
|
+
entity_id: number;
|
|
172
|
+
entity_slug: string;
|
|
173
|
+
entity_type: "user" | "comment" | "post" | "space";
|
|
174
|
+
event_type: "comment_replied" | "comment_voted" | "post_replied" | "post_voted" | "user_followed" | "user_mentioned";
|
|
175
|
+
last_activity: Date;
|
|
176
|
+
}, {
|
|
177
|
+
actors: {
|
|
178
|
+
id: number;
|
|
179
|
+
username: string;
|
|
180
|
+
full_name: string;
|
|
181
|
+
profile_picture_url?: string | undefined;
|
|
182
|
+
}[];
|
|
183
|
+
count: number;
|
|
184
|
+
entity_id: number;
|
|
185
|
+
entity_slug: string;
|
|
186
|
+
entity_type: "user" | "comment" | "post" | "space";
|
|
187
|
+
event_type: "comment_replied" | "comment_voted" | "post_replied" | "post_voted" | "user_followed" | "user_mentioned";
|
|
188
|
+
last_activity: Date;
|
|
189
|
+
}>, "many">;
|
|
190
|
+
last_name: z.ZodString;
|
|
191
|
+
user_id: z.ZodNumber;
|
|
192
|
+
}, "strip", z.ZodTypeAny, {
|
|
193
|
+
email: string;
|
|
194
|
+
date: Date;
|
|
195
|
+
items: {
|
|
196
|
+
actors: {
|
|
197
|
+
id: number;
|
|
198
|
+
username: string;
|
|
199
|
+
full_name: string;
|
|
200
|
+
profile_picture_url?: string | undefined;
|
|
201
|
+
}[];
|
|
202
|
+
count: number;
|
|
203
|
+
entity_id: number;
|
|
204
|
+
entity_slug: string;
|
|
205
|
+
entity_type: "user" | "comment" | "post" | "space";
|
|
206
|
+
event_type: "comment_replied" | "comment_voted" | "post_replied" | "post_voted" | "user_followed" | "user_mentioned";
|
|
207
|
+
last_activity: Date;
|
|
208
|
+
}[];
|
|
209
|
+
user_id: number;
|
|
210
|
+
first_name: string;
|
|
211
|
+
last_name: string;
|
|
212
|
+
}, {
|
|
213
|
+
email: string;
|
|
214
|
+
date: Date;
|
|
215
|
+
items: {
|
|
216
|
+
actors: {
|
|
217
|
+
id: number;
|
|
218
|
+
username: string;
|
|
219
|
+
full_name: string;
|
|
220
|
+
profile_picture_url?: string | undefined;
|
|
221
|
+
}[];
|
|
222
|
+
count: number;
|
|
223
|
+
entity_id: number;
|
|
224
|
+
entity_slug: string;
|
|
225
|
+
entity_type: "user" | "comment" | "post" | "space";
|
|
226
|
+
event_type: "comment_replied" | "comment_voted" | "post_replied" | "post_voted" | "user_followed" | "user_mentioned";
|
|
227
|
+
last_activity: Date;
|
|
228
|
+
}[];
|
|
229
|
+
user_id: number;
|
|
230
|
+
first_name: string;
|
|
231
|
+
last_name: string;
|
|
232
|
+
}>;
|
|
233
|
+
export type EmailDigest = z.infer<typeof EmailDigestSchema>;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.EmailDigestSchema = exports.DigestItemSchema = exports.WriterApplicationSubmittedSchema = exports.TwoFactorOtpRequestedSchema = exports.SignupLinkRequestedSchema = exports.PasswordResetSchema = exports.NotificationActorSchema = exports.NotificationEventTypeSchema = exports.NotificationEntityTypeSchema = void 0;
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
38
|
+
exports.NotificationEntityTypeSchema = z.enum([
|
|
39
|
+
"comment",
|
|
40
|
+
"post",
|
|
41
|
+
"space",
|
|
42
|
+
"user",
|
|
43
|
+
]);
|
|
44
|
+
exports.NotificationEventTypeSchema = z.enum([
|
|
45
|
+
"comment_replied",
|
|
46
|
+
"comment_voted",
|
|
47
|
+
"post_replied",
|
|
48
|
+
"post_voted",
|
|
49
|
+
"user_followed",
|
|
50
|
+
"user_mentioned",
|
|
51
|
+
]);
|
|
52
|
+
exports.NotificationActorSchema = z.object({
|
|
53
|
+
"full_name": z.string(),
|
|
54
|
+
"id": z.number(),
|
|
55
|
+
"profile_picture_url": z.string().optional(),
|
|
56
|
+
"username": z.string(),
|
|
57
|
+
});
|
|
58
|
+
exports.PasswordResetSchema = z.object({
|
|
59
|
+
"email": z.string(),
|
|
60
|
+
"reset_link": z.string(),
|
|
61
|
+
"sent_at": z.coerce.date(),
|
|
62
|
+
});
|
|
63
|
+
exports.SignupLinkRequestedSchema = z.object({
|
|
64
|
+
"email": z.string(),
|
|
65
|
+
"sent_at": z.coerce.date(),
|
|
66
|
+
"signup_link": z.string(),
|
|
67
|
+
});
|
|
68
|
+
exports.TwoFactorOtpRequestedSchema = z.object({
|
|
69
|
+
"email": z.string(),
|
|
70
|
+
"otp": z.string(),
|
|
71
|
+
"sent_at": z.coerce.date(),
|
|
72
|
+
});
|
|
73
|
+
exports.WriterApplicationSubmittedSchema = z.object({
|
|
74
|
+
"application_id": z.number(),
|
|
75
|
+
"email": z.string(),
|
|
76
|
+
"full_name": z.string(),
|
|
77
|
+
"submitted_at": z.coerce.date(),
|
|
78
|
+
"user_id": z.number(),
|
|
79
|
+
});
|
|
80
|
+
exports.DigestItemSchema = z.object({
|
|
81
|
+
"actors": z.array(exports.NotificationActorSchema),
|
|
82
|
+
"count": z.number(),
|
|
83
|
+
"entity_id": z.number(),
|
|
84
|
+
"entity_slug": z.string(),
|
|
85
|
+
"entity_type": exports.NotificationEntityTypeSchema,
|
|
86
|
+
"event_type": exports.NotificationEventTypeSchema,
|
|
87
|
+
"last_activity": z.coerce.date(),
|
|
88
|
+
});
|
|
89
|
+
exports.EmailDigestSchema = z.object({
|
|
90
|
+
"date": z.coerce.date(),
|
|
91
|
+
"email": z.string(),
|
|
92
|
+
"first_name": z.string(),
|
|
93
|
+
"items": z.array(exports.DigestItemSchema),
|
|
94
|
+
"last_name": z.string(),
|
|
95
|
+
"user_id": z.number(),
|
|
96
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sankira-dev/event-types",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Event Types for Sankira",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"generate": "quicktype -l typescript-zod --src ../internal/events/schemas/* -s schema -o ./src/index.ts",
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"prepublishOnly": "tsc"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/node": "^22.15.19",
|
|
17
|
+
"quicktype": "^23.2.4",
|
|
18
|
+
"typescript": "^5.8.3"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"zod": "^3.25.7"
|
|
22
|
+
}
|
|
23
|
+
}
|