@niama/loops 0.2.0
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/README.md +506 -0
- package/dist/client/index.d.ts +510 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +464 -0
- package/dist/component/_generated/api.d.ts +232 -0
- package/dist/component/_generated/api.d.ts.map +1 -0
- package/dist/component/_generated/api.js +30 -0
- package/dist/component/_generated/component.d.ts +245 -0
- package/dist/component/_generated/component.d.ts.map +1 -0
- package/dist/component/_generated/component.js +9 -0
- package/dist/component/_generated/dataModel.d.ts +46 -0
- package/dist/component/_generated/dataModel.d.ts.map +1 -0
- package/dist/component/_generated/dataModel.js +10 -0
- package/dist/component/_generated/server.d.ts +121 -0
- package/dist/component/_generated/server.d.ts.map +1 -0
- package/dist/component/_generated/server.js +77 -0
- package/dist/component/actions.d.ts +159 -0
- package/dist/component/actions.d.ts.map +1 -0
- package/dist/component/actions.js +468 -0
- package/dist/component/aggregates.d.ts +42 -0
- package/dist/component/aggregates.d.ts.map +1 -0
- package/dist/component/aggregates.js +54 -0
- package/dist/component/convex.config.d.ts +3 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js +5 -0
- package/dist/component/helpers.d.ts +16 -0
- package/dist/component/helpers.d.ts.map +1 -0
- package/dist/component/helpers.js +98 -0
- package/dist/component/http.d.ts +3 -0
- package/dist/component/http.d.ts.map +1 -0
- package/dist/component/http.js +208 -0
- package/dist/component/mutations.d.ts +55 -0
- package/dist/component/mutations.d.ts.map +1 -0
- package/dist/component/mutations.js +167 -0
- package/dist/component/queries.d.ts +171 -0
- package/dist/component/queries.d.ts.map +1 -0
- package/dist/component/queries.js +516 -0
- package/dist/component/schema.d.ts +63 -0
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js +16 -0
- package/dist/component/tables/contacts.d.ts +16 -0
- package/dist/component/tables/contacts.d.ts.map +1 -0
- package/dist/component/tables/contacts.js +16 -0
- package/dist/component/tables/emailOperations.d.ts +17 -0
- package/dist/component/tables/emailOperations.d.ts.map +1 -0
- package/dist/component/tables/emailOperations.js +17 -0
- package/dist/component/validators.d.ts +338 -0
- package/dist/component/validators.d.ts.map +1 -0
- package/dist/component/validators.js +167 -0
- package/dist/test.d.ts +78 -0
- package/dist/test.d.ts.map +1 -0
- package/dist/test.js +16 -0
- package/dist/types.d.ts +39 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +0 -0
- package/package.json +112 -0
- package/src/client/index.ts +618 -0
- package/src/component/_generated/api.ts +253 -0
- package/src/component/_generated/component.ts +291 -0
- package/src/component/_generated/dataModel.ts +60 -0
- package/src/component/_generated/server.ts +161 -0
- package/src/component/actions.ts +556 -0
- package/src/component/aggregates.ts +89 -0
- package/src/component/convex.config.ts +8 -0
- package/src/component/helpers.ts +130 -0
- package/src/component/http.ts +236 -0
- package/src/component/mutations.ts +192 -0
- package/src/component/queries.ts +604 -0
- package/src/component/schema.ts +17 -0
- package/src/component/tables/contacts.ts +17 -0
- package/src/component/tables/emailOperations.ts +23 -0
- package/src/component/validators.ts +197 -0
- package/src/test.ts +27 -0
- package/src/types.ts +62 -0
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
import type { ComponentApi } from "../component/_generated/component.js";
|
|
2
|
+
import type { RunActionCtx, RunMutationCtx, RunQueryCtx } from "../types";
|
|
3
|
+
export type LoopsComponent = ComponentApi;
|
|
4
|
+
export interface ContactData {
|
|
5
|
+
email: string;
|
|
6
|
+
firstName?: string;
|
|
7
|
+
lastName?: string;
|
|
8
|
+
userId?: string;
|
|
9
|
+
source?: string;
|
|
10
|
+
subscribed?: boolean;
|
|
11
|
+
userGroup?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface TransactionalEmailOptions {
|
|
14
|
+
transactionalId: string;
|
|
15
|
+
email: string;
|
|
16
|
+
dataVariables?: Record<string, unknown>;
|
|
17
|
+
idempotencyKey?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface EventOptions {
|
|
20
|
+
email: string;
|
|
21
|
+
eventName: string;
|
|
22
|
+
eventProperties?: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
export declare class Loops {
|
|
25
|
+
readonly options?: {
|
|
26
|
+
apiKey?: string;
|
|
27
|
+
};
|
|
28
|
+
private readonly actions;
|
|
29
|
+
private readonly queries;
|
|
30
|
+
private readonly mutations;
|
|
31
|
+
private _apiKey?;
|
|
32
|
+
constructor(component: LoopsComponent, options?: {
|
|
33
|
+
apiKey?: string;
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Get the API key, checking environment at call time (not constructor time).
|
|
37
|
+
* This allows the Loops client to be instantiated at module load time.
|
|
38
|
+
*/
|
|
39
|
+
private get apiKey();
|
|
40
|
+
/**
|
|
41
|
+
* Add or update a contact in Loops
|
|
42
|
+
*/
|
|
43
|
+
addContact(ctx: RunActionCtx, contact: ContactData): Promise<{
|
|
44
|
+
id?: string;
|
|
45
|
+
success: boolean;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Update an existing contact in Loops
|
|
49
|
+
*/
|
|
50
|
+
updateContact(ctx: RunActionCtx, email: string, updates: Partial<ContactData> & {
|
|
51
|
+
dataVariables?: Record<string, unknown>;
|
|
52
|
+
}): Promise<{
|
|
53
|
+
success: boolean;
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* Send a transactional email using a transactional ID
|
|
57
|
+
*/
|
|
58
|
+
sendTransactional(ctx: RunActionCtx, options: TransactionalEmailOptions): Promise<{
|
|
59
|
+
messageId?: string;
|
|
60
|
+
success: boolean;
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* Send an event to Loops to trigger email workflows
|
|
64
|
+
*/
|
|
65
|
+
sendEvent(ctx: RunActionCtx, options: EventOptions): Promise<{
|
|
66
|
+
success: boolean;
|
|
67
|
+
}>;
|
|
68
|
+
/**
|
|
69
|
+
* Find a contact by email
|
|
70
|
+
* Retrieves contact information from Loops
|
|
71
|
+
*/
|
|
72
|
+
findContact(ctx: RunActionCtx, email: string): Promise<{
|
|
73
|
+
contact?: {
|
|
74
|
+
createdAt?: string | null;
|
|
75
|
+
email?: string | null;
|
|
76
|
+
firstName?: string | null;
|
|
77
|
+
id?: string | null;
|
|
78
|
+
lastName?: string | null;
|
|
79
|
+
source?: string | null;
|
|
80
|
+
subscribed?: boolean | null;
|
|
81
|
+
userGroup?: string | null;
|
|
82
|
+
userId?: string | null;
|
|
83
|
+
};
|
|
84
|
+
success: boolean;
|
|
85
|
+
}>;
|
|
86
|
+
/**
|
|
87
|
+
* Batch create contacts
|
|
88
|
+
* Create multiple contacts in a single API call
|
|
89
|
+
*/
|
|
90
|
+
batchCreateContacts(ctx: RunActionCtx, contacts: ContactData[]): Promise<{
|
|
91
|
+
created?: number;
|
|
92
|
+
failed?: number;
|
|
93
|
+
results?: Array<{
|
|
94
|
+
email: string;
|
|
95
|
+
error?: string;
|
|
96
|
+
success: boolean;
|
|
97
|
+
}>;
|
|
98
|
+
success: boolean;
|
|
99
|
+
}>;
|
|
100
|
+
/**
|
|
101
|
+
* Unsubscribe a contact
|
|
102
|
+
* Unsubscribes a contact from receiving emails (they remain in the system)
|
|
103
|
+
*/
|
|
104
|
+
unsubscribeContact(ctx: RunActionCtx, email: string): Promise<{
|
|
105
|
+
success: boolean;
|
|
106
|
+
}>;
|
|
107
|
+
/**
|
|
108
|
+
* Resubscribe a contact
|
|
109
|
+
* Resubscribes a previously unsubscribed contact
|
|
110
|
+
*/
|
|
111
|
+
resubscribeContact(ctx: RunActionCtx, email: string): Promise<{
|
|
112
|
+
success: boolean;
|
|
113
|
+
}>;
|
|
114
|
+
/**
|
|
115
|
+
* Count contacts in the database
|
|
116
|
+
* Can filter by audience criteria (userGroup, source, subscribed status)
|
|
117
|
+
* This queries the component's local database, not Loops API
|
|
118
|
+
*/
|
|
119
|
+
countContacts(ctx: RunQueryCtx, options?: {
|
|
120
|
+
userGroup?: string;
|
|
121
|
+
source?: string;
|
|
122
|
+
subscribed?: boolean;
|
|
123
|
+
}): Promise<number>;
|
|
124
|
+
/**
|
|
125
|
+
* List contacts with cursor-based pagination and optional filters
|
|
126
|
+
* Returns actual contact data, not just a count
|
|
127
|
+
* This queries the component's local database, not Loops API
|
|
128
|
+
*
|
|
129
|
+
* Uses cursor-based pagination for efficiency. Pass the `continueCursor`
|
|
130
|
+
* from the previous response as `cursor` to get the next page.
|
|
131
|
+
*/
|
|
132
|
+
listContacts(ctx: RunQueryCtx, options?: {
|
|
133
|
+
userGroup?: string;
|
|
134
|
+
source?: string;
|
|
135
|
+
subscribed?: boolean;
|
|
136
|
+
limit?: number;
|
|
137
|
+
cursor?: string | null;
|
|
138
|
+
}): Promise<{
|
|
139
|
+
contacts: Array<{
|
|
140
|
+
_id: string;
|
|
141
|
+
createdAt: number;
|
|
142
|
+
email: string;
|
|
143
|
+
firstName?: string;
|
|
144
|
+
lastName?: string;
|
|
145
|
+
loopsContactId?: string;
|
|
146
|
+
source?: string;
|
|
147
|
+
subscribed: boolean;
|
|
148
|
+
updatedAt: number;
|
|
149
|
+
userGroup?: string;
|
|
150
|
+
userId?: string;
|
|
151
|
+
}>;
|
|
152
|
+
continueCursor: string | null;
|
|
153
|
+
isDone: boolean;
|
|
154
|
+
}>;
|
|
155
|
+
/**
|
|
156
|
+
* Detect spam patterns: emails sent to the same recipient too frequently
|
|
157
|
+
*/
|
|
158
|
+
detectRecipientSpam(ctx: RunQueryCtx, options?: {
|
|
159
|
+
timeWindowMs?: number;
|
|
160
|
+
maxEmailsPerRecipient?: number;
|
|
161
|
+
}): Promise<{
|
|
162
|
+
count: number;
|
|
163
|
+
email: string;
|
|
164
|
+
timeWindowMs: number;
|
|
165
|
+
}[]>;
|
|
166
|
+
/**
|
|
167
|
+
* Detect spam patterns: emails sent by the same actor/user too frequently
|
|
168
|
+
*/
|
|
169
|
+
detectActorSpam(ctx: RunQueryCtx, options?: {
|
|
170
|
+
timeWindowMs?: number;
|
|
171
|
+
maxEmailsPerActor?: number;
|
|
172
|
+
}): Promise<{
|
|
173
|
+
actorId: string;
|
|
174
|
+
count: number;
|
|
175
|
+
timeWindowMs: number;
|
|
176
|
+
}[]>;
|
|
177
|
+
/**
|
|
178
|
+
* Get email operation statistics for monitoring
|
|
179
|
+
*/
|
|
180
|
+
getEmailStats(ctx: RunQueryCtx, options?: {
|
|
181
|
+
timeWindowMs?: number;
|
|
182
|
+
}): Promise<{
|
|
183
|
+
failedOperations: number;
|
|
184
|
+
operationsByType: Record<string, number>;
|
|
185
|
+
successfulOperations: number;
|
|
186
|
+
totalOperations: number;
|
|
187
|
+
uniqueActors: number;
|
|
188
|
+
uniqueRecipients: number;
|
|
189
|
+
}>;
|
|
190
|
+
/**
|
|
191
|
+
* Detect rapid-fire email sending patterns
|
|
192
|
+
*/
|
|
193
|
+
detectRapidFirePatterns(ctx: RunQueryCtx, options?: {
|
|
194
|
+
timeWindowMs?: number;
|
|
195
|
+
minEmailsInWindow?: number;
|
|
196
|
+
}): Promise<{
|
|
197
|
+
actorId?: string;
|
|
198
|
+
count: number;
|
|
199
|
+
email?: string;
|
|
200
|
+
firstTimestamp: number;
|
|
201
|
+
lastTimestamp: number;
|
|
202
|
+
timeWindowMs: number;
|
|
203
|
+
}[]>;
|
|
204
|
+
/**
|
|
205
|
+
* Check if an email can be sent to a recipient based on rate limits
|
|
206
|
+
*/
|
|
207
|
+
checkRecipientRateLimit(ctx: RunQueryCtx, options: {
|
|
208
|
+
email: string;
|
|
209
|
+
timeWindowMs: number;
|
|
210
|
+
maxEmails: number;
|
|
211
|
+
}): Promise<{
|
|
212
|
+
allowed: boolean;
|
|
213
|
+
count: number;
|
|
214
|
+
limit: number;
|
|
215
|
+
retryAfter?: number;
|
|
216
|
+
timeWindowMs: number;
|
|
217
|
+
}>;
|
|
218
|
+
/**
|
|
219
|
+
* Check if an actor/user can send more emails based on rate limits
|
|
220
|
+
*/
|
|
221
|
+
checkActorRateLimit(ctx: RunQueryCtx, options: {
|
|
222
|
+
actorId: string;
|
|
223
|
+
timeWindowMs: number;
|
|
224
|
+
maxEmails: number;
|
|
225
|
+
}): Promise<{
|
|
226
|
+
allowed: boolean;
|
|
227
|
+
count: number;
|
|
228
|
+
limit: number;
|
|
229
|
+
retryAfter?: number;
|
|
230
|
+
timeWindowMs: number;
|
|
231
|
+
}>;
|
|
232
|
+
/**
|
|
233
|
+
* Check global email sending rate limit
|
|
234
|
+
*/
|
|
235
|
+
checkGlobalRateLimit(ctx: RunQueryCtx, options: {
|
|
236
|
+
timeWindowMs: number;
|
|
237
|
+
maxEmails: number;
|
|
238
|
+
}): Promise<{
|
|
239
|
+
allowed: boolean;
|
|
240
|
+
count: number;
|
|
241
|
+
limit: number;
|
|
242
|
+
timeWindowMs: number;
|
|
243
|
+
}>;
|
|
244
|
+
/**
|
|
245
|
+
* Delete a contact from Loops
|
|
246
|
+
*/
|
|
247
|
+
deleteContact(ctx: RunActionCtx, email: string): Promise<{
|
|
248
|
+
success: boolean;
|
|
249
|
+
}>;
|
|
250
|
+
/**
|
|
251
|
+
* Trigger a loop for a contact
|
|
252
|
+
* Loops are automated email sequences that can be triggered by events
|
|
253
|
+
*
|
|
254
|
+
* Note: Loops.so doesn't have a direct loop trigger endpoint.
|
|
255
|
+
* Loops are triggered through events. Make sure your loop is configured
|
|
256
|
+
* in the Loops dashboard to listen for events.
|
|
257
|
+
*
|
|
258
|
+
* @param options.eventName - Optional event name. If not provided, uses `loop_{loopId}`
|
|
259
|
+
*/
|
|
260
|
+
triggerLoop(ctx: RunActionCtx, options: {
|
|
261
|
+
loopId: string;
|
|
262
|
+
email: string;
|
|
263
|
+
dataVariables?: Record<string, unknown>;
|
|
264
|
+
eventName?: string;
|
|
265
|
+
}): Promise<{
|
|
266
|
+
success: boolean;
|
|
267
|
+
warning?: string;
|
|
268
|
+
}>;
|
|
269
|
+
/**
|
|
270
|
+
* Backfill the contact aggregate with existing contacts.
|
|
271
|
+
* Run this after upgrading to a version with aggregate support.
|
|
272
|
+
*
|
|
273
|
+
* This processes contacts in batches to avoid timeout issues with large datasets.
|
|
274
|
+
* Call repeatedly with the returned cursor until isDone is true.
|
|
275
|
+
*
|
|
276
|
+
* Usage:
|
|
277
|
+
* ```ts
|
|
278
|
+
* // First call - clear existing aggregate and start backfill
|
|
279
|
+
* let result = await loops.backfillContactAggregate(ctx, { clear: true });
|
|
280
|
+
*
|
|
281
|
+
* // Continue until done
|
|
282
|
+
* while (!result.isDone) {
|
|
283
|
+
* result = await loops.backfillContactAggregate(ctx, { cursor: result.cursor });
|
|
284
|
+
* }
|
|
285
|
+
* ```
|
|
286
|
+
*/
|
|
287
|
+
backfillContactAggregate(ctx: RunMutationCtx, options?: {
|
|
288
|
+
cursor?: string | null;
|
|
289
|
+
batchSize?: number;
|
|
290
|
+
clear?: boolean;
|
|
291
|
+
}): Promise<{
|
|
292
|
+
cursor: string | null;
|
|
293
|
+
isDone: boolean;
|
|
294
|
+
processed: number;
|
|
295
|
+
}>;
|
|
296
|
+
/**
|
|
297
|
+
* For easy re-exporting.
|
|
298
|
+
* Apps can do
|
|
299
|
+
* ```ts
|
|
300
|
+
* export const { addContact, sendTransactional, sendEvent, triggerLoop } = loops.api();
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
api(): {
|
|
304
|
+
addContact: import("convex/server").RegisteredAction<"public", {
|
|
305
|
+
firstName?: string | undefined;
|
|
306
|
+
lastName?: string | undefined;
|
|
307
|
+
userId?: string | undefined;
|
|
308
|
+
source?: string | undefined;
|
|
309
|
+
subscribed?: boolean | undefined;
|
|
310
|
+
userGroup?: string | undefined;
|
|
311
|
+
email: string;
|
|
312
|
+
}, Promise<{
|
|
313
|
+
id?: string;
|
|
314
|
+
success: boolean;
|
|
315
|
+
}>>;
|
|
316
|
+
updateContact: import("convex/server").RegisteredAction<"public", {
|
|
317
|
+
firstName?: string | undefined;
|
|
318
|
+
lastName?: string | undefined;
|
|
319
|
+
userId?: string | undefined;
|
|
320
|
+
source?: string | undefined;
|
|
321
|
+
subscribed?: boolean | undefined;
|
|
322
|
+
userGroup?: string | undefined;
|
|
323
|
+
dataVariables?: any;
|
|
324
|
+
email: string;
|
|
325
|
+
}, Promise<{
|
|
326
|
+
success: boolean;
|
|
327
|
+
}>>;
|
|
328
|
+
sendTransactional: import("convex/server").RegisteredAction<"public", {
|
|
329
|
+
dataVariables?: any;
|
|
330
|
+
idempotencyKey?: string | undefined;
|
|
331
|
+
email: string;
|
|
332
|
+
transactionalId: string;
|
|
333
|
+
}, Promise<{
|
|
334
|
+
messageId?: string;
|
|
335
|
+
success: boolean;
|
|
336
|
+
}>>;
|
|
337
|
+
sendEvent: import("convex/server").RegisteredAction<"public", {
|
|
338
|
+
eventProperties?: any;
|
|
339
|
+
email: string;
|
|
340
|
+
eventName: string;
|
|
341
|
+
}, Promise<{
|
|
342
|
+
success: boolean;
|
|
343
|
+
}>>;
|
|
344
|
+
deleteContact: import("convex/server").RegisteredAction<"public", {
|
|
345
|
+
email: string;
|
|
346
|
+
}, Promise<{
|
|
347
|
+
success: boolean;
|
|
348
|
+
}>>;
|
|
349
|
+
triggerLoop: import("convex/server").RegisteredAction<"public", {
|
|
350
|
+
dataVariables?: any;
|
|
351
|
+
email: string;
|
|
352
|
+
loopId: string;
|
|
353
|
+
}, Promise<{
|
|
354
|
+
success: boolean;
|
|
355
|
+
warning?: string;
|
|
356
|
+
}>>;
|
|
357
|
+
findContact: import("convex/server").RegisteredAction<"public", {
|
|
358
|
+
email: string;
|
|
359
|
+
}, Promise<{
|
|
360
|
+
contact?: {
|
|
361
|
+
createdAt?: string | null;
|
|
362
|
+
email?: string | null;
|
|
363
|
+
firstName?: string | null;
|
|
364
|
+
id?: string | null;
|
|
365
|
+
lastName?: string | null;
|
|
366
|
+
source?: string | null;
|
|
367
|
+
subscribed?: boolean | null;
|
|
368
|
+
userGroup?: string | null;
|
|
369
|
+
userId?: string | null;
|
|
370
|
+
};
|
|
371
|
+
success: boolean;
|
|
372
|
+
}>>;
|
|
373
|
+
batchCreateContacts: import("convex/server").RegisteredAction<"public", {
|
|
374
|
+
contacts: {
|
|
375
|
+
firstName?: string | undefined;
|
|
376
|
+
lastName?: string | undefined;
|
|
377
|
+
userId?: string | undefined;
|
|
378
|
+
source?: string | undefined;
|
|
379
|
+
subscribed?: boolean | undefined;
|
|
380
|
+
userGroup?: string | undefined;
|
|
381
|
+
email: string;
|
|
382
|
+
}[];
|
|
383
|
+
}, Promise<{
|
|
384
|
+
created?: number;
|
|
385
|
+
failed?: number;
|
|
386
|
+
results?: Array<{
|
|
387
|
+
email: string;
|
|
388
|
+
error?: string;
|
|
389
|
+
success: boolean;
|
|
390
|
+
}>;
|
|
391
|
+
success: boolean;
|
|
392
|
+
}>>;
|
|
393
|
+
unsubscribeContact: import("convex/server").RegisteredAction<"public", {
|
|
394
|
+
email: string;
|
|
395
|
+
}, Promise<{
|
|
396
|
+
success: boolean;
|
|
397
|
+
}>>;
|
|
398
|
+
resubscribeContact: import("convex/server").RegisteredAction<"public", {
|
|
399
|
+
email: string;
|
|
400
|
+
}, Promise<{
|
|
401
|
+
success: boolean;
|
|
402
|
+
}>>;
|
|
403
|
+
countContacts: import("convex/server").RegisteredQuery<"public", {
|
|
404
|
+
source?: string | undefined;
|
|
405
|
+
subscribed?: boolean | undefined;
|
|
406
|
+
userGroup?: string | undefined;
|
|
407
|
+
}, Promise<number>>;
|
|
408
|
+
listContacts: import("convex/server").RegisteredQuery<"public", {
|
|
409
|
+
source?: string | undefined;
|
|
410
|
+
subscribed?: boolean | undefined;
|
|
411
|
+
userGroup?: string | undefined;
|
|
412
|
+
cursor?: string | null | undefined;
|
|
413
|
+
limit?: number | undefined;
|
|
414
|
+
}, Promise<{
|
|
415
|
+
contacts: Array<{
|
|
416
|
+
_id: string;
|
|
417
|
+
createdAt: number;
|
|
418
|
+
email: string;
|
|
419
|
+
firstName?: string;
|
|
420
|
+
lastName?: string;
|
|
421
|
+
loopsContactId?: string;
|
|
422
|
+
source?: string;
|
|
423
|
+
subscribed: boolean;
|
|
424
|
+
updatedAt: number;
|
|
425
|
+
userGroup?: string;
|
|
426
|
+
userId?: string;
|
|
427
|
+
}>;
|
|
428
|
+
continueCursor: string | null;
|
|
429
|
+
isDone: boolean;
|
|
430
|
+
}>>;
|
|
431
|
+
detectRecipientSpam: import("convex/server").RegisteredQuery<"public", {
|
|
432
|
+
timeWindowMs?: number | undefined;
|
|
433
|
+
maxEmailsPerRecipient?: number | undefined;
|
|
434
|
+
}, Promise<{
|
|
435
|
+
count: number;
|
|
436
|
+
email: string;
|
|
437
|
+
timeWindowMs: number;
|
|
438
|
+
}[]>>;
|
|
439
|
+
detectActorSpam: import("convex/server").RegisteredQuery<"public", {
|
|
440
|
+
timeWindowMs?: number | undefined;
|
|
441
|
+
maxEmailsPerActor?: number | undefined;
|
|
442
|
+
}, Promise<{
|
|
443
|
+
actorId: string;
|
|
444
|
+
count: number;
|
|
445
|
+
timeWindowMs: number;
|
|
446
|
+
}[]>>;
|
|
447
|
+
getEmailStats: import("convex/server").RegisteredQuery<"public", {
|
|
448
|
+
timeWindowMs?: number | undefined;
|
|
449
|
+
}, Promise<{
|
|
450
|
+
failedOperations: number;
|
|
451
|
+
operationsByType: Record<string, number>;
|
|
452
|
+
successfulOperations: number;
|
|
453
|
+
totalOperations: number;
|
|
454
|
+
uniqueActors: number;
|
|
455
|
+
uniqueRecipients: number;
|
|
456
|
+
}>>;
|
|
457
|
+
detectRapidFirePatterns: import("convex/server").RegisteredQuery<"public", {
|
|
458
|
+
timeWindowMs?: number | undefined;
|
|
459
|
+
minEmailsInWindow?: number | undefined;
|
|
460
|
+
}, Promise<{
|
|
461
|
+
actorId?: string;
|
|
462
|
+
count: number;
|
|
463
|
+
email?: string;
|
|
464
|
+
firstTimestamp: number;
|
|
465
|
+
lastTimestamp: number;
|
|
466
|
+
timeWindowMs: number;
|
|
467
|
+
}[]>>;
|
|
468
|
+
checkRecipientRateLimit: import("convex/server").RegisteredQuery<"public", {
|
|
469
|
+
email: string;
|
|
470
|
+
maxEmails: number;
|
|
471
|
+
timeWindowMs: number;
|
|
472
|
+
}, Promise<{
|
|
473
|
+
allowed: boolean;
|
|
474
|
+
count: number;
|
|
475
|
+
limit: number;
|
|
476
|
+
retryAfter?: number;
|
|
477
|
+
timeWindowMs: number;
|
|
478
|
+
}>>;
|
|
479
|
+
checkActorRateLimit: import("convex/server").RegisteredQuery<"public", {
|
|
480
|
+
actorId: string;
|
|
481
|
+
maxEmails: number;
|
|
482
|
+
timeWindowMs: number;
|
|
483
|
+
}, Promise<{
|
|
484
|
+
allowed: boolean;
|
|
485
|
+
count: number;
|
|
486
|
+
limit: number;
|
|
487
|
+
retryAfter?: number;
|
|
488
|
+
timeWindowMs: number;
|
|
489
|
+
}>>;
|
|
490
|
+
checkGlobalRateLimit: import("convex/server").RegisteredQuery<"public", {
|
|
491
|
+
maxEmails: number;
|
|
492
|
+
timeWindowMs: number;
|
|
493
|
+
}, Promise<{
|
|
494
|
+
allowed: boolean;
|
|
495
|
+
count: number;
|
|
496
|
+
limit: number;
|
|
497
|
+
timeWindowMs: number;
|
|
498
|
+
}>>;
|
|
499
|
+
backfillContactAggregate: import("convex/server").RegisteredMutation<"public", {
|
|
500
|
+
batchSize?: number | undefined;
|
|
501
|
+
clear?: boolean | undefined;
|
|
502
|
+
cursor?: string | null | undefined;
|
|
503
|
+
}, Promise<{
|
|
504
|
+
cursor: string | null;
|
|
505
|
+
isDone: boolean;
|
|
506
|
+
processed: number;
|
|
507
|
+
}>>;
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,UA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