@devwithbobby/loops 0.1.12 → 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.
- package/dist/client/index.d.ts +110 -37
- package/dist/client/index.d.ts.map +1 -1
- package/dist/component/convex.config.d.ts +1 -1
- package/dist/component/convex.config.d.ts.map +1 -1
- package/dist/component/lib.d.ts +237 -22
- package/dist/component/lib.d.ts.map +1 -1
- package/dist/component/lib.js +47 -29
- package/dist/component/schema.d.ts +66 -1
- package/dist/component/schema.d.ts.map +1 -1
- package/dist/component/tables/contacts.d.ts +123 -1
- package/dist/component/tables/contacts.d.ts.map +1 -1
- package/dist/component/tables/emailOperations.d.ts +151 -1
- package/dist/component/tables/emailOperations.d.ts.map +1 -1
- package/dist/component/tables/emailOperations.js +1 -6
- package/dist/component/validators.d.ts +20 -3
- package/dist/component/validators.d.ts.map +1 -1
- package/dist/utils.d.ts +186 -3
- package/dist/utils.d.ts.map +1 -1
- package/package.json +101 -101
- package/src/client/index.ts +31 -16
- package/src/component/lib.ts +146 -98
- package/src/component/tables/contacts.ts +0 -1
- package/src/component/tables/emailOperations.ts +1 -7
- package/src/component/validators.ts +0 -1
package/dist/client/index.d.ts
CHANGED
|
@@ -32,41 +32,41 @@ export declare class Loops {
|
|
|
32
32
|
/**
|
|
33
33
|
* Add or update a contact in Loops
|
|
34
34
|
*/
|
|
35
|
-
addContact(ctx: RunActionCtx, contact: ContactData): Promise<
|
|
35
|
+
addContact(ctx: RunActionCtx, contact: ContactData): Promise<any>;
|
|
36
36
|
/**
|
|
37
37
|
* Update an existing contact in Loops
|
|
38
38
|
*/
|
|
39
39
|
updateContact(ctx: RunActionCtx, email: string, updates: Partial<ContactData> & {
|
|
40
40
|
dataVariables?: Record<string, any>;
|
|
41
|
-
}): Promise<
|
|
41
|
+
}): Promise<any>;
|
|
42
42
|
/**
|
|
43
43
|
* Send a transactional email using a transactional ID
|
|
44
44
|
*/
|
|
45
|
-
sendTransactional(ctx: RunActionCtx, options: TransactionalEmailOptions): Promise<
|
|
45
|
+
sendTransactional(ctx: RunActionCtx, options: TransactionalEmailOptions): Promise<any>;
|
|
46
46
|
/**
|
|
47
47
|
* Send an event to Loops to trigger email workflows
|
|
48
48
|
*/
|
|
49
|
-
sendEvent(ctx: RunActionCtx, options: EventOptions): Promise<
|
|
49
|
+
sendEvent(ctx: RunActionCtx, options: EventOptions): Promise<any>;
|
|
50
50
|
/**
|
|
51
51
|
* Find a contact by email
|
|
52
52
|
* Retrieves contact information from Loops
|
|
53
53
|
*/
|
|
54
|
-
findContact(ctx: RunActionCtx, email: string): Promise<
|
|
54
|
+
findContact(ctx: RunActionCtx, email: string): Promise<any>;
|
|
55
55
|
/**
|
|
56
56
|
* Batch create contacts
|
|
57
57
|
* Create multiple contacts in a single API call
|
|
58
58
|
*/
|
|
59
|
-
batchCreateContacts(ctx: RunActionCtx, contacts: ContactData[]): Promise<
|
|
59
|
+
batchCreateContacts(ctx: RunActionCtx, contacts: ContactData[]): Promise<any>;
|
|
60
60
|
/**
|
|
61
61
|
* Unsubscribe a contact
|
|
62
62
|
* Unsubscribes a contact from receiving emails (they remain in the system)
|
|
63
63
|
*/
|
|
64
|
-
unsubscribeContact(ctx: RunActionCtx, email: string): Promise<
|
|
64
|
+
unsubscribeContact(ctx: RunActionCtx, email: string): Promise<any>;
|
|
65
65
|
/**
|
|
66
66
|
* Resubscribe a contact
|
|
67
67
|
* Resubscribes a previously unsubscribed contact
|
|
68
68
|
*/
|
|
69
|
-
resubscribeContact(ctx: RunActionCtx, email: string): Promise<
|
|
69
|
+
resubscribeContact(ctx: RunActionCtx, email: string): Promise<any>;
|
|
70
70
|
/**
|
|
71
71
|
* Count contacts in the database
|
|
72
72
|
* Can filter by audience criteria (userGroup, source, subscribed status)
|
|
@@ -76,7 +76,7 @@ export declare class Loops {
|
|
|
76
76
|
userGroup?: string;
|
|
77
77
|
source?: string;
|
|
78
78
|
subscribed?: boolean;
|
|
79
|
-
}): Promise<
|
|
79
|
+
}): Promise<any>;
|
|
80
80
|
/**
|
|
81
81
|
* List contacts with pagination and optional filters
|
|
82
82
|
* Returns actual contact data, not just a count
|
|
@@ -88,34 +88,34 @@ export declare class Loops {
|
|
|
88
88
|
subscribed?: boolean;
|
|
89
89
|
limit?: number;
|
|
90
90
|
offset?: number;
|
|
91
|
-
}): Promise<
|
|
91
|
+
}): Promise<any>;
|
|
92
92
|
/**
|
|
93
93
|
* Detect spam patterns: emails sent to the same recipient too frequently
|
|
94
94
|
*/
|
|
95
95
|
detectRecipientSpam(ctx: RunQueryCtx, options?: {
|
|
96
96
|
timeWindowMs?: number;
|
|
97
97
|
maxEmailsPerRecipient?: number;
|
|
98
|
-
}): Promise<
|
|
98
|
+
}): Promise<any>;
|
|
99
99
|
/**
|
|
100
100
|
* Detect spam patterns: emails sent by the same actor/user too frequently
|
|
101
101
|
*/
|
|
102
102
|
detectActorSpam(ctx: RunQueryCtx, options?: {
|
|
103
103
|
timeWindowMs?: number;
|
|
104
104
|
maxEmailsPerActor?: number;
|
|
105
|
-
}): Promise<
|
|
105
|
+
}): Promise<any>;
|
|
106
106
|
/**
|
|
107
107
|
* Get email operation statistics for monitoring
|
|
108
108
|
*/
|
|
109
109
|
getEmailStats(ctx: RunQueryCtx, options?: {
|
|
110
110
|
timeWindowMs?: number;
|
|
111
|
-
}): Promise<
|
|
111
|
+
}): Promise<any>;
|
|
112
112
|
/**
|
|
113
113
|
* Detect rapid-fire email sending patterns
|
|
114
114
|
*/
|
|
115
115
|
detectRapidFirePatterns(ctx: RunQueryCtx, options?: {
|
|
116
116
|
timeWindowMs?: number;
|
|
117
117
|
minEmailsInWindow?: number;
|
|
118
|
-
}): Promise<
|
|
118
|
+
}): Promise<any>;
|
|
119
119
|
/**
|
|
120
120
|
* Check if an email can be sent to a recipient based on rate limits
|
|
121
121
|
*/
|
|
@@ -123,7 +123,7 @@ export declare class Loops {
|
|
|
123
123
|
email: string;
|
|
124
124
|
timeWindowMs: number;
|
|
125
125
|
maxEmails: number;
|
|
126
|
-
}): Promise<
|
|
126
|
+
}): Promise<any>;
|
|
127
127
|
/**
|
|
128
128
|
* Check if an actor/user can send more emails based on rate limits
|
|
129
129
|
*/
|
|
@@ -131,18 +131,18 @@ export declare class Loops {
|
|
|
131
131
|
actorId: string;
|
|
132
132
|
timeWindowMs: number;
|
|
133
133
|
maxEmails: number;
|
|
134
|
-
}): Promise<
|
|
134
|
+
}): Promise<any>;
|
|
135
135
|
/**
|
|
136
136
|
* Check global email sending rate limit
|
|
137
137
|
*/
|
|
138
138
|
checkGlobalRateLimit(ctx: RunQueryCtx, options: {
|
|
139
139
|
timeWindowMs: number;
|
|
140
140
|
maxEmails: number;
|
|
141
|
-
}): Promise<
|
|
141
|
+
}): Promise<any>;
|
|
142
142
|
/**
|
|
143
143
|
* Delete a contact from Loops
|
|
144
144
|
*/
|
|
145
|
-
deleteContact(ctx: RunActionCtx, email: string): Promise<
|
|
145
|
+
deleteContact(ctx: RunActionCtx, email: string): Promise<any>;
|
|
146
146
|
/**
|
|
147
147
|
* Trigger a loop for a contact
|
|
148
148
|
* Loops are automated email sequences that can be triggered by events
|
|
@@ -158,7 +158,7 @@ export declare class Loops {
|
|
|
158
158
|
email: string;
|
|
159
159
|
dataVariables?: Record<string, any>;
|
|
160
160
|
eventName?: string;
|
|
161
|
-
}): Promise<
|
|
161
|
+
}): Promise<any>;
|
|
162
162
|
/**
|
|
163
163
|
* For easy re-exporting.
|
|
164
164
|
* Apps can do
|
|
@@ -167,24 +167,97 @@ export declare class Loops {
|
|
|
167
167
|
* ```
|
|
168
168
|
*/
|
|
169
169
|
api(): {
|
|
170
|
-
addContact:
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
170
|
+
addContact: import("convex/server").RegisteredAction<"public", {
|
|
171
|
+
firstName?: string | undefined;
|
|
172
|
+
lastName?: string | undefined;
|
|
173
|
+
userId?: string | undefined;
|
|
174
|
+
source?: string | undefined;
|
|
175
|
+
subscribed?: boolean | undefined;
|
|
176
|
+
userGroup?: string | undefined;
|
|
177
|
+
email: string;
|
|
178
|
+
}, Promise<any>>;
|
|
179
|
+
updateContact: import("convex/server").RegisteredAction<"public", {
|
|
180
|
+
firstName?: string | undefined;
|
|
181
|
+
lastName?: string | undefined;
|
|
182
|
+
userId?: string | undefined;
|
|
183
|
+
source?: string | undefined;
|
|
184
|
+
subscribed?: boolean | undefined;
|
|
185
|
+
userGroup?: string | undefined;
|
|
186
|
+
dataVariables?: any;
|
|
187
|
+
email: string;
|
|
188
|
+
}, Promise<any>>;
|
|
189
|
+
sendTransactional: import("convex/server").RegisteredAction<"public", {
|
|
190
|
+
dataVariables?: any;
|
|
191
|
+
email: string;
|
|
192
|
+
transactionalId: string;
|
|
193
|
+
}, Promise<any>>;
|
|
194
|
+
sendEvent: import("convex/server").RegisteredAction<"public", {
|
|
195
|
+
eventProperties?: any;
|
|
196
|
+
email: string;
|
|
197
|
+
eventName: string;
|
|
198
|
+
}, Promise<any>>;
|
|
199
|
+
deleteContact: import("convex/server").RegisteredAction<"public", {
|
|
200
|
+
email: string;
|
|
201
|
+
}, Promise<any>>;
|
|
202
|
+
triggerLoop: import("convex/server").RegisteredAction<"public", {
|
|
203
|
+
dataVariables?: any;
|
|
204
|
+
email: string;
|
|
205
|
+
loopId: string;
|
|
206
|
+
}, Promise<any>>;
|
|
207
|
+
findContact: import("convex/server").RegisteredAction<"public", {
|
|
208
|
+
email: string;
|
|
209
|
+
}, Promise<any>>;
|
|
210
|
+
batchCreateContacts: import("convex/server").RegisteredAction<"public", {
|
|
211
|
+
contacts: {
|
|
212
|
+
firstName?: string | undefined;
|
|
213
|
+
lastName?: string | undefined;
|
|
214
|
+
userId?: string | undefined;
|
|
215
|
+
source?: string | undefined;
|
|
216
|
+
subscribed?: boolean | undefined;
|
|
217
|
+
userGroup?: string | undefined;
|
|
218
|
+
email: string;
|
|
219
|
+
}[];
|
|
220
|
+
}, Promise<any>>;
|
|
221
|
+
unsubscribeContact: import("convex/server").RegisteredAction<"public", {
|
|
222
|
+
email: string;
|
|
223
|
+
}, Promise<any>>;
|
|
224
|
+
resubscribeContact: import("convex/server").RegisteredAction<"public", {
|
|
225
|
+
email: string;
|
|
226
|
+
}, Promise<any>>;
|
|
227
|
+
countContacts: import("convex/server").RegisteredQuery<"public", {
|
|
228
|
+
source?: string | undefined;
|
|
229
|
+
subscribed?: boolean | undefined;
|
|
230
|
+
userGroup?: string | undefined;
|
|
231
|
+
}, Promise<any>>;
|
|
232
|
+
detectRecipientSpam: import("convex/server").RegisteredQuery<"public", {
|
|
233
|
+
timeWindowMs?: number | undefined;
|
|
234
|
+
maxEmailsPerRecipient?: number | undefined;
|
|
235
|
+
}, Promise<any>>;
|
|
236
|
+
detectActorSpam: import("convex/server").RegisteredQuery<"public", {
|
|
237
|
+
timeWindowMs?: number | undefined;
|
|
238
|
+
maxEmailsPerActor?: number | undefined;
|
|
239
|
+
}, Promise<any>>;
|
|
240
|
+
getEmailStats: import("convex/server").RegisteredQuery<"public", {
|
|
241
|
+
timeWindowMs?: number | undefined;
|
|
242
|
+
}, Promise<any>>;
|
|
243
|
+
detectRapidFirePatterns: import("convex/server").RegisteredQuery<"public", {
|
|
244
|
+
timeWindowMs?: number | undefined;
|
|
245
|
+
minEmailsInWindow?: number | undefined;
|
|
246
|
+
}, Promise<any>>;
|
|
247
|
+
checkRecipientRateLimit: import("convex/server").RegisteredQuery<"public", {
|
|
248
|
+
email: string;
|
|
249
|
+
timeWindowMs: number;
|
|
250
|
+
maxEmails: number;
|
|
251
|
+
}, Promise<any>>;
|
|
252
|
+
checkActorRateLimit: import("convex/server").RegisteredQuery<"public", {
|
|
253
|
+
actorId: string;
|
|
254
|
+
timeWindowMs: number;
|
|
255
|
+
maxEmails: number;
|
|
256
|
+
}, Promise<any>>;
|
|
257
|
+
checkGlobalRateLimit: import("convex/server").RegisteredQuery<"public", {
|
|
258
|
+
timeWindowMs: number;
|
|
259
|
+
maxEmails: number;
|
|
260
|
+
}, Promise<any>>;
|
|
188
261
|
};
|
|
189
262
|
}
|
|
190
263
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAE5C,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,yBAAyB;IACzC,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,YAAY;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACtC;AAED,qBAAa,KAAK;IACjB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiB;IAC3C,SAAgB,OAAO,CAAC,EAAE;QACzB,MAAM,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;OAEG;IACG,oBAAoB,CACzB,GAAG,EAAE,WAAW,EAChB,OAAO,EAAE;QACR,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;KAClB;IAQF;;OAEG;IACG,aAAa,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM;IAOpD;;;;;;;;;OASG;IACG,WAAW,CAChB,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE;QACR,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACpC,SAAS,CAAC,EAAE,MAAM,CAAC;KACnB;IAQF;;;;;;OAMG;IACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4LH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convex.config.d.ts","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"convex.config.d.ts","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,SAAS,kDAA2B,CAAC;AAuB3C,eAAe,SAAS,CAAC"}
|
package/dist/component/lib.d.ts
CHANGED
|
@@ -1,48 +1,144 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal mutation to store/update a contact in the database
|
|
3
3
|
*/
|
|
4
|
-
export declare const storeContact:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
136
|
+
export declare const deleteContact: import("convex/server").RegisteredAction<"public", {
|
|
137
|
+
apiKey: string;
|
|
138
|
+
email: string;
|
|
139
|
+
}, Promise<{
|
|
140
|
+
success: boolean;
|
|
141
|
+
}>>;
|
|
46
142
|
/**
|
|
47
143
|
* Trigger a loop for a contact
|
|
48
144
|
* Note: Loops in Loops.so are triggered through events, not a direct API endpoint.
|
|
@@ -59,61 +155,180 @@ export declare const deleteContact: any;
|
|
|
59
155
|
*
|
|
60
156
|
* This function is kept for backwards compatibility but works by sending an event.
|
|
61
157
|
*/
|
|
62
|
-
export declare const triggerLoop:
|
|
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
|
+
}>>;
|
|
63
168
|
/**
|
|
64
169
|
* Find a contact by email
|
|
65
170
|
* Retrieves contact information from Loops
|
|
66
171
|
* Note: Loops API may return either an object or an array
|
|
67
172
|
*/
|
|
68
|
-
export declare const findContact:
|
|
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
|
+
}>>;
|
|
69
190
|
/**
|
|
70
191
|
* Batch create contacts
|
|
71
192
|
* Creates multiple contacts sequentially using the single contact create endpoint.
|
|
72
193
|
* Note: Loops.so doesn't have a batch endpoint, so we create contacts one by one.
|
|
73
194
|
*/
|
|
74
|
-
export declare const batchCreateContacts:
|
|
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
|
+
}>>;
|
|
75
216
|
/**
|
|
76
217
|
* Unsubscribe a contact
|
|
77
218
|
* Unsubscribes a contact from receiving emails (they remain in the system)
|
|
78
219
|
*/
|
|
79
|
-
export declare const unsubscribeContact:
|
|
220
|
+
export declare const unsubscribeContact: import("convex/server").RegisteredAction<"public", {
|
|
221
|
+
apiKey: string;
|
|
222
|
+
email: string;
|
|
223
|
+
}, Promise<{
|
|
224
|
+
success: boolean;
|
|
225
|
+
}>>;
|
|
80
226
|
/**
|
|
81
227
|
* Resubscribe a contact
|
|
82
228
|
* Resubscribes a previously unsubscribed contact
|
|
83
229
|
*/
|
|
84
|
-
export declare const resubscribeContact:
|
|
230
|
+
export declare const resubscribeContact: import("convex/server").RegisteredAction<"public", {
|
|
231
|
+
apiKey: string;
|
|
232
|
+
email: string;
|
|
233
|
+
}, Promise<{
|
|
234
|
+
success: boolean;
|
|
235
|
+
}>>;
|
|
85
236
|
/**
|
|
86
237
|
* Check for spam patterns: too many emails to the same recipient in a time window
|
|
87
238
|
* Returns email addresses that received too many emails
|
|
88
239
|
*/
|
|
89
|
-
export declare const detectRecipientSpam:
|
|
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
|
+
}[]>>;
|
|
90
249
|
/**
|
|
91
250
|
* Check for spam patterns: too many emails from the same actor/user
|
|
92
251
|
* Returns actor IDs that sent too many emails
|
|
93
252
|
*/
|
|
94
|
-
export declare const detectActorSpam:
|
|
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
|
+
}[]>>;
|
|
95
261
|
/**
|
|
96
262
|
* Get recent email operation statistics for monitoring
|
|
97
263
|
*/
|
|
98
|
-
export declare const getEmailStats:
|
|
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
|
+
}>>;
|
|
99
275
|
/**
|
|
100
276
|
* Detect rapid-fire email sending patterns (multiple emails sent in quick succession)
|
|
101
277
|
* Returns suspicious patterns indicating potential spam
|
|
102
278
|
*/
|
|
103
|
-
export declare const detectRapidFirePatterns:
|
|
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
|
+
}[]>>;
|
|
104
290
|
/**
|
|
105
291
|
* Rate limiting: Check if an email can be sent to a recipient
|
|
106
292
|
* Based on recent email operations in the database
|
|
107
293
|
*/
|
|
108
|
-
export declare const checkRecipientRateLimit:
|
|
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
|
+
}>>;
|
|
109
306
|
/**
|
|
110
307
|
* Rate limiting: Check if an actor/user can send more emails
|
|
111
308
|
* Based on recent email operations in the database
|
|
112
309
|
*/
|
|
113
|
-
export declare const checkActorRateLimit:
|
|
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
|
+
}>>;
|
|
114
321
|
/**
|
|
115
322
|
* Rate limiting: Check global email sending rate
|
|
116
323
|
* Checks total email operations across all senders
|
|
117
324
|
*/
|
|
118
|
-
export declare const checkGlobalRateLimit:
|
|
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
|
+
}>>;
|
|
119
334
|
//# sourceMappingURL=lib.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/component/lib.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/component/lib.ts"],"names":[],"mappings":"AA2BA;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;iBA6CvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa;;iBAexB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;iBAiC5B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;mBAwCxB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;GAmFvB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;GA4HrB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;GAoDxB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;GAqD5B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;GAgCpB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;GA8BxB,CAAC;AAEH;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW;;;;;;;;;GA4DtB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;GAgEtB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;GAiE9B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;GA+B7B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;GA+B7B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;KA8C9B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;KA4C1B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,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