@devwithbobby/loops 0.1.12 → 0.1.14

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 (41) hide show
  1. package/dist/client/index.d.ts +305 -44
  2. package/dist/client/index.d.ts.map +1 -1
  3. package/dist/client/index.js +21 -32
  4. package/dist/component/convex.config.d.ts +1 -1
  5. package/dist/component/convex.config.d.ts.map +1 -1
  6. package/dist/component/convex.config.js +1 -1
  7. package/dist/component/helpers.d.ts +7 -0
  8. package/dist/component/helpers.d.ts.map +1 -0
  9. package/dist/component/helpers.js +30 -0
  10. package/dist/component/http.d.ts +3 -0
  11. package/dist/component/http.d.ts.map +1 -0
  12. package/dist/component/http.js +268 -0
  13. package/dist/component/lib.d.ts +237 -22
  14. package/dist/component/lib.d.ts.map +1 -1
  15. package/dist/component/lib.js +91 -143
  16. package/dist/component/schema.d.ts +66 -1
  17. package/dist/component/schema.d.ts.map +1 -1
  18. package/dist/component/tables/contacts.d.ts +123 -1
  19. package/dist/component/tables/contacts.d.ts.map +1 -1
  20. package/dist/component/tables/emailOperations.d.ts +151 -1
  21. package/dist/component/tables/emailOperations.d.ts.map +1 -1
  22. package/dist/component/tables/emailOperations.js +1 -6
  23. package/dist/component/validators.d.ts +20 -3
  24. package/dist/component/validators.d.ts.map +1 -1
  25. package/dist/types.d.ts +97 -0
  26. package/dist/types.d.ts.map +1 -0
  27. package/dist/types.js +2 -0
  28. package/dist/utils.d.ts +186 -3
  29. package/dist/utils.d.ts.map +1 -1
  30. package/package.json +101 -101
  31. package/src/client/index.ts +40 -52
  32. package/src/component/_generated/api.d.ts +3 -11
  33. package/src/component/convex.config.ts +7 -2
  34. package/src/component/helpers.ts +44 -0
  35. package/src/component/http.ts +304 -0
  36. package/src/component/lib.ts +189 -204
  37. package/src/component/tables/contacts.ts +0 -1
  38. package/src/component/tables/emailOperations.ts +1 -7
  39. package/src/component/validators.ts +0 -1
  40. package/src/types.ts +168 -0
  41. package/src/client/types.ts +0 -64
@@ -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(),
@@ -1,3 +1,4 @@
1
+ import { z } from "zod";
1
2
  /**
2
3
  * Validators for Loops API requests and component operations
3
4
  */
@@ -5,14 +6,30 @@
5
6
  * Validator for contact data
6
7
  * Used for creating and updating contacts
7
8
  */
8
- export declare const contactValidator: any;
9
+ export declare const contactValidator: z.ZodObject<{
10
+ email: z.ZodString;
11
+ firstName: z.ZodOptional<z.ZodString>;
12
+ lastName: z.ZodOptional<z.ZodString>;
13
+ userId: z.ZodOptional<z.ZodString>;
14
+ source: z.ZodOptional<z.ZodString>;
15
+ subscribed: z.ZodOptional<z.ZodBoolean>;
16
+ userGroup: z.ZodOptional<z.ZodString>;
17
+ }, z.core.$strip>;
9
18
  /**
10
19
  * Validator for transactional email requests
11
20
  */
12
- export declare const transactionalEmailValidator: any;
21
+ export declare const transactionalEmailValidator: z.ZodObject<{
22
+ transactionalId: z.ZodOptional<z.ZodString>;
23
+ email: z.ZodString;
24
+ dataVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
25
+ }, z.core.$strip>;
13
26
  /**
14
27
  * Validator for event requests
15
28
  * Used for sending events that trigger email workflows
16
29
  */
17
- export declare const eventValidator: any;
30
+ export declare const eventValidator: z.ZodObject<{
31
+ email: z.ZodString;
32
+ eventName: z.ZodString;
33
+ eventProperties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
34
+ }, z.core.$strip>;
18
35
  //# sourceMappingURL=validators.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/component/validators.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,KAQ3B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,2BAA2B,KAItC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,cAAc,KAIzB,CAAC"}
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/component/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;iBAQ3B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;;iBAItC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;iBAIzB,CAAC"}
@@ -0,0 +1,97 @@
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
+ }>;
24
+ export type HeadersInitParam = ConstructorParameters<typeof Headers>[0];
25
+ export interface ContactPayload {
26
+ email: string;
27
+ firstName?: string;
28
+ lastName?: string;
29
+ userId?: string;
30
+ source?: string;
31
+ subscribed?: boolean;
32
+ userGroup?: string;
33
+ }
34
+ export interface UpdateContactPayload extends Partial<ContactPayload> {
35
+ email: string;
36
+ dataVariables?: Record<string, unknown>;
37
+ }
38
+ export interface DeleteContactPayload {
39
+ email?: string;
40
+ }
41
+ export interface TransactionalPayload {
42
+ transactionalId?: string;
43
+ email?: string;
44
+ dataVariables?: Record<string, unknown>;
45
+ }
46
+ export interface EventPayload {
47
+ email?: string;
48
+ eventName?: string;
49
+ eventProperties?: Record<string, unknown>;
50
+ }
51
+ export interface TriggerPayload {
52
+ loopId?: string;
53
+ email?: string;
54
+ dataVariables?: Record<string, unknown>;
55
+ eventName?: string;
56
+ }
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;
67
+ };
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
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +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;A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,CAAC;CACZ,CAAC;AAEF,MAAM,WAAW,iBAAiB;IACjC,UAAU,EAAE,iBAAiB,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;IAChE,aAAa,EAAE,iBAAiB,CAAC;IACjC,WAAW,EAAE,iBAAiB,CAAC;IAC/B,aAAa,EAAE,iBAAiB,CAAC;IACjC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,SAAS,EAAE,iBAAiB,CAAC;IAC7B,WAAW,EAAE,iBAAiB,CAAC;IAC/B,mBAAmB,EAAE,iBAAiB,CAAC;IACvC,kBAAkB,EAAE,iBAAiB,CAAC;IACtC,kBAAkB,EAAE,iBAAiB,CAAC;IACtC,YAAY,EAAE,mBAAmB,CAAC;IAClC,aAAa,EAAE,mBAAmB,CAAC;IACnC,iBAAiB,EAAE,mBAAmB,CAAC;CACvC;AAED,MAAM,WAAW,gBAAgB;IAChC,aAAa,EAAE,gBAAgB,CAAC;IAChC,YAAY,EAAE,gBAAgB,CAAC;IAC/B,mBAAmB,EAAE,gBAAgB,CAAC;IACtC,eAAe,EAAE,gBAAgB,CAAC;IAClC,aAAa,EAAE,gBAAgB,CAAC;IAChC,uBAAuB,EAAE,gBAAgB,CAAC;IAC1C,uBAAuB,EAAE,gBAAgB,CAAC;IAC1C,mBAAmB,EAAE,gBAAgB,CAAC;IACtC,oBAAoB,EAAE,gBAAgB,CAAC;CACvC;AAED,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AAEzE,eAAO,MAAM,WAAW,uBAEnB,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ import { internal } from "./component/_generated/api";
2
+ export const internalLib = internal.lib;