@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.
- package/README.md +1 -24
- package/dist/client/index.d.ts +122 -52
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +15 -26
- package/dist/component/convex.config.d.ts +1 -1
- package/dist/component/convex.config.d.ts.map +1 -1
- package/dist/component/convex.config.js +0 -1
- package/dist/component/lib.d.ts +237 -29
- package/dist/component/lib.d.ts.map +1 -1
- package/dist/component/lib.js +47 -133
- 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 +56 -57
- package/src/component/convex.config.ts +0 -1
- package/src/component/lib.ts +146 -219
- 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/component/lib.js
CHANGED
|
@@ -6,7 +6,7 @@ const LOOPS_API_BASE_URL = "https://app.loops.so/api/v1";
|
|
|
6
6
|
/**
|
|
7
7
|
* Sanitize error messages to avoid leaking sensitive information
|
|
8
8
|
*/
|
|
9
|
-
const sanitizeError = (status,
|
|
9
|
+
const sanitizeError = (status, _errorText) => {
|
|
10
10
|
if (status === 401 || status === 403) {
|
|
11
11
|
return new Error("Authentication failed. Please check your API key.");
|
|
12
12
|
}
|
|
@@ -244,7 +244,12 @@ export const listContacts = zq({
|
|
|
244
244
|
// Sort by createdAt (newest first)
|
|
245
245
|
allContacts.sort((a, b) => b.createdAt - a.createdAt);
|
|
246
246
|
const total = allContacts.length;
|
|
247
|
-
const paginatedContacts = allContacts
|
|
247
|
+
const paginatedContacts = allContacts
|
|
248
|
+
.slice(args.offset, args.offset + args.limit)
|
|
249
|
+
.map((contact) => ({
|
|
250
|
+
...contact,
|
|
251
|
+
subscribed: contact.subscribed ?? true, // Ensure subscribed is always boolean
|
|
252
|
+
}));
|
|
248
253
|
const hasMore = args.offset + args.limit < total;
|
|
249
254
|
return {
|
|
250
255
|
contacts: paginatedContacts,
|
|
@@ -321,7 +326,7 @@ export const addContact = za({
|
|
|
321
326
|
contactId = findData.id;
|
|
322
327
|
}
|
|
323
328
|
// Store/update in our database
|
|
324
|
-
await ctx.runMutation(
|
|
329
|
+
await ctx.runMutation(internal.lib.storeContact, {
|
|
325
330
|
email: args.contact.email,
|
|
326
331
|
firstName: args.contact.firstName,
|
|
327
332
|
lastName: args.contact.lastName,
|
|
@@ -342,7 +347,7 @@ export const addContact = za({
|
|
|
342
347
|
}
|
|
343
348
|
// Contact was created successfully
|
|
344
349
|
const data = (await response.json());
|
|
345
|
-
await ctx.runMutation(
|
|
350
|
+
await ctx.runMutation(internal.lib.storeContact, {
|
|
346
351
|
email: args.contact.email,
|
|
347
352
|
firstName: args.contact.firstName,
|
|
348
353
|
lastName: args.contact.lastName,
|
|
@@ -399,7 +404,7 @@ export const updateContact = za({
|
|
|
399
404
|
console.error(`Loops API error [${response.status}]:`, errorText);
|
|
400
405
|
throw sanitizeError(response.status, errorText);
|
|
401
406
|
}
|
|
402
|
-
await ctx.runMutation(
|
|
407
|
+
await ctx.runMutation(internal.lib.storeContact, {
|
|
403
408
|
email: args.email,
|
|
404
409
|
firstName: args.firstName,
|
|
405
410
|
lastName: args.lastName,
|
|
@@ -441,7 +446,7 @@ export const sendTransactional = za({
|
|
|
441
446
|
if (!response.ok) {
|
|
442
447
|
const errorText = await response.text();
|
|
443
448
|
console.error(`Loops API error [${response.status}]:`, errorText);
|
|
444
|
-
await ctx.runMutation(
|
|
449
|
+
await ctx.runMutation(internal.lib.logEmailOperation, {
|
|
445
450
|
operationType: "transactional",
|
|
446
451
|
email: args.email,
|
|
447
452
|
success: false,
|
|
@@ -450,7 +455,7 @@ export const sendTransactional = za({
|
|
|
450
455
|
throw sanitizeError(response.status, errorText);
|
|
451
456
|
}
|
|
452
457
|
const data = (await response.json());
|
|
453
|
-
await ctx.runMutation(
|
|
458
|
+
await ctx.runMutation(internal.lib.logEmailOperation, {
|
|
454
459
|
operationType: "transactional",
|
|
455
460
|
email: args.email,
|
|
456
461
|
success: true,
|
|
@@ -476,7 +481,7 @@ export const sendEvent = za({
|
|
|
476
481
|
returns: z.object({
|
|
477
482
|
success: z.boolean(),
|
|
478
483
|
}),
|
|
479
|
-
handler: async (
|
|
484
|
+
handler: async (_ctx, args) => {
|
|
480
485
|
const response = await fetch(`${LOOPS_API_BASE_URL}/events/send`, {
|
|
481
486
|
method: "POST",
|
|
482
487
|
headers: {
|
|
@@ -522,116 +527,12 @@ export const deleteContact = za({
|
|
|
522
527
|
console.error(`Loops API error [${response.status}]:`, errorText);
|
|
523
528
|
throw sanitizeError(response.status, errorText);
|
|
524
529
|
}
|
|
525
|
-
await ctx.runMutation(
|
|
530
|
+
await ctx.runMutation(internal.lib.removeContact, {
|
|
526
531
|
email: args.email,
|
|
527
532
|
});
|
|
528
533
|
return { success: true };
|
|
529
534
|
},
|
|
530
535
|
});
|
|
531
|
-
/**
|
|
532
|
-
* Send a campaign to contacts
|
|
533
|
-
* Note: Campaigns in Loops.so are typically managed from the dashboard.
|
|
534
|
-
* This function sends transactional emails to multiple contacts as a workaround.
|
|
535
|
-
* If you need true campaign functionality, use the Loops.so dashboard or contact their support.
|
|
536
|
-
*/
|
|
537
|
-
export const sendCampaign = za({
|
|
538
|
-
args: z.object({
|
|
539
|
-
apiKey: z.string(),
|
|
540
|
-
campaignId: z.string(),
|
|
541
|
-
emails: z.array(z.string().email()).optional(),
|
|
542
|
-
transactionalId: z.string().optional(),
|
|
543
|
-
dataVariables: z.record(z.string(), z.any()).optional(),
|
|
544
|
-
audienceFilters: z
|
|
545
|
-
.object({
|
|
546
|
-
userGroup: z.string().optional(),
|
|
547
|
-
source: z.string().optional(),
|
|
548
|
-
})
|
|
549
|
-
.optional(),
|
|
550
|
-
}),
|
|
551
|
-
returns: z.object({
|
|
552
|
-
success: z.boolean(),
|
|
553
|
-
messageId: z.string().optional(),
|
|
554
|
-
sent: z.number().optional(),
|
|
555
|
-
errors: z.array(z.object({
|
|
556
|
-
email: z.string(),
|
|
557
|
-
error: z.string(),
|
|
558
|
-
})).optional(),
|
|
559
|
-
}),
|
|
560
|
-
handler: async (ctx, args) => {
|
|
561
|
-
// Loops.so doesn't have a campaigns API endpoint
|
|
562
|
-
// As a workaround, we'll send transactional emails to the specified contacts
|
|
563
|
-
if (!args.transactionalId) {
|
|
564
|
-
throw new Error("Campaigns require a transactionalId. " +
|
|
565
|
-
"Loops.so campaigns are managed from the dashboard. " +
|
|
566
|
-
"This function sends transactional emails to multiple contacts as a workaround. " +
|
|
567
|
-
"Please provide a transactionalId to send emails.");
|
|
568
|
-
}
|
|
569
|
-
if (!args.emails || args.emails.length === 0) {
|
|
570
|
-
// If no emails provided but audienceFilters are, we need to query contacts
|
|
571
|
-
if (args.audienceFilters) {
|
|
572
|
-
// Query contacts from our database based on filters
|
|
573
|
-
const contacts = await ctx.runQuery((internal.lib).countContacts, {
|
|
574
|
-
userGroup: args.audienceFilters.userGroup,
|
|
575
|
-
source: args.audienceFilters.source,
|
|
576
|
-
});
|
|
577
|
-
if (contacts === 0) {
|
|
578
|
-
return {
|
|
579
|
-
success: false,
|
|
580
|
-
sent: 0,
|
|
581
|
-
errors: [{ email: "audience", error: "No contacts found matching filters" }],
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
// Note: We can't get email list from countContacts, so this is a limitation
|
|
585
|
-
throw new Error("Campaigns with audienceFilters require emails to be specified. " +
|
|
586
|
-
"Please provide the emails array with contacts to send to.");
|
|
587
|
-
}
|
|
588
|
-
throw new Error("Campaigns require either emails array or audienceFilters. " +
|
|
589
|
-
"Please provide at least one email address or use transactional emails for single contacts.");
|
|
590
|
-
}
|
|
591
|
-
// Send transactional emails to each contact as a workaround for campaigns
|
|
592
|
-
let sent = 0;
|
|
593
|
-
const errors = [];
|
|
594
|
-
for (const email of args.emails) {
|
|
595
|
-
try {
|
|
596
|
-
await ctx.runAction((internal.lib).sendTransactional, {
|
|
597
|
-
apiKey: args.apiKey,
|
|
598
|
-
transactionalId: args.transactionalId,
|
|
599
|
-
email,
|
|
600
|
-
dataVariables: args.dataVariables,
|
|
601
|
-
});
|
|
602
|
-
sent++;
|
|
603
|
-
// Log as campaign operation
|
|
604
|
-
await ctx.runMutation((internal.lib).logEmailOperation, {
|
|
605
|
-
operationType: "campaign",
|
|
606
|
-
email,
|
|
607
|
-
success: true,
|
|
608
|
-
campaignId: args.campaignId,
|
|
609
|
-
transactionalId: args.transactionalId,
|
|
610
|
-
});
|
|
611
|
-
}
|
|
612
|
-
catch (error) {
|
|
613
|
-
errors.push({
|
|
614
|
-
email,
|
|
615
|
-
error: error instanceof Error ? error.message : String(error),
|
|
616
|
-
});
|
|
617
|
-
// Log failed campaign operation
|
|
618
|
-
await ctx.runMutation((internal.lib).logEmailOperation, {
|
|
619
|
-
operationType: "campaign",
|
|
620
|
-
email,
|
|
621
|
-
success: false,
|
|
622
|
-
campaignId: args.campaignId,
|
|
623
|
-
transactionalId: args.transactionalId,
|
|
624
|
-
metadata: { error: error instanceof Error ? error.message : String(error) },
|
|
625
|
-
});
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
return {
|
|
629
|
-
success: sent > 0,
|
|
630
|
-
sent,
|
|
631
|
-
errors: errors.length > 0 ? errors : undefined,
|
|
632
|
-
};
|
|
633
|
-
},
|
|
634
|
-
});
|
|
635
536
|
/**
|
|
636
537
|
* Trigger a loop for a contact
|
|
637
538
|
* Note: Loops in Loops.so are triggered through events, not a direct API endpoint.
|
|
@@ -667,7 +568,7 @@ export const triggerLoop = za({
|
|
|
667
568
|
const eventName = args.eventName || `loop_${args.loopId}`;
|
|
668
569
|
try {
|
|
669
570
|
// Send event to trigger the loop
|
|
670
|
-
await ctx.runAction(
|
|
571
|
+
await ctx.runAction(internal.lib.sendEvent, {
|
|
671
572
|
apiKey: args.apiKey,
|
|
672
573
|
email: args.email,
|
|
673
574
|
eventName,
|
|
@@ -677,7 +578,7 @@ export const triggerLoop = za({
|
|
|
677
578
|
},
|
|
678
579
|
});
|
|
679
580
|
// Log as loop operation
|
|
680
|
-
await ctx.runMutation(
|
|
581
|
+
await ctx.runMutation(internal.lib.logEmailOperation, {
|
|
681
582
|
operationType: "loop",
|
|
682
583
|
email: args.email,
|
|
683
584
|
success: true,
|
|
@@ -691,13 +592,15 @@ export const triggerLoop = za({
|
|
|
691
592
|
}
|
|
692
593
|
catch (error) {
|
|
693
594
|
// Log failed loop operation
|
|
694
|
-
await ctx.runMutation(
|
|
595
|
+
await ctx.runMutation(internal.lib.logEmailOperation, {
|
|
695
596
|
operationType: "loop",
|
|
696
597
|
email: args.email,
|
|
697
598
|
success: false,
|
|
698
599
|
loopId: args.loopId,
|
|
699
600
|
eventName,
|
|
700
|
-
metadata: {
|
|
601
|
+
metadata: {
|
|
602
|
+
error: error instanceof Error ? error.message : String(error),
|
|
603
|
+
},
|
|
701
604
|
});
|
|
702
605
|
throw error;
|
|
703
606
|
}
|
|
@@ -729,7 +632,7 @@ export const findContact = za({
|
|
|
729
632
|
})
|
|
730
633
|
.optional(),
|
|
731
634
|
}),
|
|
732
|
-
handler: async (
|
|
635
|
+
handler: async (_ctx, args) => {
|
|
733
636
|
const response = await fetch(`${LOOPS_API_BASE_URL}/contacts/find?email=${encodeURIComponent(args.email)}`, {
|
|
734
637
|
method: "GET",
|
|
735
638
|
headers: {
|
|
@@ -750,7 +653,10 @@ export const findContact = za({
|
|
|
750
653
|
let contact = Array.isArray(data) ? data[0] : data;
|
|
751
654
|
// Convert null values to undefined for optional fields (Zod handles undefined but not null in optional())
|
|
752
655
|
if (contact) {
|
|
753
|
-
contact = Object.fromEntries(Object.entries(contact).map(([key, value]) => [
|
|
656
|
+
contact = Object.fromEntries(Object.entries(contact).map(([key, value]) => [
|
|
657
|
+
key,
|
|
658
|
+
value === null ? undefined : value,
|
|
659
|
+
]));
|
|
754
660
|
}
|
|
755
661
|
return {
|
|
756
662
|
success: true,
|
|
@@ -772,11 +678,13 @@ export const batchCreateContacts = za({
|
|
|
772
678
|
success: z.boolean(),
|
|
773
679
|
created: z.number().optional(),
|
|
774
680
|
failed: z.number().optional(),
|
|
775
|
-
results: z
|
|
681
|
+
results: z
|
|
682
|
+
.array(z.object({
|
|
776
683
|
email: z.string(),
|
|
777
684
|
success: z.boolean(),
|
|
778
685
|
error: z.string().optional(),
|
|
779
|
-
}))
|
|
686
|
+
}))
|
|
687
|
+
.optional(),
|
|
780
688
|
}),
|
|
781
689
|
handler: async (ctx, args) => {
|
|
782
690
|
let created = 0;
|
|
@@ -786,7 +694,7 @@ export const batchCreateContacts = za({
|
|
|
786
694
|
for (const contact of args.contacts) {
|
|
787
695
|
try {
|
|
788
696
|
// Use the addContact function which handles create/update logic
|
|
789
|
-
const result = await ctx.runAction(
|
|
697
|
+
const result = await ctx.runAction(internal.lib.addContact, {
|
|
790
698
|
apiKey: args.apiKey,
|
|
791
699
|
contact,
|
|
792
700
|
});
|
|
@@ -799,7 +707,7 @@ export const batchCreateContacts = za({
|
|
|
799
707
|
results.push({
|
|
800
708
|
email: contact.email,
|
|
801
709
|
success: false,
|
|
802
|
-
error: "Unknown error"
|
|
710
|
+
error: "Unknown error",
|
|
803
711
|
});
|
|
804
712
|
}
|
|
805
713
|
}
|
|
@@ -846,7 +754,7 @@ export const unsubscribeContact = za({
|
|
|
846
754
|
console.error(`Loops API error [${response.status}]:`, errorText);
|
|
847
755
|
throw sanitizeError(response.status, errorText);
|
|
848
756
|
}
|
|
849
|
-
await ctx.runMutation(
|
|
757
|
+
await ctx.runMutation(internal.lib.storeContact, {
|
|
850
758
|
email: args.email,
|
|
851
759
|
subscribed: false,
|
|
852
760
|
});
|
|
@@ -879,7 +787,7 @@ export const resubscribeContact = za({
|
|
|
879
787
|
console.error(`Loops API error [${response.status}]:`, errorText);
|
|
880
788
|
throw sanitizeError(response.status, errorText);
|
|
881
789
|
}
|
|
882
|
-
await ctx.runMutation(
|
|
790
|
+
await ctx.runMutation(internal.lib.storeContact, {
|
|
883
791
|
email: args.email,
|
|
884
792
|
subscribed: true,
|
|
885
793
|
});
|
|
@@ -895,11 +803,13 @@ export const detectRecipientSpam = zq({
|
|
|
895
803
|
timeWindowMs: z.number().default(3600000),
|
|
896
804
|
maxEmailsPerRecipient: z.number().default(10),
|
|
897
805
|
}),
|
|
898
|
-
returns: z.array(z
|
|
806
|
+
returns: z.array(z
|
|
807
|
+
.object({
|
|
899
808
|
email: z.string(),
|
|
900
809
|
count: z.number(),
|
|
901
810
|
timeWindowMs: z.number(),
|
|
902
|
-
})
|
|
811
|
+
})
|
|
812
|
+
.catchall(z.any())),
|
|
903
813
|
handler: async (ctx, args) => {
|
|
904
814
|
const cutoffTime = Date.now() - args.timeWindowMs;
|
|
905
815
|
const operations = await ctx.db
|
|
@@ -971,14 +881,16 @@ export const getEmailStats = zq({
|
|
|
971
881
|
args: z.object({
|
|
972
882
|
timeWindowMs: z.number().default(86400000),
|
|
973
883
|
}),
|
|
974
|
-
returns: z
|
|
884
|
+
returns: z
|
|
885
|
+
.object({
|
|
975
886
|
totalOperations: z.number(),
|
|
976
887
|
successfulOperations: z.number(),
|
|
977
888
|
failedOperations: z.number(),
|
|
978
889
|
operationsByType: z.record(z.string(), z.number()),
|
|
979
890
|
uniqueRecipients: z.number(),
|
|
980
891
|
uniqueActors: z.number(),
|
|
981
|
-
})
|
|
892
|
+
})
|
|
893
|
+
.catchall(z.any()),
|
|
982
894
|
handler: async (ctx, args) => {
|
|
983
895
|
const cutoffTime = Date.now() - args.timeWindowMs;
|
|
984
896
|
const operations = await ctx.db
|
|
@@ -1041,7 +953,7 @@ export const detectRapidFirePatterns = zq({
|
|
|
1041
953
|
if (!emailGroups.has(op.email)) {
|
|
1042
954
|
emailGroups.set(op.email, []);
|
|
1043
955
|
}
|
|
1044
|
-
emailGroups.get(op.email)
|
|
956
|
+
emailGroups.get(op.email)?.push(op);
|
|
1045
957
|
}
|
|
1046
958
|
}
|
|
1047
959
|
for (const [email, ops] of emailGroups.entries()) {
|
|
@@ -1069,7 +981,7 @@ export const detectRapidFirePatterns = zq({
|
|
|
1069
981
|
if (!actorGroups.has(op.actorId)) {
|
|
1070
982
|
actorGroups.set(op.actorId, []);
|
|
1071
983
|
}
|
|
1072
|
-
actorGroups.get(op.actorId)
|
|
984
|
+
actorGroups.get(op.actorId)?.push(op);
|
|
1073
985
|
}
|
|
1074
986
|
}
|
|
1075
987
|
for (const [actorId, ops] of actorGroups.entries()) {
|
|
@@ -1104,13 +1016,15 @@ export const checkRecipientRateLimit = zq({
|
|
|
1104
1016
|
timeWindowMs: z.number(),
|
|
1105
1017
|
maxEmails: z.number(),
|
|
1106
1018
|
}),
|
|
1107
|
-
returns: z
|
|
1019
|
+
returns: z
|
|
1020
|
+
.object({
|
|
1108
1021
|
allowed: z.boolean(),
|
|
1109
1022
|
count: z.number(),
|
|
1110
1023
|
limit: z.number(),
|
|
1111
1024
|
timeWindowMs: z.number(),
|
|
1112
1025
|
retryAfter: z.number().optional(),
|
|
1113
|
-
})
|
|
1026
|
+
})
|
|
1027
|
+
.catchall(z.any()),
|
|
1114
1028
|
handler: async (ctx, args) => {
|
|
1115
1029
|
const cutoffTime = Date.now() - args.timeWindowMs;
|
|
1116
1030
|
const operations = await ctx.db
|
|
@@ -1,3 +1,68 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: import("convex/server").SchemaDefinition<{
|
|
2
|
+
contacts: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
3
|
+
firstName?: string | undefined;
|
|
4
|
+
lastName?: string | undefined;
|
|
5
|
+
userId?: string | undefined;
|
|
6
|
+
source?: string | undefined;
|
|
7
|
+
subscribed?: boolean | undefined;
|
|
8
|
+
userGroup?: string | undefined;
|
|
9
|
+
loopsContactId?: string | undefined;
|
|
10
|
+
email: string;
|
|
11
|
+
createdAt: number;
|
|
12
|
+
updatedAt: number;
|
|
13
|
+
}, import("zodvex").ConvexValidatorFromZodFieldsAuto<{
|
|
14
|
+
email: import("zod").ZodString;
|
|
15
|
+
firstName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
16
|
+
lastName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
17
|
+
userId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
18
|
+
source: import("zod").ZodOptional<import("zod").ZodString>;
|
|
19
|
+
subscribed: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
20
|
+
userGroup: import("zod").ZodOptional<import("zod").ZodString>;
|
|
21
|
+
loopsContactId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
22
|
+
createdAt: import("zod").ZodNumber;
|
|
23
|
+
updatedAt: import("zod").ZodNumber;
|
|
24
|
+
}>, "required", "email" | "firstName" | "lastName" | "userId" | "source" | "subscribed" | "userGroup" | "loopsContactId" | "createdAt" | "updatedAt">, {
|
|
25
|
+
email: ["email", "_creationTime"];
|
|
26
|
+
userId: ["userId", "_creationTime"];
|
|
27
|
+
userGroup: ["userGroup", "_creationTime"];
|
|
28
|
+
source: ["source", "_creationTime"];
|
|
29
|
+
subscribed: ["subscribed", "_creationTime"];
|
|
30
|
+
}, {}, {}>;
|
|
31
|
+
emailOperations: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
32
|
+
actorId?: string | undefined;
|
|
33
|
+
transactionalId?: string | undefined;
|
|
34
|
+
campaignId?: string | undefined;
|
|
35
|
+
loopId?: string | undefined;
|
|
36
|
+
eventName?: string | undefined;
|
|
37
|
+
messageId?: string | undefined;
|
|
38
|
+
metadata?: Record<string, any> | undefined;
|
|
39
|
+
email: string;
|
|
40
|
+
success: boolean;
|
|
41
|
+
operationType: "transactional" | "event" | "campaign" | "loop";
|
|
42
|
+
timestamp: number;
|
|
43
|
+
}, import("zodvex").ConvexValidatorFromZodFieldsAuto<{
|
|
44
|
+
operationType: import("zod").ZodEnum<{
|
|
45
|
+
transactional: "transactional";
|
|
46
|
+
event: "event";
|
|
47
|
+
campaign: "campaign";
|
|
48
|
+
loop: "loop";
|
|
49
|
+
}>;
|
|
50
|
+
email: import("zod").ZodString;
|
|
51
|
+
actorId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
52
|
+
transactionalId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
53
|
+
campaignId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
54
|
+
loopId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
55
|
+
eventName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
56
|
+
timestamp: import("zod").ZodNumber;
|
|
57
|
+
success: import("zod").ZodBoolean;
|
|
58
|
+
messageId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
59
|
+
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
|
|
60
|
+
}>, "required", "email" | "success" | "operationType" | "actorId" | "transactionalId" | "campaignId" | "loopId" | "eventName" | "timestamp" | "messageId" | "metadata" | `metadata.${string}`>, {
|
|
61
|
+
email: ["email", "timestamp", "_creationTime"];
|
|
62
|
+
actorId: ["actorId", "timestamp", "_creationTime"];
|
|
63
|
+
operationType: ["operationType", "timestamp", "_creationTime"];
|
|
64
|
+
timestamp: ["timestamp", "_creationTime"];
|
|
65
|
+
}, {}, {}>;
|
|
66
|
+
}, true>;
|
|
2
67
|
export default _default;
|
|
3
68
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,wBAYG"}
|
|
@@ -1,2 +1,124 @@
|
|
|
1
|
-
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const Contacts: {
|
|
3
|
+
name: "contacts";
|
|
4
|
+
table: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
5
|
+
firstName?: string | undefined;
|
|
6
|
+
lastName?: string | undefined;
|
|
7
|
+
userId?: string | undefined;
|
|
8
|
+
source?: string | undefined;
|
|
9
|
+
subscribed?: boolean | undefined;
|
|
10
|
+
userGroup?: string | undefined;
|
|
11
|
+
loopsContactId?: string | undefined;
|
|
12
|
+
email: string;
|
|
13
|
+
createdAt: number;
|
|
14
|
+
updatedAt: number;
|
|
15
|
+
}, import("zodvex").ConvexValidatorFromZodFieldsAuto<{
|
|
16
|
+
email: z.ZodString;
|
|
17
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
18
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
19
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
20
|
+
source: z.ZodOptional<z.ZodString>;
|
|
21
|
+
subscribed: z.ZodDefault<z.ZodBoolean>;
|
|
22
|
+
userGroup: z.ZodOptional<z.ZodString>;
|
|
23
|
+
loopsContactId: z.ZodOptional<z.ZodString>;
|
|
24
|
+
createdAt: z.ZodNumber;
|
|
25
|
+
updatedAt: z.ZodNumber;
|
|
26
|
+
}>, "required", "email" | "firstName" | "lastName" | "userId" | "source" | "subscribed" | "userGroup" | "loopsContactId" | "createdAt" | "updatedAt">, {}, {}, {}>;
|
|
27
|
+
doc: import("convex/values").VObject<{
|
|
28
|
+
firstName?: string | undefined;
|
|
29
|
+
lastName?: string | undefined;
|
|
30
|
+
userId?: string | undefined;
|
|
31
|
+
source?: string | undefined;
|
|
32
|
+
subscribed?: boolean | undefined;
|
|
33
|
+
userGroup?: string | undefined;
|
|
34
|
+
loopsContactId?: string | undefined;
|
|
35
|
+
email: string;
|
|
36
|
+
createdAt: number;
|
|
37
|
+
updatedAt: number;
|
|
38
|
+
_creationTime: number;
|
|
39
|
+
_id: import("convex/values").GenericId<"contacts">;
|
|
40
|
+
}, {
|
|
41
|
+
email: import("convex/values").VString<string, "required">;
|
|
42
|
+
firstName: import("convex/values").VString<string | undefined, "optional">;
|
|
43
|
+
lastName: import("convex/values").VString<string | undefined, "optional">;
|
|
44
|
+
userId: import("convex/values").VString<string | undefined, "optional">;
|
|
45
|
+
source: import("convex/values").VString<string | undefined, "optional">;
|
|
46
|
+
subscribed: import("convex/values").VBoolean<boolean, "optional">;
|
|
47
|
+
userGroup: import("convex/values").VString<string | undefined, "optional">;
|
|
48
|
+
loopsContactId: import("convex/values").VString<string | undefined, "optional">;
|
|
49
|
+
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
50
|
+
updatedAt: import("convex/values").VFloat64<number, "required">;
|
|
51
|
+
_id: import("convex/values").VId<import("convex/values").GenericId<"contacts">, "required">;
|
|
52
|
+
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
53
|
+
}, "required", "email" | "firstName" | "lastName" | "userId" | "source" | "subscribed" | "userGroup" | "loopsContactId" | "createdAt" | "updatedAt" | "_creationTime" | "_id">;
|
|
54
|
+
withoutSystemFields: import("zodvex").ConvexValidatorFromZodFieldsAuto<{
|
|
55
|
+
email: z.ZodString;
|
|
56
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
57
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
58
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
59
|
+
source: z.ZodOptional<z.ZodString>;
|
|
60
|
+
subscribed: z.ZodDefault<z.ZodBoolean>;
|
|
61
|
+
userGroup: z.ZodOptional<z.ZodString>;
|
|
62
|
+
loopsContactId: z.ZodOptional<z.ZodString>;
|
|
63
|
+
createdAt: z.ZodNumber;
|
|
64
|
+
updatedAt: z.ZodNumber;
|
|
65
|
+
}>;
|
|
66
|
+
withSystemFields: {
|
|
67
|
+
email: import("convex/values").VString<string, "required">;
|
|
68
|
+
firstName: import("convex/values").VString<string | undefined, "optional">;
|
|
69
|
+
lastName: import("convex/values").VString<string | undefined, "optional">;
|
|
70
|
+
userId: import("convex/values").VString<string | undefined, "optional">;
|
|
71
|
+
source: import("convex/values").VString<string | undefined, "optional">;
|
|
72
|
+
subscribed: import("convex/values").VBoolean<boolean, "optional">;
|
|
73
|
+
userGroup: import("convex/values").VString<string | undefined, "optional">;
|
|
74
|
+
loopsContactId: import("convex/values").VString<string | undefined, "optional">;
|
|
75
|
+
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
76
|
+
updatedAt: import("convex/values").VFloat64<number, "required">;
|
|
77
|
+
_id: import("convex/values").VId<import("convex/values").GenericId<"contacts">, "required">;
|
|
78
|
+
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
79
|
+
};
|
|
80
|
+
systemFields: {
|
|
81
|
+
_id: import("convex/values").VId<import("convex/values").GenericId<"contacts">, "required">;
|
|
82
|
+
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
83
|
+
};
|
|
84
|
+
_id: import("convex/values").VId<import("convex/values").GenericId<"contacts">, "required">;
|
|
85
|
+
} & {
|
|
86
|
+
shape: {
|
|
87
|
+
email: z.ZodString;
|
|
88
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
89
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
90
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
91
|
+
source: z.ZodOptional<z.ZodString>;
|
|
92
|
+
subscribed: z.ZodDefault<z.ZodBoolean>;
|
|
93
|
+
userGroup: z.ZodOptional<z.ZodString>;
|
|
94
|
+
loopsContactId: z.ZodOptional<z.ZodString>;
|
|
95
|
+
createdAt: z.ZodNumber;
|
|
96
|
+
updatedAt: z.ZodNumber;
|
|
97
|
+
};
|
|
98
|
+
zDoc: z.ZodObject<{
|
|
99
|
+
email: z.ZodString;
|
|
100
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
101
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
102
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
103
|
+
source: z.ZodOptional<z.ZodString>;
|
|
104
|
+
subscribed: z.ZodDefault<z.ZodBoolean>;
|
|
105
|
+
userGroup: z.ZodOptional<z.ZodString>;
|
|
106
|
+
loopsContactId: z.ZodOptional<z.ZodString>;
|
|
107
|
+
createdAt: z.ZodNumber;
|
|
108
|
+
updatedAt: z.ZodNumber;
|
|
109
|
+
} & {
|
|
110
|
+
_id: z.ZodType<import("convex/values").GenericId<"contacts">, unknown, z.core.$ZodTypeInternals<import("convex/values").GenericId<"contacts">, unknown>> & {
|
|
111
|
+
_tableName: "contacts";
|
|
112
|
+
};
|
|
113
|
+
_creationTime: z.ZodNumber;
|
|
114
|
+
}, z.core.$strip>;
|
|
115
|
+
docArray: z.ZodArray<z.ZodObject<Readonly<{
|
|
116
|
+
[k: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
117
|
+
}> & {
|
|
118
|
+
_id: z.ZodType<import("convex/values").GenericId<"contacts">, unknown, z.core.$ZodTypeInternals<import("convex/values").GenericId<"contacts">, unknown>> & {
|
|
119
|
+
_tableName: "contacts";
|
|
120
|
+
};
|
|
121
|
+
_creationTime: z.ZodNumber;
|
|
122
|
+
}, z.core.$strip>>;
|
|
123
|
+
};
|
|
2
124
|
//# sourceMappingURL=contacts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contacts.d.ts","sourceRoot":"","sources":["../../../src/component/tables/contacts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contacts.d.ts","sourceRoot":"","sources":["../../../src/component/tables/contacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWnB,CAAC"}
|