@devwithbobby/loops 0.1.11 → 0.1.13

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.
@@ -1,55 +1,144 @@
1
1
  /**
2
2
  * Internal mutation to store/update a contact in the database
3
3
  */
4
- export declare const storeContact: any;
4
+ export declare const storeContact: import("convex/server").RegisteredMutation<"public", {
5
+ email: string;
6
+ firstName?: string | undefined;
7
+ lastName?: string | undefined;
8
+ userId?: string | undefined;
9
+ source?: string | undefined;
10
+ subscribed?: boolean | undefined;
11
+ userGroup?: string | undefined;
12
+ loopsContactId?: string | undefined;
13
+ }, Promise<void>>;
5
14
  /**
6
15
  * Internal mutation to delete a contact from the database
7
16
  */
8
- export declare const removeContact: any;
17
+ export declare const removeContact: import("convex/server").RegisteredMutation<"public", {
18
+ email: string;
19
+ }, Promise<void>>;
9
20
  /**
10
21
  * Internal mutation to log an email operation for monitoring
11
22
  */
12
- export declare const logEmailOperation: any;
23
+ export declare const logEmailOperation: import("convex/server").RegisteredMutation<"public", {
24
+ operationType: "transactional" | "event" | "campaign" | "loop";
25
+ email: string;
26
+ success: boolean;
27
+ actorId?: string | undefined;
28
+ transactionalId?: string | undefined;
29
+ campaignId?: string | undefined;
30
+ loopId?: string | undefined;
31
+ eventName?: string | undefined;
32
+ messageId?: string | undefined;
33
+ metadata?: Record<string, any> | undefined;
34
+ }, Promise<void>>;
13
35
  /**
14
36
  * Count contacts in the database
15
37
  * Can filter by audience criteria (userGroup, source, subscribed status)
16
38
  */
17
- export declare const countContacts: any;
39
+ export declare const countContacts: import("convex/server").RegisteredQuery<"public", {
40
+ userGroup?: string | undefined;
41
+ source?: string | undefined;
42
+ subscribed?: boolean | undefined;
43
+ }, Promise<number>>;
18
44
  /**
19
45
  * List contacts from the database with pagination
20
46
  * Can filter by audience criteria (userGroup, source, subscribed status)
21
47
  * Returns actual contact data, not just a count
22
48
  */
23
- export declare const listContacts: any;
49
+ export declare const listContacts: import("convex/server").RegisteredQuery<"public", {
50
+ limit: number;
51
+ offset: number;
52
+ userGroup?: string | undefined;
53
+ source?: string | undefined;
54
+ subscribed?: boolean | undefined;
55
+ }, Promise<{
56
+ contacts: {
57
+ _id: string;
58
+ email: string;
59
+ subscribed: boolean;
60
+ createdAt: number;
61
+ updatedAt: number;
62
+ firstName?: string | undefined;
63
+ lastName?: string | undefined;
64
+ userId?: string | undefined;
65
+ source?: string | undefined;
66
+ userGroup?: string | undefined;
67
+ loopsContactId?: string | undefined;
68
+ }[];
69
+ total: number;
70
+ limit: number;
71
+ offset: number;
72
+ hasMore: boolean;
73
+ }>>;
24
74
  /**
25
75
  * Add or update a contact in Loops
26
76
  * This function tries to create a contact, and if the email already exists (409),
27
77
  * it falls back to updating the contact instead.
28
78
  */
29
- export declare const addContact: any;
79
+ export declare const addContact: import("convex/server").RegisteredAction<"public", {
80
+ apiKey: string;
81
+ contact: {
82
+ email: string;
83
+ firstName?: string | undefined;
84
+ lastName?: string | undefined;
85
+ userId?: string | undefined;
86
+ source?: string | undefined;
87
+ subscribed?: boolean | undefined;
88
+ userGroup?: string | undefined;
89
+ };
90
+ }, Promise<{
91
+ success: boolean;
92
+ id?: string | undefined;
93
+ }>>;
30
94
  /**
31
95
  * Update an existing contact in Loops
32
96
  */
33
- export declare const updateContact: any;
97
+ export declare const updateContact: import("convex/server").RegisteredAction<"public", {
98
+ apiKey: string;
99
+ email: string;
100
+ dataVariables?: Record<string, any> | undefined;
101
+ firstName?: string | undefined;
102
+ lastName?: string | undefined;
103
+ userId?: string | undefined;
104
+ source?: string | undefined;
105
+ subscribed?: boolean | undefined;
106
+ userGroup?: string | undefined;
107
+ }, Promise<{
108
+ success: boolean;
109
+ }>>;
34
110
  /**
35
111
  * Send a transactional email using a transactional ID
36
112
  */
37
- export declare const sendTransactional: any;
113
+ export declare const sendTransactional: import("convex/server").RegisteredAction<"public", {
114
+ apiKey: string;
115
+ transactionalId: string;
116
+ email: string;
117
+ dataVariables?: Record<string, any> | undefined;
118
+ }, Promise<{
119
+ success: boolean;
120
+ messageId?: string | undefined;
121
+ }>>;
38
122
  /**
39
123
  * Send an event to Loops to trigger email workflows
40
124
  */
41
- export declare const sendEvent: any;
125
+ export declare const sendEvent: import("convex/server").RegisteredAction<"public", {
126
+ apiKey: string;
127
+ email: string;
128
+ eventName: string;
129
+ eventProperties?: Record<string, any> | undefined;
130
+ }, Promise<{
131
+ success: boolean;
132
+ }>>;
42
133
  /**
43
134
  * Delete a contact from Loops
44
135
  */
45
- export declare const deleteContact: any;
46
- /**
47
- * Send a campaign to contacts
48
- * Note: Campaigns in Loops.so are typically managed from the dashboard.
49
- * This function sends transactional emails to multiple contacts as a workaround.
50
- * If you need true campaign functionality, use the Loops.so dashboard or contact their support.
51
- */
52
- export declare const sendCampaign: any;
136
+ export declare const deleteContact: import("convex/server").RegisteredAction<"public", {
137
+ apiKey: string;
138
+ email: string;
139
+ }, Promise<{
140
+ success: boolean;
141
+ }>>;
53
142
  /**
54
143
  * Trigger a loop for a contact
55
144
  * Note: Loops in Loops.so are triggered through events, not a direct API endpoint.
@@ -66,61 +155,180 @@ export declare const sendCampaign: any;
66
155
  *
67
156
  * This function is kept for backwards compatibility but works by sending an event.
68
157
  */
69
- export declare const triggerLoop: any;
158
+ export declare const triggerLoop: import("convex/server").RegisteredAction<"public", {
159
+ apiKey: string;
160
+ loopId: string;
161
+ email: string;
162
+ dataVariables?: Record<string, any> | undefined;
163
+ eventName?: string | undefined;
164
+ }, Promise<{
165
+ success: boolean;
166
+ warning?: string | undefined;
167
+ }>>;
70
168
  /**
71
169
  * Find a contact by email
72
170
  * Retrieves contact information from Loops
73
171
  * Note: Loops API may return either an object or an array
74
172
  */
75
- export declare const findContact: any;
173
+ export declare const findContact: import("convex/server").RegisteredAction<"public", {
174
+ apiKey: string;
175
+ email: string;
176
+ }, Promise<{
177
+ success: boolean;
178
+ contact?: {
179
+ id?: string | null | undefined;
180
+ email?: string | null | undefined;
181
+ firstName?: string | null | undefined;
182
+ lastName?: string | null | undefined;
183
+ source?: string | null | undefined;
184
+ subscribed?: boolean | null | undefined;
185
+ userGroup?: string | null | undefined;
186
+ userId?: string | null | undefined;
187
+ createdAt?: string | null | undefined;
188
+ } | undefined;
189
+ }>>;
76
190
  /**
77
191
  * Batch create contacts
78
192
  * Creates multiple contacts sequentially using the single contact create endpoint.
79
193
  * Note: Loops.so doesn't have a batch endpoint, so we create contacts one by one.
80
194
  */
81
- export declare const batchCreateContacts: any;
195
+ export declare const batchCreateContacts: import("convex/server").RegisteredAction<"public", {
196
+ apiKey: string;
197
+ contacts: {
198
+ email: string;
199
+ firstName?: string | undefined;
200
+ lastName?: string | undefined;
201
+ userId?: string | undefined;
202
+ source?: string | undefined;
203
+ subscribed?: boolean | undefined;
204
+ userGroup?: string | undefined;
205
+ }[];
206
+ }, Promise<{
207
+ success: boolean;
208
+ created?: number | undefined;
209
+ failed?: number | undefined;
210
+ results?: {
211
+ email: string;
212
+ success: boolean;
213
+ error?: string | undefined;
214
+ }[] | undefined;
215
+ }>>;
82
216
  /**
83
217
  * Unsubscribe a contact
84
218
  * Unsubscribes a contact from receiving emails (they remain in the system)
85
219
  */
86
- export declare const unsubscribeContact: any;
220
+ export declare const unsubscribeContact: import("convex/server").RegisteredAction<"public", {
221
+ apiKey: string;
222
+ email: string;
223
+ }, Promise<{
224
+ success: boolean;
225
+ }>>;
87
226
  /**
88
227
  * Resubscribe a contact
89
228
  * Resubscribes a previously unsubscribed contact
90
229
  */
91
- export declare const resubscribeContact: any;
230
+ export declare const resubscribeContact: import("convex/server").RegisteredAction<"public", {
231
+ apiKey: string;
232
+ email: string;
233
+ }, Promise<{
234
+ success: boolean;
235
+ }>>;
92
236
  /**
93
237
  * Check for spam patterns: too many emails to the same recipient in a time window
94
238
  * Returns email addresses that received too many emails
95
239
  */
96
- export declare const detectRecipientSpam: any;
240
+ export declare const detectRecipientSpam: import("convex/server").RegisteredQuery<"public", {
241
+ timeWindowMs: number;
242
+ maxEmailsPerRecipient: number;
243
+ }, Promise<{
244
+ [x: string]: any;
245
+ email: string;
246
+ count: number;
247
+ timeWindowMs: number;
248
+ }[]>>;
97
249
  /**
98
250
  * Check for spam patterns: too many emails from the same actor/user
99
251
  * Returns actor IDs that sent too many emails
100
252
  */
101
- export declare const detectActorSpam: any;
253
+ export declare const detectActorSpam: import("convex/server").RegisteredQuery<"public", {
254
+ timeWindowMs: number;
255
+ maxEmailsPerActor: number;
256
+ }, Promise<{
257
+ actorId: string;
258
+ count: number;
259
+ timeWindowMs: number;
260
+ }[]>>;
102
261
  /**
103
262
  * Get recent email operation statistics for monitoring
104
263
  */
105
- export declare const getEmailStats: any;
264
+ export declare const getEmailStats: import("convex/server").RegisteredQuery<"public", {
265
+ timeWindowMs: number;
266
+ }, Promise<{
267
+ [x: string]: any;
268
+ totalOperations: number;
269
+ successfulOperations: number;
270
+ failedOperations: number;
271
+ operationsByType: Record<string, number>;
272
+ uniqueRecipients: number;
273
+ uniqueActors: number;
274
+ }>>;
106
275
  /**
107
276
  * Detect rapid-fire email sending patterns (multiple emails sent in quick succession)
108
277
  * Returns suspicious patterns indicating potential spam
109
278
  */
110
- export declare const detectRapidFirePatterns: any;
279
+ export declare const detectRapidFirePatterns: import("convex/server").RegisteredQuery<"public", {
280
+ timeWindowMs: number;
281
+ minEmailsInWindow: number;
282
+ }, Promise<{
283
+ count: number;
284
+ timeWindowMs: number;
285
+ firstTimestamp: number;
286
+ lastTimestamp: number;
287
+ email?: string | undefined;
288
+ actorId?: string | undefined;
289
+ }[]>>;
111
290
  /**
112
291
  * Rate limiting: Check if an email can be sent to a recipient
113
292
  * Based on recent email operations in the database
114
293
  */
115
- export declare const checkRecipientRateLimit: any;
294
+ export declare const checkRecipientRateLimit: import("convex/server").RegisteredQuery<"public", {
295
+ email: string;
296
+ timeWindowMs: number;
297
+ maxEmails: number;
298
+ }, Promise<{
299
+ [x: string]: any;
300
+ allowed: boolean;
301
+ count: number;
302
+ limit: number;
303
+ timeWindowMs: number;
304
+ retryAfter?: number | undefined;
305
+ }>>;
116
306
  /**
117
307
  * Rate limiting: Check if an actor/user can send more emails
118
308
  * Based on recent email operations in the database
119
309
  */
120
- export declare const checkActorRateLimit: any;
310
+ export declare const checkActorRateLimit: import("convex/server").RegisteredQuery<"public", {
311
+ actorId: string;
312
+ timeWindowMs: number;
313
+ maxEmails: number;
314
+ }, Promise<{
315
+ allowed: boolean;
316
+ count: number;
317
+ limit: number;
318
+ timeWindowMs: number;
319
+ retryAfter?: number | undefined;
320
+ }>>;
121
321
  /**
122
322
  * Rate limiting: Check global email sending rate
123
323
  * Checks total email operations across all senders
124
324
  */
125
- export declare const checkGlobalRateLimit: any;
325
+ export declare const checkGlobalRateLimit: import("convex/server").RegisteredQuery<"public", {
326
+ timeWindowMs: number;
327
+ maxEmails: number;
328
+ }, Promise<{
329
+ allowed: boolean;
330
+ count: number;
331
+ limit: number;
332
+ timeWindowMs: number;
333
+ }>>;
126
334
  //# sourceMappingURL=lib.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/component/lib.ts"],"names":[],"mappings":"AA0BA;;GAEG;AACH,eAAO,MAAM,YAAY,KA6CvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa,KAexB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB,KAgC5B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,aAAa,KAwCxB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,YAAY,KA8EvB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,UAAU,KAiHrB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa,KAoDxB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB,KAqD5B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,SAAS,KAgCpB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa,KA8BxB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,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