@keystrokehq/sendgrid 0.0.15 → 0.0.16-integration-id-canonicalization.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 (68) hide show
  1. package/README.md +59 -111
  2. package/dist/credential-sets/index.d.mts +2 -0
  3. package/dist/credential-sets/index.mjs +3 -0
  4. package/dist/index.d.mts +4 -1
  5. package/dist/index.mjs +5 -1
  6. package/dist/operations/index.d.mts +2 -0
  7. package/dist/operations/index.mjs +3 -0
  8. package/dist/schemas/index.d.mts +5 -5
  9. package/dist/schemas/index.mjs +1 -1
  10. package/dist/{integration-DHWfpe0w.mjs → sendgrid.credential-set-CzYmlJ2Y.mjs} +9 -8
  11. package/dist/sendgrid.credential-set-ivRIiUDy.d.mts +32 -0
  12. package/dist/validate-email.operation-CCCDxLjH.mjs +4301 -0
  13. package/dist/validate-email.operation-DY4rCHFE.d.mts +5436 -0
  14. package/package.json +11 -99
  15. package/dist/_official/index.d.mts +0 -2
  16. package/dist/_official/index.mjs +0 -3
  17. package/dist/_runtime/index.d.mts +0 -2
  18. package/dist/_runtime/index.mjs +0 -3
  19. package/dist/alerts.d.mts +0 -147
  20. package/dist/alerts.mjs +0 -101
  21. package/dist/api-keys.d.mts +0 -105
  22. package/dist/api-keys.mjs +0 -113
  23. package/dist/client.d.mts +0 -73
  24. package/dist/client.mjs +0 -261
  25. package/dist/connection.d.mts +0 -2
  26. package/dist/connection.mjs +0 -3
  27. package/dist/domains.d.mts +0 -86
  28. package/dist/domains.mjs +0 -62
  29. package/dist/email-validation.d.mts +0 -97
  30. package/dist/email-validation.mjs +0 -73
  31. package/dist/events.d.mts +0 -69
  32. package/dist/events.mjs +0 -28
  33. package/dist/factory-7q6CQ75J.mjs +0 -25
  34. package/dist/integration-Cj4Xzfq_.d.mts +0 -48
  35. package/dist/mail-send.d.mts +0 -242
  36. package/dist/mail-send.mjs +0 -218
  37. package/dist/marketing-contacts.d.mts +0 -462
  38. package/dist/marketing-contacts.mjs +0 -277
  39. package/dist/marketing-customfields.d.mts +0 -66
  40. package/dist/marketing-customfields.mjs +0 -70
  41. package/dist/marketing-lists.d.mts +0 -120
  42. package/dist/marketing-lists.mjs +0 -130
  43. package/dist/marketing-segments.d.mts +0 -249
  44. package/dist/marketing-segments.mjs +0 -179
  45. package/dist/marketing-singlesends.d.mts +0 -521
  46. package/dist/marketing-singlesends.mjs +0 -277
  47. package/dist/operations.d.mts +0 -25
  48. package/dist/operations.mjs +0 -69
  49. package/dist/sender-identities.d.mts +0 -163
  50. package/dist/sender-identities.mjs +0 -109
  51. package/dist/senders.d.mts +0 -181
  52. package/dist/senders.mjs +0 -83
  53. package/dist/shared-CQ8JFNXi.mjs +0 -13
  54. package/dist/stats.d.mts +0 -169
  55. package/dist/stats.mjs +0 -107
  56. package/dist/suppressions.d.mts +0 -505
  57. package/dist/suppressions.mjs +0 -539
  58. package/dist/templates.d.mts +0 -351
  59. package/dist/templates.mjs +0 -238
  60. package/dist/user-account.d.mts +0 -71
  61. package/dist/user-account.mjs +0 -59
  62. package/dist/verification.d.mts +0 -67
  63. package/dist/verification.mjs +0 -72
  64. package/dist/webhooks/event.d.mts +0 -214
  65. package/dist/webhooks/event.mjs +0 -147
  66. package/dist/webhooks/parse.d.mts +0 -117
  67. package/dist/webhooks/parse.mjs +0 -125
  68. /package/dist/{webhooks-CKdsIikb.mjs → webhooks-dVOd93Hd.mjs} +0 -0
@@ -1,181 +0,0 @@
1
- import { z } from "zod";
2
- import * as _keystrokehq_core0 from "@keystrokehq/core";
3
-
4
- //#region src/senders.d.ts
5
- declare const createSender: _keystrokehq_core0.Operation<z.ZodObject<{
6
- nickname: z.ZodString;
7
- from: z.ZodObject<{
8
- email: z.ZodString;
9
- name: z.ZodOptional<z.ZodString>;
10
- }, z.core.$strip>;
11
- reply_to: z.ZodObject<{
12
- email: z.ZodString;
13
- name: z.ZodOptional<z.ZodString>;
14
- }, z.core.$strip>;
15
- address: z.ZodString;
16
- address_2: z.ZodOptional<z.ZodString>;
17
- city: z.ZodString;
18
- state: z.ZodOptional<z.ZodString>;
19
- zip: z.ZodOptional<z.ZodString>;
20
- country: z.ZodString;
21
- }, z.core.$strip>, z.ZodObject<{
22
- id: z.ZodNumber;
23
- nickname: z.ZodString;
24
- from: z.ZodOptional<z.ZodObject<{
25
- email: z.ZodString;
26
- name: z.ZodOptional<z.ZodString>;
27
- }, z.core.$strip>>;
28
- reply_to: z.ZodOptional<z.ZodObject<{
29
- email: z.ZodString;
30
- name: z.ZodOptional<z.ZodString>;
31
- }, z.core.$strip>>;
32
- address: z.ZodOptional<z.ZodString>;
33
- address_2: z.ZodOptional<z.ZodString>;
34
- city: z.ZodOptional<z.ZodString>;
35
- state: z.ZodOptional<z.ZodString>;
36
- zip: z.ZodOptional<z.ZodString>;
37
- country: z.ZodOptional<z.ZodString>;
38
- verified: z.ZodOptional<z.ZodBoolean>;
39
- locked: z.ZodOptional<z.ZodBoolean>;
40
- created_at: z.ZodOptional<z.ZodNumber>;
41
- updated_at: z.ZodOptional<z.ZodNumber>;
42
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
43
- SENDGRID_API_KEY: z.ZodString;
44
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
45
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
46
- global: "global";
47
- eu: "eu";
48
- }>>;
49
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
50
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
51
- }, z.core.$strip>>], undefined>;
52
- declare const updateSender: _keystrokehq_core0.Operation<z.ZodObject<{
53
- nickname: z.ZodOptional<z.ZodString>;
54
- from: z.ZodOptional<z.ZodObject<{
55
- email: z.ZodString;
56
- name: z.ZodOptional<z.ZodString>;
57
- }, z.core.$strip>>;
58
- reply_to: z.ZodOptional<z.ZodObject<{
59
- email: z.ZodString;
60
- name: z.ZodOptional<z.ZodString>;
61
- }, z.core.$strip>>;
62
- address: z.ZodOptional<z.ZodString>;
63
- address_2: z.ZodOptional<z.ZodOptional<z.ZodString>>;
64
- city: z.ZodOptional<z.ZodString>;
65
- state: z.ZodOptional<z.ZodOptional<z.ZodString>>;
66
- zip: z.ZodOptional<z.ZodOptional<z.ZodString>>;
67
- country: z.ZodOptional<z.ZodString>;
68
- senderId: z.ZodNumber;
69
- }, z.core.$strip>, z.ZodObject<{
70
- id: z.ZodNumber;
71
- nickname: z.ZodString;
72
- from: z.ZodOptional<z.ZodObject<{
73
- email: z.ZodString;
74
- name: z.ZodOptional<z.ZodString>;
75
- }, z.core.$strip>>;
76
- reply_to: z.ZodOptional<z.ZodObject<{
77
- email: z.ZodString;
78
- name: z.ZodOptional<z.ZodString>;
79
- }, z.core.$strip>>;
80
- address: z.ZodOptional<z.ZodString>;
81
- address_2: z.ZodOptional<z.ZodString>;
82
- city: z.ZodOptional<z.ZodString>;
83
- state: z.ZodOptional<z.ZodString>;
84
- zip: z.ZodOptional<z.ZodString>;
85
- country: z.ZodOptional<z.ZodString>;
86
- verified: z.ZodOptional<z.ZodBoolean>;
87
- locked: z.ZodOptional<z.ZodBoolean>;
88
- created_at: z.ZodOptional<z.ZodNumber>;
89
- updated_at: z.ZodOptional<z.ZodNumber>;
90
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
91
- SENDGRID_API_KEY: z.ZodString;
92
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
93
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
94
- global: "global";
95
- eu: "eu";
96
- }>>;
97
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
98
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
99
- }, z.core.$strip>>], undefined>;
100
- declare const deleteSender: _keystrokehq_core0.Operation<z.ZodObject<{
101
- senderId: z.ZodNumber;
102
- }, z.core.$strip>, z.ZodObject<{
103
- success: z.ZodBoolean;
104
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
105
- SENDGRID_API_KEY: z.ZodString;
106
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
107
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
108
- global: "global";
109
- eu: "eu";
110
- }>>;
111
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
112
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
113
- }, z.core.$strip>>], undefined>;
114
- declare const getSender: _keystrokehq_core0.Operation<z.ZodObject<{
115
- senderId: z.ZodNumber;
116
- }, z.core.$strip>, z.ZodObject<{
117
- id: z.ZodNumber;
118
- nickname: z.ZodString;
119
- from: z.ZodOptional<z.ZodObject<{
120
- email: z.ZodString;
121
- name: z.ZodOptional<z.ZodString>;
122
- }, z.core.$strip>>;
123
- reply_to: z.ZodOptional<z.ZodObject<{
124
- email: z.ZodString;
125
- name: z.ZodOptional<z.ZodString>;
126
- }, z.core.$strip>>;
127
- address: z.ZodOptional<z.ZodString>;
128
- address_2: z.ZodOptional<z.ZodString>;
129
- city: z.ZodOptional<z.ZodString>;
130
- state: z.ZodOptional<z.ZodString>;
131
- zip: z.ZodOptional<z.ZodString>;
132
- country: z.ZodOptional<z.ZodString>;
133
- verified: z.ZodOptional<z.ZodBoolean>;
134
- locked: z.ZodOptional<z.ZodBoolean>;
135
- created_at: z.ZodOptional<z.ZodNumber>;
136
- updated_at: z.ZodOptional<z.ZodNumber>;
137
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
138
- SENDGRID_API_KEY: z.ZodString;
139
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
140
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
141
- global: "global";
142
- eu: "eu";
143
- }>>;
144
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
145
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
146
- }, z.core.$strip>>], undefined>;
147
- declare const listSenders: _keystrokehq_core0.Operation<z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
148
- results: z.ZodArray<z.ZodObject<{
149
- id: z.ZodNumber;
150
- nickname: z.ZodString;
151
- from: z.ZodOptional<z.ZodObject<{
152
- email: z.ZodString;
153
- name: z.ZodOptional<z.ZodString>;
154
- }, z.core.$strip>>;
155
- reply_to: z.ZodOptional<z.ZodObject<{
156
- email: z.ZodString;
157
- name: z.ZodOptional<z.ZodString>;
158
- }, z.core.$strip>>;
159
- address: z.ZodOptional<z.ZodString>;
160
- address_2: z.ZodOptional<z.ZodString>;
161
- city: z.ZodOptional<z.ZodString>;
162
- state: z.ZodOptional<z.ZodString>;
163
- zip: z.ZodOptional<z.ZodString>;
164
- country: z.ZodOptional<z.ZodString>;
165
- verified: z.ZodOptional<z.ZodBoolean>;
166
- locked: z.ZodOptional<z.ZodBoolean>;
167
- created_at: z.ZodOptional<z.ZodNumber>;
168
- updated_at: z.ZodOptional<z.ZodNumber>;
169
- }, z.core.$catchall<z.ZodUnknown>>>;
170
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
171
- SENDGRID_API_KEY: z.ZodString;
172
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
173
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
174
- global: "global";
175
- eu: "eu";
176
- }>>;
177
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
178
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
179
- }, z.core.$strip>>], undefined>;
180
- //#endregion
181
- export { createSender, deleteSender, getSender, listSenders, updateSender };
package/dist/senders.mjs DELETED
@@ -1,83 +0,0 @@
1
- import { n as __exportAll, t as sendgridOperation } from "./factory-7q6CQ75J.mjs";
2
- import { createSendGridClient } from "./client.mjs";
3
- import { et as sendgridSenderAddressSchema, nt as sendgridSenderSchema, tt as sendgridSenderListSchema } from "./webhooks-CKdsIikb.mjs";
4
- import { z } from "zod";
5
-
6
- //#region src/senders.ts
7
- var senders_exports = /* @__PURE__ */ __exportAll({
8
- createSender: () => createSender,
9
- deleteSender: () => deleteSender,
10
- getSender: () => getSender,
11
- listSenders: () => listSenders,
12
- updateSender: () => updateSender
13
- });
14
- const senderId = z.number().int().positive();
15
- const createSender = sendgridOperation({
16
- id: "sendgrid.create-sender",
17
- name: "Create Marketing Sender",
18
- description: "Create a Marketing Campaigns sender.",
19
- input: sendgridSenderAddressSchema,
20
- output: sendgridSenderSchema,
21
- needsApproval: true,
22
- run: async (input, credentials) => {
23
- const response = await createSendGridClient(credentials).request("/marketing/senders", {
24
- method: "POST",
25
- body: input
26
- });
27
- return sendgridSenderSchema.parse(response);
28
- }
29
- });
30
- const updateSender = sendgridOperation({
31
- id: "sendgrid.update-sender",
32
- name: "Update Marketing Sender",
33
- description: "Update a Marketing Campaigns sender.",
34
- input: sendgridSenderAddressSchema.partial().extend({ senderId }),
35
- output: sendgridSenderSchema,
36
- needsApproval: true,
37
- run: async (input, credentials) => {
38
- const client = createSendGridClient(credentials);
39
- const { senderId: id, ...rest } = input;
40
- const response = await client.request(`/marketing/senders/${id}`, {
41
- method: "PATCH",
42
- body: rest
43
- });
44
- return sendgridSenderSchema.parse(response);
45
- }
46
- });
47
- const deleteSender = sendgridOperation({
48
- id: "sendgrid.delete-sender",
49
- name: "Delete Marketing Sender",
50
- description: "Delete a Marketing Campaigns sender.",
51
- input: z.object({ senderId }),
52
- output: z.object({ success: z.boolean() }),
53
- needsApproval: true,
54
- run: async (input, credentials) => {
55
- await createSendGridClient(credentials).request(`/marketing/senders/${input.senderId}`, { method: "DELETE" });
56
- return { success: true };
57
- }
58
- });
59
- const getSender = sendgridOperation({
60
- id: "sendgrid.get-sender",
61
- name: "Get Marketing Sender",
62
- description: "Retrieve a Marketing Campaigns sender by ID.",
63
- input: z.object({ senderId }),
64
- output: sendgridSenderSchema,
65
- run: async (input, credentials) => {
66
- const response = await createSendGridClient(credentials).request(`/marketing/senders/${input.senderId}`);
67
- return sendgridSenderSchema.parse(response);
68
- }
69
- });
70
- const listSenders = sendgridOperation({
71
- id: "sendgrid.list-senders",
72
- name: "List Marketing Senders",
73
- description: "List all Marketing Campaigns senders.",
74
- input: z.object({}).optional(),
75
- output: sendgridSenderListSchema,
76
- run: async (_input, credentials) => {
77
- const response = await createSendGridClient(credentials).request("/marketing/senders");
78
- return sendgridSenderListSchema.parse(response ?? { results: [] });
79
- }
80
- });
81
-
82
- //#endregion
83
- export { createSender, deleteSender, getSender, listSenders, senders_exports as t, updateSender };
@@ -1,13 +0,0 @@
1
- //#region src/shared.ts
2
- function asRecord(value) {
3
- return typeof value === "object" && value !== null ? value : {};
4
- }
5
- function stringIfPresent(value) {
6
- return typeof value === "string" && value.length > 0 ? value : void 0;
7
- }
8
- function omitUndefined(value) {
9
- return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== void 0));
10
- }
11
-
12
- //#endregion
13
- export { omitUndefined as n, stringIfPresent as r, asRecord as t };
package/dist/stats.d.mts DELETED
@@ -1,169 +0,0 @@
1
- import { z } from "zod";
2
- import * as _keystrokehq_core0 from "@keystrokehq/core";
3
-
4
- //#region src/stats.d.ts
5
- declare const getGlobalEmailStats: _keystrokehq_core0.Operation<z.ZodObject<{
6
- startDate: z.ZodISODate;
7
- endDate: z.ZodOptional<z.ZodISODate>;
8
- aggregatedBy: z.ZodOptional<z.ZodEnum<{
9
- day: "day";
10
- week: "week";
11
- month: "month";
12
- }>>;
13
- }, z.core.$strip>, z.ZodArray<z.ZodObject<{
14
- date: z.ZodString;
15
- stats: z.ZodArray<z.ZodObject<{
16
- type: z.ZodString;
17
- name: z.ZodString;
18
- metrics: z.ZodObject<{
19
- requests: z.ZodOptional<z.ZodNumber>;
20
- delivered: z.ZodOptional<z.ZodNumber>;
21
- opens: z.ZodOptional<z.ZodNumber>;
22
- unique_opens: z.ZodOptional<z.ZodNumber>;
23
- clicks: z.ZodOptional<z.ZodNumber>;
24
- unique_clicks: z.ZodOptional<z.ZodNumber>;
25
- bounces: z.ZodOptional<z.ZodNumber>;
26
- bounce_drops: z.ZodOptional<z.ZodNumber>;
27
- blocks: z.ZodOptional<z.ZodNumber>;
28
- spam_reports: z.ZodOptional<z.ZodNumber>;
29
- unsubscribes: z.ZodOptional<z.ZodNumber>;
30
- unique_unsubscribes: z.ZodOptional<z.ZodNumber>;
31
- processed: z.ZodOptional<z.ZodNumber>;
32
- deferred: z.ZodOptional<z.ZodNumber>;
33
- invalid_emails: z.ZodOptional<z.ZodNumber>;
34
- }, z.core.$catchall<z.ZodUnknown>>;
35
- }, z.core.$strip>>;
36
- }, z.core.$strip>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
37
- SENDGRID_API_KEY: z.ZodString;
38
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
39
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
40
- global: "global";
41
- eu: "eu";
42
- }>>;
43
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
44
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
45
- }, z.core.$strip>>], undefined>;
46
- declare const getCategoryStats: _keystrokehq_core0.Operation<z.ZodObject<{
47
- startDate: z.ZodISODate;
48
- endDate: z.ZodOptional<z.ZodISODate>;
49
- aggregatedBy: z.ZodOptional<z.ZodEnum<{
50
- day: "day";
51
- week: "week";
52
- month: "month";
53
- }>>;
54
- categories: z.ZodArray<z.ZodString>;
55
- }, z.core.$strip>, z.ZodArray<z.ZodObject<{
56
- date: z.ZodString;
57
- stats: z.ZodArray<z.ZodObject<{
58
- type: z.ZodString;
59
- name: z.ZodString;
60
- metrics: z.ZodObject<{
61
- requests: z.ZodOptional<z.ZodNumber>;
62
- delivered: z.ZodOptional<z.ZodNumber>;
63
- opens: z.ZodOptional<z.ZodNumber>;
64
- unique_opens: z.ZodOptional<z.ZodNumber>;
65
- clicks: z.ZodOptional<z.ZodNumber>;
66
- unique_clicks: z.ZodOptional<z.ZodNumber>;
67
- bounces: z.ZodOptional<z.ZodNumber>;
68
- bounce_drops: z.ZodOptional<z.ZodNumber>;
69
- blocks: z.ZodOptional<z.ZodNumber>;
70
- spam_reports: z.ZodOptional<z.ZodNumber>;
71
- unsubscribes: z.ZodOptional<z.ZodNumber>;
72
- unique_unsubscribes: z.ZodOptional<z.ZodNumber>;
73
- processed: z.ZodOptional<z.ZodNumber>;
74
- deferred: z.ZodOptional<z.ZodNumber>;
75
- invalid_emails: z.ZodOptional<z.ZodNumber>;
76
- }, z.core.$catchall<z.ZodUnknown>>;
77
- }, z.core.$strip>>;
78
- }, z.core.$strip>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
79
- SENDGRID_API_KEY: z.ZodString;
80
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
81
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
82
- global: "global";
83
- eu: "eu";
84
- }>>;
85
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
86
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
87
- }, z.core.$strip>>], undefined>;
88
- declare const listAutomationStats: _keystrokehq_core0.Operation<z.ZodOptional<z.ZodObject<{
89
- pageSize: z.ZodOptional<z.ZodNumber>;
90
- aggregatedBy: z.ZodOptional<z.ZodEnum<{
91
- total: "total";
92
- day: "day";
93
- week: "week";
94
- month: "month";
95
- }>>;
96
- }, z.core.$strip>>, z.ZodObject<{
97
- results: z.ZodArray<z.ZodUnknown>;
98
- _metadata: z.ZodOptional<z.ZodUnknown>;
99
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
100
- SENDGRID_API_KEY: z.ZodString;
101
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
102
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
103
- global: "global";
104
- eu: "eu";
105
- }>>;
106
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
107
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
108
- }, z.core.$strip>>], undefined>;
109
- declare const getEngagementQualityScores: _keystrokehq_core0.Operation<z.ZodObject<{
110
- from: z.ZodISODate;
111
- to: z.ZodISODate;
112
- }, z.core.$strip>, z.ZodObject<{
113
- account_id: z.ZodOptional<z.ZodString>;
114
- date: z.ZodOptional<z.ZodString>;
115
- metrics: z.ZodOptional<z.ZodUnknown>;
116
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
117
- SENDGRID_API_KEY: z.ZodString;
118
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
119
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
120
- global: "global";
121
- eu: "eu";
122
- }>>;
123
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
124
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
125
- }, z.core.$strip>>], undefined>;
126
- declare const listMailboxProviderStats: _keystrokehq_core0.Operation<z.ZodObject<{
127
- startDate: z.ZodISODate;
128
- endDate: z.ZodOptional<z.ZodISODate>;
129
- aggregatedBy: z.ZodOptional<z.ZodEnum<{
130
- day: "day";
131
- week: "week";
132
- month: "month";
133
- }>>;
134
- mailboxProviders: z.ZodOptional<z.ZodArray<z.ZodString>>;
135
- }, z.core.$strip>, z.ZodArray<z.ZodObject<{
136
- date: z.ZodString;
137
- stats: z.ZodArray<z.ZodObject<{
138
- type: z.ZodString;
139
- name: z.ZodString;
140
- metrics: z.ZodObject<{
141
- requests: z.ZodOptional<z.ZodNumber>;
142
- delivered: z.ZodOptional<z.ZodNumber>;
143
- opens: z.ZodOptional<z.ZodNumber>;
144
- unique_opens: z.ZodOptional<z.ZodNumber>;
145
- clicks: z.ZodOptional<z.ZodNumber>;
146
- unique_clicks: z.ZodOptional<z.ZodNumber>;
147
- bounces: z.ZodOptional<z.ZodNumber>;
148
- bounce_drops: z.ZodOptional<z.ZodNumber>;
149
- blocks: z.ZodOptional<z.ZodNumber>;
150
- spam_reports: z.ZodOptional<z.ZodNumber>;
151
- unsubscribes: z.ZodOptional<z.ZodNumber>;
152
- unique_unsubscribes: z.ZodOptional<z.ZodNumber>;
153
- processed: z.ZodOptional<z.ZodNumber>;
154
- deferred: z.ZodOptional<z.ZodNumber>;
155
- invalid_emails: z.ZodOptional<z.ZodNumber>;
156
- }, z.core.$catchall<z.ZodUnknown>>;
157
- }, z.core.$strip>>;
158
- }, z.core.$strip>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
159
- SENDGRID_API_KEY: z.ZodString;
160
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
161
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
162
- global: "global";
163
- eu: "eu";
164
- }>>;
165
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
166
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
167
- }, z.core.$strip>>], undefined>;
168
- //#endregion
169
- export { getCategoryStats, getEngagementQualityScores, getGlobalEmailStats, listAutomationStats, listMailboxProviderStats };
package/dist/stats.mjs DELETED
@@ -1,107 +0,0 @@
1
- import { n as __exportAll, t as sendgridOperation } from "./factory-7q6CQ75J.mjs";
2
- import { n as omitUndefined } from "./shared-CQ8JFNXi.mjs";
3
- import { createSendGridClient } from "./client.mjs";
4
- import { F as sendgridAggregationSchema, I as sendgridAutomationStatsSchema, L as sendgridCategoryStatsSchema, R as sendgridEngagementQualitySchema, z as sendgridStatBucketListSchema } from "./webhooks-CKdsIikb.mjs";
5
- import { z } from "zod";
6
-
7
- //#region src/stats.ts
8
- var stats_exports = /* @__PURE__ */ __exportAll({
9
- getCategoryStats: () => getCategoryStats,
10
- getEngagementQualityScores: () => getEngagementQualityScores,
11
- getGlobalEmailStats: () => getGlobalEmailStats,
12
- listAutomationStats: () => listAutomationStats,
13
- listMailboxProviderStats: () => listMailboxProviderStats
14
- });
15
- const statsRange = z.object({
16
- startDate: z.iso.date(),
17
- endDate: z.iso.date().optional(),
18
- aggregatedBy: sendgridAggregationSchema.optional()
19
- });
20
- function mapStatsQuery(input) {
21
- return {
22
- start_date: input.startDate,
23
- end_date: input.endDate,
24
- aggregated_by: input.aggregatedBy
25
- };
26
- }
27
- const getGlobalEmailStats = sendgridOperation({
28
- id: "sendgrid.get-global-email-stats",
29
- name: "Get Global Email Statistics",
30
- description: "Return aggregated global email stats over a date range.",
31
- input: statsRange,
32
- output: sendgridStatBucketListSchema,
33
- run: async (input, credentials) => {
34
- const response = await createSendGridClient(credentials).request("/stats", { query: omitUndefined(mapStatsQuery(input)) });
35
- return sendgridStatBucketListSchema.parse(response ?? []);
36
- }
37
- });
38
- const getCategoryStats = sendgridOperation({
39
- id: "sendgrid.get-category-stats",
40
- name: "Get Category Stats",
41
- description: "Return email stats broken down by category.",
42
- input: statsRange.extend({ categories: z.array(z.string().min(1)).min(1).max(10) }),
43
- output: sendgridCategoryStatsSchema,
44
- run: async (input, credentials) => {
45
- const response = await createSendGridClient(credentials).request("/categories/stats", { query: omitUndefined({
46
- ...mapStatsQuery(input),
47
- categories: input.categories.join(",")
48
- }) });
49
- return sendgridCategoryStatsSchema.parse(response ?? []);
50
- }
51
- });
52
- const listAutomationStats = sendgridOperation({
53
- id: "sendgrid.list-automation-stats",
54
- name: "List Automation Stats",
55
- description: "Return engagement stats for all Automations.",
56
- input: z.object({
57
- pageSize: z.number().int().positive().max(100).optional(),
58
- aggregatedBy: z.enum([
59
- "total",
60
- "day",
61
- "week",
62
- "month"
63
- ]).optional()
64
- }).optional(),
65
- output: sendgridAutomationStatsSchema,
66
- run: async (input, credentials) => {
67
- const response = await createSendGridClient(credentials).request("/marketing/stats/automations", { query: omitUndefined({
68
- page_size: input?.pageSize,
69
- aggregated_by: input?.aggregatedBy
70
- }) });
71
- return sendgridAutomationStatsSchema.parse(response ?? { results: [] });
72
- }
73
- });
74
- const getEngagementQualityScores = sendgridOperation({
75
- id: "sendgrid.get-engagement-quality-scores",
76
- name: "Get Engagement Quality Scores",
77
- description: "Return engagement-quality (EQ) scores for the account. Plan-gated — requires Pro+.",
78
- input: z.object({
79
- from: z.iso.date(),
80
- to: z.iso.date()
81
- }),
82
- output: sendgridEngagementQualitySchema,
83
- run: async (input, credentials) => {
84
- const response = await createSendGridClient(credentials).request("/user/eq", { query: {
85
- from: input.from,
86
- to: input.to
87
- } });
88
- return sendgridEngagementQualitySchema.parse(response);
89
- }
90
- });
91
- const listMailboxProviderStats = sendgridOperation({
92
- id: "sendgrid.list-mailbox-provider-stats",
93
- name: "List Mailbox Provider Stats",
94
- description: "Return email stats broken down by mailbox provider (Gmail, Outlook, etc.).",
95
- input: statsRange.extend({ mailboxProviders: z.array(z.string().min(1)).optional() }),
96
- output: sendgridStatBucketListSchema,
97
- run: async (input, credentials) => {
98
- const response = await createSendGridClient(credentials).request("/mailbox_providers/stats", { query: omitUndefined({
99
- ...mapStatsQuery(input),
100
- mailbox_providers: input.mailboxProviders?.join(",")
101
- }) });
102
- return sendgridStatBucketListSchema.parse(response ?? []);
103
- }
104
- });
105
-
106
- //#endregion
107
- export { getCategoryStats, getEngagementQualityScores, getGlobalEmailStats, listAutomationStats, listMailboxProviderStats, stats_exports as t };