@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.
@@ -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, errorText) => {
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.slice(args.offset, args.offset + args.limit);
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((internal.lib).storeContact, {
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((internal.lib).storeContact, {
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((internal.lib).storeContact, {
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((internal.lib).logEmailOperation, {
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((internal.lib).logEmailOperation, {
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 (ctx, args) => {
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,7 +527,7 @@ 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((internal.lib).removeContact, {
530
+ await ctx.runMutation(internal.lib.removeContact, {
526
531
  email: args.email,
527
532
  });
528
533
  return { success: true };
@@ -563,7 +568,7 @@ export const triggerLoop = za({
563
568
  const eventName = args.eventName || `loop_${args.loopId}`;
564
569
  try {
565
570
  // Send event to trigger the loop
566
- await ctx.runAction((internal.lib).sendEvent, {
571
+ await ctx.runAction(internal.lib.sendEvent, {
567
572
  apiKey: args.apiKey,
568
573
  email: args.email,
569
574
  eventName,
@@ -573,7 +578,7 @@ export const triggerLoop = za({
573
578
  },
574
579
  });
575
580
  // Log as loop operation
576
- await ctx.runMutation((internal.lib).logEmailOperation, {
581
+ await ctx.runMutation(internal.lib.logEmailOperation, {
577
582
  operationType: "loop",
578
583
  email: args.email,
579
584
  success: true,
@@ -587,13 +592,15 @@ export const triggerLoop = za({
587
592
  }
588
593
  catch (error) {
589
594
  // Log failed loop operation
590
- await ctx.runMutation((internal.lib).logEmailOperation, {
595
+ await ctx.runMutation(internal.lib.logEmailOperation, {
591
596
  operationType: "loop",
592
597
  email: args.email,
593
598
  success: false,
594
599
  loopId: args.loopId,
595
600
  eventName,
596
- metadata: { error: error instanceof Error ? error.message : String(error) },
601
+ metadata: {
602
+ error: error instanceof Error ? error.message : String(error),
603
+ },
597
604
  });
598
605
  throw error;
599
606
  }
@@ -625,7 +632,7 @@ export const findContact = za({
625
632
  })
626
633
  .optional(),
627
634
  }),
628
- handler: async (ctx, args) => {
635
+ handler: async (_ctx, args) => {
629
636
  const response = await fetch(`${LOOPS_API_BASE_URL}/contacts/find?email=${encodeURIComponent(args.email)}`, {
630
637
  method: "GET",
631
638
  headers: {
@@ -646,7 +653,10 @@ export const findContact = za({
646
653
  let contact = Array.isArray(data) ? data[0] : data;
647
654
  // Convert null values to undefined for optional fields (Zod handles undefined but not null in optional())
648
655
  if (contact) {
649
- contact = Object.fromEntries(Object.entries(contact).map(([key, value]) => [key, value === null ? undefined : value]));
656
+ contact = Object.fromEntries(Object.entries(contact).map(([key, value]) => [
657
+ key,
658
+ value === null ? undefined : value,
659
+ ]));
650
660
  }
651
661
  return {
652
662
  success: true,
@@ -668,11 +678,13 @@ export const batchCreateContacts = za({
668
678
  success: z.boolean(),
669
679
  created: z.number().optional(),
670
680
  failed: z.number().optional(),
671
- results: z.array(z.object({
681
+ results: z
682
+ .array(z.object({
672
683
  email: z.string(),
673
684
  success: z.boolean(),
674
685
  error: z.string().optional(),
675
- })).optional(),
686
+ }))
687
+ .optional(),
676
688
  }),
677
689
  handler: async (ctx, args) => {
678
690
  let created = 0;
@@ -682,7 +694,7 @@ export const batchCreateContacts = za({
682
694
  for (const contact of args.contacts) {
683
695
  try {
684
696
  // Use the addContact function which handles create/update logic
685
- const result = await ctx.runAction((internal.lib).addContact, {
697
+ const result = await ctx.runAction(internal.lib.addContact, {
686
698
  apiKey: args.apiKey,
687
699
  contact,
688
700
  });
@@ -695,7 +707,7 @@ export const batchCreateContacts = za({
695
707
  results.push({
696
708
  email: contact.email,
697
709
  success: false,
698
- error: "Unknown error"
710
+ error: "Unknown error",
699
711
  });
700
712
  }
701
713
  }
@@ -742,7 +754,7 @@ export const unsubscribeContact = za({
742
754
  console.error(`Loops API error [${response.status}]:`, errorText);
743
755
  throw sanitizeError(response.status, errorText);
744
756
  }
745
- await ctx.runMutation((internal.lib).storeContact, {
757
+ await ctx.runMutation(internal.lib.storeContact, {
746
758
  email: args.email,
747
759
  subscribed: false,
748
760
  });
@@ -775,7 +787,7 @@ export const resubscribeContact = za({
775
787
  console.error(`Loops API error [${response.status}]:`, errorText);
776
788
  throw sanitizeError(response.status, errorText);
777
789
  }
778
- await ctx.runMutation((internal.lib).storeContact, {
790
+ await ctx.runMutation(internal.lib.storeContact, {
779
791
  email: args.email,
780
792
  subscribed: true,
781
793
  });
@@ -791,11 +803,13 @@ export const detectRecipientSpam = zq({
791
803
  timeWindowMs: z.number().default(3600000),
792
804
  maxEmailsPerRecipient: z.number().default(10),
793
805
  }),
794
- returns: z.array(z.object({
806
+ returns: z.array(z
807
+ .object({
795
808
  email: z.string(),
796
809
  count: z.number(),
797
810
  timeWindowMs: z.number(),
798
- })),
811
+ })
812
+ .catchall(z.any())),
799
813
  handler: async (ctx, args) => {
800
814
  const cutoffTime = Date.now() - args.timeWindowMs;
801
815
  const operations = await ctx.db
@@ -867,14 +881,16 @@ export const getEmailStats = zq({
867
881
  args: z.object({
868
882
  timeWindowMs: z.number().default(86400000),
869
883
  }),
870
- returns: z.object({
884
+ returns: z
885
+ .object({
871
886
  totalOperations: z.number(),
872
887
  successfulOperations: z.number(),
873
888
  failedOperations: z.number(),
874
889
  operationsByType: z.record(z.string(), z.number()),
875
890
  uniqueRecipients: z.number(),
876
891
  uniqueActors: z.number(),
877
- }),
892
+ })
893
+ .catchall(z.any()),
878
894
  handler: async (ctx, args) => {
879
895
  const cutoffTime = Date.now() - args.timeWindowMs;
880
896
  const operations = await ctx.db
@@ -937,7 +953,7 @@ export const detectRapidFirePatterns = zq({
937
953
  if (!emailGroups.has(op.email)) {
938
954
  emailGroups.set(op.email, []);
939
955
  }
940
- emailGroups.get(op.email).push(op);
956
+ emailGroups.get(op.email)?.push(op);
941
957
  }
942
958
  }
943
959
  for (const [email, ops] of emailGroups.entries()) {
@@ -965,7 +981,7 @@ export const detectRapidFirePatterns = zq({
965
981
  if (!actorGroups.has(op.actorId)) {
966
982
  actorGroups.set(op.actorId, []);
967
983
  }
968
- actorGroups.get(op.actorId).push(op);
984
+ actorGroups.get(op.actorId)?.push(op);
969
985
  }
970
986
  }
971
987
  for (const [actorId, ops] of actorGroups.entries()) {
@@ -1000,13 +1016,15 @@ export const checkRecipientRateLimit = zq({
1000
1016
  timeWindowMs: z.number(),
1001
1017
  maxEmails: z.number(),
1002
1018
  }),
1003
- returns: z.object({
1019
+ returns: z
1020
+ .object({
1004
1021
  allowed: z.boolean(),
1005
1022
  count: z.number(),
1006
1023
  limit: z.number(),
1007
1024
  timeWindowMs: z.number(),
1008
1025
  retryAfter: z.number().optional(),
1009
- }),
1026
+ })
1027
+ .catchall(z.any()),
1010
1028
  handler: async (ctx, args) => {
1011
1029
  const cutoffTime = Date.now() - args.timeWindowMs;
1012
1030
  const operations = await ctx.db
@@ -1,3 +1,68 @@
1
- declare const _default: any;
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":";AAIA,wBAYG"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,wBAYG"}
@@ -1,2 +1,124 @@
1
- export declare const Contacts: any;
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":"AAGA,eAAO,MAAM,QAAQ,KAWnB,CAAC"}
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"}
@@ -1,2 +1,152 @@
1
- export declare const EmailOperations: any;
1
+ import { z } from "zod";
2
+ export declare const EmailOperations: {
3
+ name: "emailOperations";
4
+ table: import("convex/server").TableDefinition<import("convex/values").VObject<{
5
+ actorId?: string | undefined;
6
+ transactionalId?: string | undefined;
7
+ campaignId?: string | undefined;
8
+ loopId?: string | undefined;
9
+ eventName?: string | undefined;
10
+ messageId?: string | undefined;
11
+ metadata?: Record<string, any> | undefined;
12
+ email: string;
13
+ success: boolean;
14
+ operationType: "transactional" | "event" | "campaign" | "loop";
15
+ timestamp: number;
16
+ }, import("zodvex").ConvexValidatorFromZodFieldsAuto<{
17
+ operationType: z.ZodEnum<{
18
+ transactional: "transactional";
19
+ event: "event";
20
+ campaign: "campaign";
21
+ loop: "loop";
22
+ }>;
23
+ email: z.ZodString;
24
+ actorId: z.ZodOptional<z.ZodString>;
25
+ transactionalId: z.ZodOptional<z.ZodString>;
26
+ campaignId: z.ZodOptional<z.ZodString>;
27
+ loopId: z.ZodOptional<z.ZodString>;
28
+ eventName: z.ZodOptional<z.ZodString>;
29
+ timestamp: z.ZodNumber;
30
+ success: z.ZodBoolean;
31
+ messageId: z.ZodOptional<z.ZodString>;
32
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
33
+ }>, "required", "email" | "success" | "operationType" | "actorId" | "transactionalId" | "campaignId" | "loopId" | "eventName" | "timestamp" | "messageId" | "metadata" | `metadata.${string}`>, {}, {}, {}>;
34
+ doc: import("convex/values").VObject<{
35
+ actorId?: string | undefined;
36
+ transactionalId?: string | undefined;
37
+ campaignId?: string | undefined;
38
+ loopId?: string | undefined;
39
+ eventName?: string | undefined;
40
+ messageId?: string | undefined;
41
+ metadata?: Record<string, any> | undefined;
42
+ email: string;
43
+ success: boolean;
44
+ operationType: "transactional" | "event" | "campaign" | "loop";
45
+ timestamp: number;
46
+ _creationTime: number;
47
+ _id: import("convex/values").GenericId<"emailOperations">;
48
+ }, {
49
+ operationType: import("convex/values").VUnion<"transactional" | "event" | "campaign" | "loop", import("convex/values").VLiteral<"transactional" | "event" | "campaign" | "loop", "required">[], "required", never>;
50
+ email: import("convex/values").VString<string, "required">;
51
+ actorId: import("convex/values").VString<string | undefined, "optional">;
52
+ transactionalId: import("convex/values").VString<string | undefined, "optional">;
53
+ campaignId: import("convex/values").VString<string | undefined, "optional">;
54
+ loopId: import("convex/values").VString<string | undefined, "optional">;
55
+ eventName: import("convex/values").VString<string | undefined, "optional">;
56
+ timestamp: import("convex/values").VFloat64<number, "required">;
57
+ success: import("convex/values").VBoolean<boolean, "required">;
58
+ messageId: import("convex/values").VString<string | undefined, "optional">;
59
+ metadata: import("convex/values").VRecord<Record<string, any> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VAny<"required", "required", string>, "optional", string>;
60
+ _id: import("convex/values").VId<import("convex/values").GenericId<"emailOperations">, "required">;
61
+ _creationTime: import("convex/values").VFloat64<number, "required">;
62
+ }, "required", "email" | "success" | "operationType" | "actorId" | "transactionalId" | "campaignId" | "loopId" | "eventName" | "timestamp" | "messageId" | "metadata" | "_creationTime" | `metadata.${string}` | "_id">;
63
+ withoutSystemFields: import("zodvex").ConvexValidatorFromZodFieldsAuto<{
64
+ operationType: z.ZodEnum<{
65
+ transactional: "transactional";
66
+ event: "event";
67
+ campaign: "campaign";
68
+ loop: "loop";
69
+ }>;
70
+ email: z.ZodString;
71
+ actorId: z.ZodOptional<z.ZodString>;
72
+ transactionalId: z.ZodOptional<z.ZodString>;
73
+ campaignId: z.ZodOptional<z.ZodString>;
74
+ loopId: z.ZodOptional<z.ZodString>;
75
+ eventName: z.ZodOptional<z.ZodString>;
76
+ timestamp: z.ZodNumber;
77
+ success: z.ZodBoolean;
78
+ messageId: z.ZodOptional<z.ZodString>;
79
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
80
+ }>;
81
+ withSystemFields: {
82
+ operationType: import("convex/values").VUnion<"transactional" | "event" | "campaign" | "loop", import("convex/values").VLiteral<"transactional" | "event" | "campaign" | "loop", "required">[], "required", never>;
83
+ email: import("convex/values").VString<string, "required">;
84
+ actorId: import("convex/values").VString<string | undefined, "optional">;
85
+ transactionalId: import("convex/values").VString<string | undefined, "optional">;
86
+ campaignId: import("convex/values").VString<string | undefined, "optional">;
87
+ loopId: import("convex/values").VString<string | undefined, "optional">;
88
+ eventName: import("convex/values").VString<string | undefined, "optional">;
89
+ timestamp: import("convex/values").VFloat64<number, "required">;
90
+ success: import("convex/values").VBoolean<boolean, "required">;
91
+ messageId: import("convex/values").VString<string | undefined, "optional">;
92
+ metadata: import("convex/values").VRecord<Record<string, any> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VAny<"required", "required", string>, "optional", string>;
93
+ _id: import("convex/values").VId<import("convex/values").GenericId<"emailOperations">, "required">;
94
+ _creationTime: import("convex/values").VFloat64<number, "required">;
95
+ };
96
+ systemFields: {
97
+ _id: import("convex/values").VId<import("convex/values").GenericId<"emailOperations">, "required">;
98
+ _creationTime: import("convex/values").VFloat64<number, "required">;
99
+ };
100
+ _id: import("convex/values").VId<import("convex/values").GenericId<"emailOperations">, "required">;
101
+ } & {
102
+ shape: {
103
+ operationType: z.ZodEnum<{
104
+ transactional: "transactional";
105
+ event: "event";
106
+ campaign: "campaign";
107
+ loop: "loop";
108
+ }>;
109
+ email: z.ZodString;
110
+ actorId: z.ZodOptional<z.ZodString>;
111
+ transactionalId: z.ZodOptional<z.ZodString>;
112
+ campaignId: z.ZodOptional<z.ZodString>;
113
+ loopId: z.ZodOptional<z.ZodString>;
114
+ eventName: z.ZodOptional<z.ZodString>;
115
+ timestamp: z.ZodNumber;
116
+ success: z.ZodBoolean;
117
+ messageId: z.ZodOptional<z.ZodString>;
118
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
119
+ };
120
+ zDoc: z.ZodObject<{
121
+ operationType: z.ZodEnum<{
122
+ transactional: "transactional";
123
+ event: "event";
124
+ campaign: "campaign";
125
+ loop: "loop";
126
+ }>;
127
+ email: z.ZodString;
128
+ actorId: z.ZodOptional<z.ZodString>;
129
+ transactionalId: z.ZodOptional<z.ZodString>;
130
+ campaignId: z.ZodOptional<z.ZodString>;
131
+ loopId: z.ZodOptional<z.ZodString>;
132
+ eventName: z.ZodOptional<z.ZodString>;
133
+ timestamp: z.ZodNumber;
134
+ success: z.ZodBoolean;
135
+ messageId: z.ZodOptional<z.ZodString>;
136
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
137
+ } & {
138
+ _id: z.ZodType<import("convex/values").GenericId<"emailOperations">, unknown, z.core.$ZodTypeInternals<import("convex/values").GenericId<"emailOperations">, unknown>> & {
139
+ _tableName: "emailOperations";
140
+ };
141
+ _creationTime: z.ZodNumber;
142
+ }, z.core.$strip>;
143
+ docArray: z.ZodArray<z.ZodObject<Readonly<{
144
+ [k: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
145
+ }> & {
146
+ _id: z.ZodType<import("convex/values").GenericId<"emailOperations">, unknown, z.core.$ZodTypeInternals<import("convex/values").GenericId<"emailOperations">, unknown>> & {
147
+ _tableName: "emailOperations";
148
+ };
149
+ _creationTime: z.ZodNumber;
150
+ }, z.core.$strip>>;
151
+ };
2
152
  //# sourceMappingURL=emailOperations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"emailOperations.d.ts","sourceRoot":"","sources":["../../../src/component/tables/emailOperations.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,KAiB1B,CAAC"}
1
+ {"version":3,"file":"emailOperations.d.ts","sourceRoot":"","sources":["../../../src/component/tables/emailOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAY1B,CAAC"}
@@ -1,12 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { zodTable } from "zodvex";
3
3
  export const EmailOperations = zodTable("emailOperations", {
4
- operationType: z.enum([
5
- "transactional",
6
- "event",
7
- "campaign",
8
- "loop",
9
- ]),
4
+ operationType: z.enum(["transactional", "event", "campaign", "loop"]),
10
5
  email: z.string().email(),
11
6
  actorId: z.string().optional(),
12
7
  transactionalId: z.string().optional(),