@devwithbobby/loops 0.1.18 → 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.
Files changed (52) hide show
  1. package/dist/client/index.d.ts +133 -103
  2. package/dist/client/index.d.ts.map +1 -1
  3. package/dist/client/index.js +55 -10
  4. package/dist/component/_generated/api.d.ts +228 -0
  5. package/dist/component/_generated/api.d.ts.map +1 -0
  6. package/{src → dist}/component/_generated/api.js +10 -3
  7. package/dist/component/_generated/component.d.ts +266 -0
  8. package/dist/component/_generated/component.d.ts.map +1 -0
  9. package/dist/component/_generated/component.js +9 -0
  10. package/dist/component/_generated/dataModel.d.ts +46 -0
  11. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  12. package/dist/component/_generated/dataModel.js +10 -0
  13. package/{src → dist}/component/_generated/server.d.ts +10 -38
  14. package/dist/component/_generated/server.d.ts.map +1 -0
  15. package/{src → dist}/component/_generated/server.js +9 -22
  16. package/dist/component/aggregates.d.ts +42 -0
  17. package/dist/component/aggregates.d.ts.map +1 -0
  18. package/dist/component/aggregates.js +54 -0
  19. package/dist/component/convex.config.d.ts.map +1 -1
  20. package/dist/component/convex.config.js +2 -22
  21. package/dist/component/helpers.d.ts +1 -1
  22. package/dist/component/helpers.d.ts.map +1 -1
  23. package/dist/component/helpers.js +1 -2
  24. package/dist/component/http.js +1 -1
  25. package/dist/component/lib.d.ts +66 -17
  26. package/dist/component/lib.d.ts.map +1 -1
  27. package/dist/component/lib.js +194 -73
  28. package/dist/component/schema.d.ts +2 -2
  29. package/dist/component/tables/contacts.d.ts.map +1 -1
  30. package/dist/component/tables/emailOperations.d.ts +4 -4
  31. package/dist/component/tables/emailOperations.d.ts.map +1 -1
  32. package/dist/test.d.ts +83 -0
  33. package/dist/test.d.ts.map +1 -0
  34. package/dist/test.js +16 -0
  35. package/dist/types.d.ts +249 -62
  36. package/dist/types.d.ts.map +1 -1
  37. package/dist/types.js +4 -2
  38. package/dist/utils.d.ts +6 -6
  39. package/package.json +25 -13
  40. package/src/client/index.ts +69 -18
  41. package/src/component/_generated/api.ts +249 -0
  42. package/src/component/_generated/component.ts +328 -0
  43. package/src/component/_generated/server.ts +161 -0
  44. package/src/component/aggregates.ts +89 -0
  45. package/src/component/convex.config.ts +2 -26
  46. package/src/component/helpers.ts +2 -2
  47. package/src/component/http.ts +1 -1
  48. package/src/component/lib.ts +226 -89
  49. package/src/test.ts +27 -0
  50. package/src/types.ts +20 -122
  51. package/src/component/_generated/api.d.ts +0 -47
  52. /package/src/component/_generated/{dataModel.d.ts → dataModel.ts} +0 -0
package/dist/test.d.ts ADDED
@@ -0,0 +1,83 @@
1
+ import type { TestConvex } from "convex-test";
2
+ import type { GenericSchema, SchemaDefinition } from "convex/server";
3
+ import schema from "./component/schema.js";
4
+ /**
5
+ * Register the Loops component with the test convex instance.
6
+ *
7
+ * @param t - The test convex instance from convexTest().
8
+ * @param name - The name of the component as registered in convex.config.ts.
9
+ * @param modules - The modules object from import.meta.glob. Required.
10
+ */
11
+ export declare function register(t: TestConvex<SchemaDefinition<GenericSchema, boolean>>, name?: string, modules?: Record<string, () => Promise<unknown>>): void;
12
+ export { schema };
13
+ declare const _default: {
14
+ register: typeof register;
15
+ schema: SchemaDefinition<{
16
+ contacts: import("convex/server").TableDefinition<import("convex/values").VObject<{
17
+ firstName?: string | undefined;
18
+ lastName?: string | undefined;
19
+ userId?: string | undefined;
20
+ source?: string | undefined;
21
+ subscribed?: boolean | undefined;
22
+ userGroup?: string | undefined;
23
+ loopsContactId?: string | undefined;
24
+ email: string;
25
+ createdAt: number;
26
+ updatedAt: number;
27
+ }, import("zodvex").ConvexValidatorFromZodFieldsAuto<{
28
+ email: import("zod").ZodString;
29
+ firstName: import("zod").ZodOptional<import("zod").ZodString>;
30
+ lastName: import("zod").ZodOptional<import("zod").ZodString>;
31
+ userId: import("zod").ZodOptional<import("zod").ZodString>;
32
+ source: import("zod").ZodOptional<import("zod").ZodString>;
33
+ subscribed: import("zod").ZodDefault<import("zod").ZodBoolean>;
34
+ userGroup: import("zod").ZodOptional<import("zod").ZodString>;
35
+ loopsContactId: import("zod").ZodOptional<import("zod").ZodString>;
36
+ createdAt: import("zod").ZodNumber;
37
+ updatedAt: import("zod").ZodNumber;
38
+ }>, "required", "email" | "firstName" | "lastName" | "userId" | "source" | "subscribed" | "userGroup" | "loopsContactId" | "createdAt" | "updatedAt">, {
39
+ email: ["email", "_creationTime"];
40
+ userId: ["userId", "_creationTime"];
41
+ userGroup: ["userGroup", "_creationTime"];
42
+ source: ["source", "_creationTime"];
43
+ subscribed: ["subscribed", "_creationTime"];
44
+ }, {}, {}>;
45
+ emailOperations: import("convex/server").TableDefinition<import("convex/values").VObject<{
46
+ actorId?: string | undefined;
47
+ transactionalId?: string | undefined;
48
+ campaignId?: string | undefined;
49
+ loopId?: string | undefined;
50
+ eventName?: string | undefined;
51
+ messageId?: string | undefined;
52
+ metadata?: Record<string, any> | undefined;
53
+ email: string;
54
+ success: boolean;
55
+ operationType: "transactional" | "event" | "campaign" | "loop";
56
+ timestamp: number;
57
+ }, import("zodvex").ConvexValidatorFromZodFieldsAuto<{
58
+ operationType: import("zod").ZodEnum<{
59
+ transactional: "transactional";
60
+ event: "event";
61
+ campaign: "campaign";
62
+ loop: "loop";
63
+ }>;
64
+ email: import("zod").ZodString;
65
+ actorId: import("zod").ZodOptional<import("zod").ZodString>;
66
+ transactionalId: import("zod").ZodOptional<import("zod").ZodString>;
67
+ campaignId: import("zod").ZodOptional<import("zod").ZodString>;
68
+ loopId: import("zod").ZodOptional<import("zod").ZodString>;
69
+ eventName: import("zod").ZodOptional<import("zod").ZodString>;
70
+ timestamp: import("zod").ZodNumber;
71
+ success: import("zod").ZodBoolean;
72
+ messageId: import("zod").ZodOptional<import("zod").ZodString>;
73
+ metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
74
+ }>, "required", "email" | "success" | "operationType" | "actorId" | "transactionalId" | "campaignId" | "loopId" | "eventName" | "timestamp" | "messageId" | "metadata" | `metadata.${string}`>, {
75
+ email: ["email", "timestamp", "_creationTime"];
76
+ actorId: ["actorId", "timestamp", "_creationTime"];
77
+ operationType: ["operationType", "timestamp", "_creationTime"];
78
+ timestamp: ["timestamp", "_creationTime"];
79
+ }, {}, {}>;
80
+ }, true>;
81
+ };
82
+ export default _default;
83
+ //# sourceMappingURL=test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAE3C;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACvB,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,EACvD,IAAI,GAAE,MAAgB,EACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,QAQhD;AAED,OAAO,EAAE,MAAM,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElB,wBAAoC"}
package/dist/test.js ADDED
@@ -0,0 +1,16 @@
1
+ import schema from "./component/schema.js";
2
+ /**
3
+ * Register the Loops component with the test convex instance.
4
+ *
5
+ * @param t - The test convex instance from convexTest().
6
+ * @param name - The name of the component as registered in convex.config.ts.
7
+ * @param modules - The modules object from import.meta.glob. Required.
8
+ */
9
+ export function register(t, name = "loops", modules) {
10
+ if (!modules) {
11
+ throw new Error("modules parameter is required. Pass import.meta.glob from your test file.");
12
+ }
13
+ t.registerComponent(name, schema, modules);
14
+ }
15
+ export { schema };
16
+ export default { register, schema };
package/dist/types.d.ts CHANGED
@@ -1,26 +1,7 @@
1
- import type { Expand, FunctionArgs, FunctionReference, FunctionReturnType, StorageActionWriter, StorageReader } from "convex/server";
2
- import type { GenericId } from "convex/values";
3
- export type RunQueryCtx = {
4
- runQuery: <Query extends FunctionReference<"query", "internal">>(query: Query, args: FunctionArgs<Query>) => Promise<FunctionReturnType<Query>>;
5
- };
6
- export type RunMutationCtx = RunQueryCtx & {
7
- runMutation: <Mutation extends FunctionReference<"mutation", "internal">>(mutation: Mutation, args: FunctionArgs<Mutation>) => Promise<FunctionReturnType<Mutation>>;
8
- };
9
- export type RunActionCtx = RunMutationCtx & {
10
- runAction<Action extends FunctionReference<"action", "internal">>(action: Action, args: FunctionArgs<Action>): Promise<FunctionReturnType<Action>>;
11
- };
12
- export type ActionCtx = RunActionCtx & {
13
- storage: StorageActionWriter;
14
- };
15
- export type QueryCtx = RunQueryCtx & {
16
- storage: StorageReader;
17
- };
18
- export type OpaqueIds<T> = T extends GenericId<infer _T> ? string : T extends (infer U)[] ? OpaqueIds<U>[] : T extends ArrayBuffer ? ArrayBuffer : T extends object ? {
19
- [K in keyof T]: OpaqueIds<T[K]>;
20
- } : T;
21
- export type UseApi<API> = Expand<{
22
- [mod in keyof API]: API[mod] extends FunctionReference<infer FType, "public", infer FArgs, infer FReturnType, infer FComponentPath> ? FunctionReference<FType, "internal", OpaqueIds<FArgs>, OpaqueIds<FReturnType>, FComponentPath> : UseApi<API[mod]>;
23
- }>;
1
+ import type { GenericActionCtx, GenericDataModel, GenericMutationCtx, GenericQueryCtx } from "convex/server";
2
+ export type RunQueryCtx = Pick<GenericQueryCtx<GenericDataModel>, "runQuery">;
3
+ export type RunMutationCtx = Pick<GenericMutationCtx<GenericDataModel>, "runQuery" | "runMutation">;
4
+ export type RunActionCtx = Pick<GenericActionCtx<GenericDataModel>, "runQuery" | "runMutation" | "runAction">;
24
5
  export type HeadersInitParam = ConstructorParameters<typeof Headers>[0];
25
6
  export interface ContactPayload {
26
7
  email: string;
@@ -54,44 +35,250 @@ export interface TriggerPayload {
54
35
  dataVariables?: Record<string, unknown>;
55
36
  eventName?: string;
56
37
  }
57
- export type InternalActionRef<Args extends Record<string, unknown> = Record<string, unknown>, Result = unknown> = FunctionReference<"action", "internal", Args, Result>;
58
- export type InternalMutationRef<Args extends Record<string, unknown> = Record<string, unknown>, Result = unknown> = FunctionReference<"mutation", "internal", Args, Result>;
59
- export type InternalQueryRef<Args extends Record<string, unknown> = Record<string, unknown>, Result = unknown> = FunctionReference<"query", "internal", Args, Result>;
60
- type AddContactArgs = {
61
- apiKey: string;
62
- contact: ContactPayload;
63
- };
64
- type AddContactResult = {
65
- success: boolean;
66
- id?: string;
38
+ export declare const internalLib: {
39
+ storeContact: import("convex/server").FunctionReference<"mutation", "public", {
40
+ email: string;
41
+ firstName?: string | undefined;
42
+ lastName?: string | undefined;
43
+ userId?: string | undefined;
44
+ source?: string | undefined;
45
+ subscribed?: boolean | undefined;
46
+ userGroup?: string | undefined;
47
+ loopsContactId?: string | undefined;
48
+ }, null, string | undefined>;
49
+ removeContact: import("convex/server").FunctionReference<"mutation", "public", {
50
+ email: string;
51
+ }, null, string | undefined>;
52
+ logEmailOperation: import("convex/server").FunctionReference<"mutation", "public", {
53
+ operationType: "transactional" | "event" | "campaign" | "loop";
54
+ email: string;
55
+ success: boolean;
56
+ actorId?: string | undefined;
57
+ transactionalId?: string | undefined;
58
+ campaignId?: string | undefined;
59
+ loopId?: string | undefined;
60
+ eventName?: string | undefined;
61
+ messageId?: string | undefined;
62
+ metadata?: Record<string, any> | undefined;
63
+ }, null, string | undefined>;
64
+ countContacts: import("convex/server").FunctionReference<"query", "public", {
65
+ userGroup?: string | undefined;
66
+ source?: string | undefined;
67
+ subscribed?: boolean | undefined;
68
+ }, number, string | undefined>;
69
+ listContacts: import("convex/server").FunctionReference<"query", "public", {
70
+ limit: number;
71
+ userGroup?: string | undefined;
72
+ source?: string | undefined;
73
+ subscribed?: boolean | undefined;
74
+ cursor?: string | null | undefined;
75
+ }, {
76
+ contacts: {
77
+ _id: string;
78
+ email: string;
79
+ subscribed: boolean;
80
+ createdAt: number;
81
+ updatedAt: number;
82
+ firstName?: string | undefined;
83
+ lastName?: string | undefined;
84
+ userId?: string | undefined;
85
+ source?: string | undefined;
86
+ userGroup?: string | undefined;
87
+ loopsContactId?: string | undefined;
88
+ }[];
89
+ continueCursor: string | null;
90
+ isDone: boolean;
91
+ }, string | undefined>;
92
+ addContact: import("convex/server").FunctionReference<"action", "public", {
93
+ apiKey: string;
94
+ contact: {
95
+ email: string;
96
+ firstName?: string | undefined;
97
+ lastName?: string | undefined;
98
+ userId?: string | undefined;
99
+ source?: string | undefined;
100
+ subscribed?: boolean | undefined;
101
+ userGroup?: string | undefined;
102
+ };
103
+ }, {
104
+ success: boolean;
105
+ id?: string | undefined;
106
+ }, string | undefined>;
107
+ updateContact: import("convex/server").FunctionReference<"action", "public", {
108
+ apiKey: string;
109
+ email: string;
110
+ dataVariables?: Record<string, any> | undefined;
111
+ firstName?: string | undefined;
112
+ lastName?: string | undefined;
113
+ userId?: string | undefined;
114
+ source?: string | undefined;
115
+ subscribed?: boolean | undefined;
116
+ userGroup?: string | undefined;
117
+ }, {
118
+ success: boolean;
119
+ }, string | undefined>;
120
+ sendTransactional: import("convex/server").FunctionReference<"action", "public", {
121
+ apiKey: string;
122
+ transactionalId: string;
123
+ email: string;
124
+ dataVariables?: Record<string, any> | undefined;
125
+ }, {
126
+ success: boolean;
127
+ messageId?: string | undefined;
128
+ }, string | undefined>;
129
+ sendEvent: import("convex/server").FunctionReference<"action", "public", {
130
+ apiKey: string;
131
+ email: string;
132
+ eventName: string;
133
+ eventProperties?: Record<string, any> | undefined;
134
+ }, {
135
+ success: boolean;
136
+ }, string | undefined>;
137
+ deleteContact: import("convex/server").FunctionReference<"action", "public", {
138
+ apiKey: string;
139
+ email: string;
140
+ }, {
141
+ success: boolean;
142
+ }, string | undefined>;
143
+ triggerLoop: import("convex/server").FunctionReference<"action", "public", {
144
+ apiKey: string;
145
+ loopId: string;
146
+ email: string;
147
+ dataVariables?: Record<string, any> | undefined;
148
+ eventName?: string | undefined;
149
+ }, {
150
+ success: boolean;
151
+ warning?: string | undefined;
152
+ }, string | undefined>;
153
+ findContact: import("convex/server").FunctionReference<"action", "public", {
154
+ apiKey: string;
155
+ email: string;
156
+ }, {
157
+ success: boolean;
158
+ contact?: {
159
+ id?: string | null | undefined;
160
+ email?: string | null | undefined;
161
+ firstName?: string | null | undefined;
162
+ lastName?: string | null | undefined;
163
+ source?: string | null | undefined;
164
+ subscribed?: boolean | null | undefined;
165
+ userGroup?: string | null | undefined;
166
+ userId?: string | null | undefined;
167
+ createdAt?: string | null | undefined;
168
+ } | undefined;
169
+ }, string | undefined>;
170
+ batchCreateContacts: import("convex/server").FunctionReference<"action", "public", {
171
+ apiKey: string;
172
+ contacts: {
173
+ email: string;
174
+ firstName?: string | undefined;
175
+ lastName?: string | undefined;
176
+ userId?: string | undefined;
177
+ source?: string | undefined;
178
+ subscribed?: boolean | undefined;
179
+ userGroup?: string | undefined;
180
+ }[];
181
+ }, {
182
+ success: boolean;
183
+ created?: number | undefined;
184
+ failed?: number | undefined;
185
+ results?: {
186
+ email: string;
187
+ success: boolean;
188
+ error?: string | undefined;
189
+ }[] | undefined;
190
+ }, string | undefined>;
191
+ unsubscribeContact: import("convex/server").FunctionReference<"action", "public", {
192
+ apiKey: string;
193
+ email: string;
194
+ }, {
195
+ success: boolean;
196
+ }, string | undefined>;
197
+ resubscribeContact: import("convex/server").FunctionReference<"action", "public", {
198
+ apiKey: string;
199
+ email: string;
200
+ }, {
201
+ success: boolean;
202
+ }, string | undefined>;
203
+ detectRecipientSpam: import("convex/server").FunctionReference<"query", "public", {
204
+ timeWindowMs: number;
205
+ maxEmailsPerRecipient: number;
206
+ }, {
207
+ [x: string]: any;
208
+ email: string;
209
+ count: number;
210
+ timeWindowMs: number;
211
+ }[], string | undefined>;
212
+ detectActorSpam: import("convex/server").FunctionReference<"query", "public", {
213
+ timeWindowMs: number;
214
+ maxEmailsPerActor: number;
215
+ }, {
216
+ actorId: string;
217
+ count: number;
218
+ timeWindowMs: number;
219
+ }[], string | undefined>;
220
+ getEmailStats: import("convex/server").FunctionReference<"query", "public", {
221
+ timeWindowMs: number;
222
+ }, {
223
+ [x: string]: any;
224
+ totalOperations: number;
225
+ successfulOperations: number;
226
+ failedOperations: number;
227
+ operationsByType: Record<string, number>;
228
+ uniqueRecipients: number;
229
+ uniqueActors: number;
230
+ }, string | undefined>;
231
+ detectRapidFirePatterns: import("convex/server").FunctionReference<"query", "public", {
232
+ timeWindowMs: number;
233
+ minEmailsInWindow: number;
234
+ }, {
235
+ count: number;
236
+ timeWindowMs: number;
237
+ firstTimestamp: number;
238
+ lastTimestamp: number;
239
+ email?: string | undefined;
240
+ actorId?: string | undefined;
241
+ }[], string | undefined>;
242
+ checkRecipientRateLimit: import("convex/server").FunctionReference<"query", "public", {
243
+ email: string;
244
+ timeWindowMs: number;
245
+ maxEmails: number;
246
+ }, {
247
+ [x: string]: any;
248
+ allowed: boolean;
249
+ count: number;
250
+ limit: number;
251
+ timeWindowMs: number;
252
+ retryAfter?: number | undefined;
253
+ }, string | undefined>;
254
+ checkActorRateLimit: import("convex/server").FunctionReference<"query", "public", {
255
+ actorId: string;
256
+ timeWindowMs: number;
257
+ maxEmails: number;
258
+ }, {
259
+ allowed: boolean;
260
+ count: number;
261
+ limit: number;
262
+ timeWindowMs: number;
263
+ retryAfter?: number | undefined;
264
+ }, string | undefined>;
265
+ checkGlobalRateLimit: import("convex/server").FunctionReference<"query", "public", {
266
+ timeWindowMs: number;
267
+ maxEmails: number;
268
+ }, {
269
+ allowed: boolean;
270
+ count: number;
271
+ limit: number;
272
+ timeWindowMs: number;
273
+ }, string | undefined>;
274
+ backfillContactAggregate: import("convex/server").FunctionReference<"mutation", "public", {
275
+ batchSize: number;
276
+ cursor?: string | null | undefined;
277
+ clear?: boolean | undefined;
278
+ }, {
279
+ processed: number;
280
+ cursor: string | null;
281
+ isDone: boolean;
282
+ }, string | undefined>;
67
283
  };
68
- export interface InternalActionLib {
69
- addContact: InternalActionRef<AddContactArgs, AddContactResult>;
70
- updateContact: InternalActionRef;
71
- findContact: InternalActionRef;
72
- deleteContact: InternalActionRef;
73
- sendTransactional: InternalActionRef;
74
- sendEvent: InternalActionRef;
75
- triggerLoop: InternalActionRef;
76
- batchCreateContacts: InternalActionRef;
77
- unsubscribeContact: InternalActionRef;
78
- resubscribeContact: InternalActionRef;
79
- storeContact: InternalMutationRef;
80
- removeContact: InternalMutationRef;
81
- logEmailOperation: InternalMutationRef;
82
- }
83
- export interface InternalQueryLib {
84
- countContacts: InternalQueryRef;
85
- listContacts: InternalQueryRef;
86
- detectRecipientSpam: InternalQueryRef;
87
- detectActorSpam: InternalQueryRef;
88
- getEmailStats: InternalQueryRef;
89
- detectRapidFirePatterns: InternalQueryRef;
90
- checkRecipientRateLimit: InternalQueryRef;
91
- checkActorRateLimit: InternalQueryRef;
92
- checkGlobalRateLimit: InternalQueryRef;
93
- }
94
- export type InternalLibReferences = InternalActionLib & InternalQueryLib;
95
- export declare const internalLib: InternalLibReferences;
96
- export {};
97
284
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,MAAM,EACN,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/C,MAAM,MAAM,WAAW,GAAG;IACzB,QAAQ,EAAE,CAAC,KAAK,SAAS,iBAAiB,CAAC,OAAO,EAAE,UAAU,CAAC,EAC9D,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,KACrB,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;CACxC,CAAC;AA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAU,CAAC"}
package/dist/types.js CHANGED
@@ -1,2 +1,4 @@
1
- import { internal } from "./component/_generated/api";
2
- export const internalLib = internal.lib;
1
+ import { api } from "./component/_generated/api";
2
+ // Lib reference for component internals
3
+ // This is used internally by the component to call its own functions
4
+ export const internalLib = api.lib;
package/dist/utils.d.ts CHANGED
@@ -33,19 +33,19 @@ export declare const zq: <A extends import("zod").ZodType | Record<string, impor
33
33
  document: {
34
34
  _id: import("convex/values").GenericId<"emailOperations">;
35
35
  _creationTime: number;
36
- metadata?: Record<string, any> | undefined;
37
36
  actorId?: string | undefined;
38
37
  transactionalId?: string | undefined;
39
38
  campaignId?: string | undefined;
40
39
  loopId?: string | undefined;
41
40
  eventName?: string | undefined;
42
41
  messageId?: string | undefined;
42
+ metadata?: Record<string, any> | undefined;
43
43
  email: string;
44
44
  success: boolean;
45
45
  operationType: "transactional" | "event" | "campaign" | "loop";
46
46
  timestamp: number;
47
47
  };
48
- fieldPaths: ("email" | "success" | "metadata" | "operationType" | "actorId" | "transactionalId" | "campaignId" | "loopId" | "eventName" | "timestamp" | "messageId" | "_creationTime" | `metadata.${string}`) | "_id";
48
+ fieldPaths: ("email" | "success" | "operationType" | "actorId" | "transactionalId" | "campaignId" | "loopId" | "eventName" | "timestamp" | "messageId" | "metadata" | "_creationTime" | `metadata.${string}`) | "_id";
49
49
  indexes: {
50
50
  email: ["email", "timestamp", "_creationTime"];
51
51
  actorId: ["actorId", "timestamp", "_creationTime"];
@@ -95,19 +95,19 @@ export declare const zm: <A extends import("zod").ZodType | Record<string, impor
95
95
  document: {
96
96
  _id: import("convex/values").GenericId<"emailOperations">;
97
97
  _creationTime: number;
98
- metadata?: Record<string, any> | undefined;
99
98
  actorId?: string | undefined;
100
99
  transactionalId?: string | undefined;
101
100
  campaignId?: string | undefined;
102
101
  loopId?: string | undefined;
103
102
  eventName?: string | undefined;
104
103
  messageId?: string | undefined;
104
+ metadata?: Record<string, any> | undefined;
105
105
  email: string;
106
106
  success: boolean;
107
107
  operationType: "transactional" | "event" | "campaign" | "loop";
108
108
  timestamp: number;
109
109
  };
110
- fieldPaths: ("email" | "success" | "metadata" | "operationType" | "actorId" | "transactionalId" | "campaignId" | "loopId" | "eventName" | "timestamp" | "messageId" | "_creationTime" | `metadata.${string}`) | "_id";
110
+ fieldPaths: ("email" | "success" | "operationType" | "actorId" | "transactionalId" | "campaignId" | "loopId" | "eventName" | "timestamp" | "messageId" | "metadata" | "_creationTime" | `metadata.${string}`) | "_id";
111
111
  indexes: {
112
112
  email: ["email", "timestamp", "_creationTime"];
113
113
  actorId: ["actorId", "timestamp", "_creationTime"];
@@ -157,19 +157,19 @@ export declare const za: <A extends import("zod").ZodType | Record<string, impor
157
157
  document: {
158
158
  _id: import("convex/values").GenericId<"emailOperations">;
159
159
  _creationTime: number;
160
- metadata?: Record<string, any> | undefined;
161
160
  actorId?: string | undefined;
162
161
  transactionalId?: string | undefined;
163
162
  campaignId?: string | undefined;
164
163
  loopId?: string | undefined;
165
164
  eventName?: string | undefined;
166
165
  messageId?: string | undefined;
166
+ metadata?: Record<string, any> | undefined;
167
167
  email: string;
168
168
  success: boolean;
169
169
  operationType: "transactional" | "event" | "campaign" | "loop";
170
170
  timestamp: number;
171
171
  };
172
- fieldPaths: ("email" | "success" | "metadata" | "operationType" | "actorId" | "transactionalId" | "campaignId" | "loopId" | "eventName" | "timestamp" | "messageId" | "_creationTime" | `metadata.${string}`) | "_id";
172
+ fieldPaths: ("email" | "success" | "operationType" | "actorId" | "transactionalId" | "campaignId" | "loopId" | "eventName" | "timestamp" | "messageId" | "metadata" | "_creationTime" | `metadata.${string}`) | "_id";
173
173
  indexes: {
174
174
  email: ["email", "timestamp", "_creationTime"];
175
175
  actorId: ["actorId", "timestamp", "_creationTime"];
package/package.json CHANGED
@@ -1,16 +1,20 @@
1
1
  {
2
2
  "name": "@devwithbobby/loops",
3
- "version": "0.1.18",
3
+ "version": "0.2.0",
4
4
  "description": "Convex component for integrating with Loops.so email marketing platform",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
+ "main": "dist/client/index.js",
8
+ "types": "dist/client/index.d.ts",
7
9
  "keywords": [
8
10
  "convex",
9
11
  "component",
10
- "template",
11
- "boilerplate",
12
- "bun",
13
- "biome",
12
+ "loops",
13
+ "loops.so",
14
+ "email",
15
+ "email-marketing",
16
+ "transactional-email",
17
+ "newsletter",
14
18
  "typescript"
15
19
  ],
16
20
  "repository": {
@@ -30,15 +34,24 @@
30
34
  "exports": {
31
35
  "./package.json": "./package.json",
32
36
  ".": {
33
- "@convex-dev/component-source": "./src/client/index.ts",
34
37
  "types": "./dist/client/index.d.ts",
35
38
  "default": "./dist/client/index.js"
36
39
  },
37
40
  "./convex.config": {
38
- "@convex-dev/component-source": "./src/component/convex.config.ts",
39
41
  "types": "./dist/component/convex.config.d.ts",
40
- "default": "./src/component/convex.config.ts"
41
- }
42
+ "default": "./dist/component/convex.config.js"
43
+ },
44
+ "./convex.config.js": {
45
+ "types": "./dist/component/convex.config.d.ts",
46
+ "default": "./dist/component/convex.config.js"
47
+ },
48
+ "./_generated/component": {
49
+ "types": "./dist/component/_generated/component.d.ts"
50
+ },
51
+ "./_generated/component.js": {
52
+ "types": "./dist/component/_generated/component.d.ts"
53
+ },
54
+ "./test": "./src/test.ts"
42
55
  },
43
56
  "scripts": {
44
57
  "dev": "run-p -r 'dev:backend' 'dev:frontend' 'build:watch'",
@@ -57,7 +70,7 @@
57
70
  "check": "biome check .",
58
71
  "check:fix": "biome check --write .",
59
72
  "typecheck": "tsc --noEmit",
60
- "attw": "attw $(npm pack -s) --exclude-entrypoints ./convex.config --profile esm-only",
73
+ "attw": "attw $(npm pack -s) --exclude-entrypoints ./convex.config ./test --profile esm-only --ignore-rules internal-resolution-error",
61
74
  "prepare": "npm run build || true",
62
75
  "changeset": "changeset",
63
76
  "ci:version": "changeset version && bun update",
@@ -69,13 +82,12 @@
69
82
  "release": "bun run preversion && npm version patch && npm publish"
70
83
  },
71
84
  "dependencies": {
85
+ "@convex-dev/aggregate": "^0.2.1",
72
86
  "zod": "^4.1.12",
73
87
  "zodvex": "^0.2.3"
74
88
  },
75
89
  "peerDependencies": {
76
- "convex": "^1.0.0",
77
- "react": "^18.0.0 || ^19.0.0",
78
- "typescript": "^5.9.3"
90
+ "convex": "^1.0.0"
79
91
  },
80
92
  "devDependencies": {
81
93
  "@arethetypeswrong/cli": "^0.18.2",