@keystrokehq/sendgrid 0.0.9 → 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 (69) 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 +8 -8
  9. package/dist/schemas/index.mjs +1 -1
  10. package/dist/sendgrid.credential-set-CzYmlJ2Y.mjs +25 -0
  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 +8 -96
  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 -193
  20. package/dist/alerts.mjs +0 -101
  21. package/dist/api-keys.d.mts +0 -160
  22. package/dist/api-keys.mjs +0 -113
  23. package/dist/client.d.mts +0 -73
  24. package/dist/client.mjs +0 -260
  25. package/dist/connection.d.mts +0 -2
  26. package/dist/connection.mjs +0 -3
  27. package/dist/domains.d.mts +0 -114
  28. package/dist/domains.mjs +0 -62
  29. package/dist/email-validation.d.mts +0 -134
  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-CToXR1jp.mjs +0 -24
  34. package/dist/integration-C9EALG65.mjs +0 -113
  35. package/dist/integration-zx-jmybs.d.mts +0 -56
  36. package/dist/mail-send.d.mts +0 -315
  37. package/dist/mail-send.mjs +0 -218
  38. package/dist/marketing-contacts.d.mts +0 -607
  39. package/dist/marketing-contacts.mjs +0 -277
  40. package/dist/marketing-customfields.d.mts +0 -94
  41. package/dist/marketing-customfields.mjs +0 -70
  42. package/dist/marketing-lists.d.mts +0 -184
  43. package/dist/marketing-lists.mjs +0 -130
  44. package/dist/marketing-segments.d.mts +0 -340
  45. package/dist/marketing-segments.mjs +0 -179
  46. package/dist/marketing-singlesends.d.mts +0 -648
  47. package/dist/marketing-singlesends.mjs +0 -277
  48. package/dist/operations.d.mts +0 -25
  49. package/dist/operations.mjs +0 -69
  50. package/dist/sender-identities.d.mts +0 -218
  51. package/dist/sender-identities.mjs +0 -109
  52. package/dist/senders.d.mts +0 -227
  53. package/dist/senders.mjs +0 -83
  54. package/dist/shared-BayZ0Lt6.mjs +0 -46
  55. package/dist/stats.d.mts +0 -215
  56. package/dist/stats.mjs +0 -107
  57. package/dist/suppressions.d.mts +0 -785
  58. package/dist/suppressions.mjs +0 -539
  59. package/dist/templates.d.mts +0 -451
  60. package/dist/templates.mjs +0 -238
  61. package/dist/user-account.d.mts +0 -108
  62. package/dist/user-account.mjs +0 -59
  63. package/dist/verification.d.mts +0 -67
  64. package/dist/verification.mjs +0 -72
  65. package/dist/webhooks/event.d.mts +0 -287
  66. package/dist/webhooks/event.mjs +0 -147
  67. package/dist/webhooks/parse.d.mts +0 -172
  68. package/dist/webhooks/parse.mjs +0 -125
  69. /package/dist/{webhooks-CKdsIikb.mjs → webhooks-dVOd93Hd.mjs} +0 -0
@@ -1,134 +0,0 @@
1
- import * as _keystrokehq_core0 from "@keystrokehq/core";
2
- import { z } from "zod";
3
- import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
-
5
- //#region src/email-validation.d.ts
6
- declare const validateEmail: _keystrokehq_core0.Operation<z.ZodObject<{
7
- email: z.ZodString;
8
- source: z.ZodOptional<z.ZodString>;
9
- }, z.core.$strip>, z.ZodObject<{
10
- result: z.ZodObject<{
11
- email: z.ZodString;
12
- verdict: z.ZodEnum<{
13
- Valid: "Valid";
14
- Risky: "Risky";
15
- Invalid: "Invalid";
16
- }>;
17
- score: z.ZodOptional<z.ZodNumber>;
18
- local: z.ZodOptional<z.ZodString>;
19
- host: z.ZodOptional<z.ZodString>;
20
- suggestion: z.ZodOptional<z.ZodString>;
21
- checks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
22
- source: z.ZodOptional<z.ZodString>;
23
- ip_address: z.ZodOptional<z.ZodString>;
24
- }, z.core.$catchall<z.ZodUnknown>>;
25
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
26
- SENDGRID_API_KEY: z.ZodString;
27
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
28
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
29
- global: "global";
30
- eu: "eu";
31
- }>>;
32
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
33
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
34
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
35
- SENDGRID_API_KEY: z.ZodString;
36
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
37
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
38
- global: "global";
39
- eu: "eu";
40
- }>>;
41
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
42
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
43
- }, z.core.$strip>>[] | undefined>], undefined>;
44
- declare const listBulkEmailValidationJobs: _keystrokehq_core0.Operation<z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
45
- result: z.ZodArray<z.ZodObject<{
46
- id: z.ZodString;
47
- status: z.ZodString;
48
- segments: z.ZodOptional<z.ZodNumber>;
49
- results: z.ZodOptional<z.ZodUnknown>;
50
- started_at: z.ZodOptional<z.ZodString>;
51
- finished_at: z.ZodOptional<z.ZodString>;
52
- submitted_at: z.ZodOptional<z.ZodString>;
53
- }, z.core.$catchall<z.ZodUnknown>>>;
54
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
55
- SENDGRID_API_KEY: z.ZodString;
56
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
57
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
58
- global: "global";
59
- eu: "eu";
60
- }>>;
61
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
62
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
63
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
64
- SENDGRID_API_KEY: z.ZodString;
65
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
66
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
67
- global: "global";
68
- eu: "eu";
69
- }>>;
70
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
71
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
72
- }, z.core.$strip>>[] | undefined>], undefined>;
73
- declare const getBulkEmailValidationJob: _keystrokehq_core0.Operation<z.ZodObject<{
74
- jobId: z.ZodString;
75
- }, z.core.$strip>, z.ZodObject<{
76
- id: z.ZodString;
77
- status: z.ZodString;
78
- segments: z.ZodOptional<z.ZodNumber>;
79
- results: z.ZodOptional<z.ZodUnknown>;
80
- started_at: z.ZodOptional<z.ZodString>;
81
- finished_at: z.ZodOptional<z.ZodString>;
82
- submitted_at: z.ZodOptional<z.ZodString>;
83
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
84
- SENDGRID_API_KEY: z.ZodString;
85
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
86
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
87
- global: "global";
88
- eu: "eu";
89
- }>>;
90
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
91
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
92
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
93
- SENDGRID_API_KEY: z.ZodString;
94
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
95
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
96
- global: "global";
97
- eu: "eu";
98
- }>>;
99
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
100
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
101
- }, z.core.$strip>>[] | undefined>], undefined>;
102
- declare const createBulkEmailValidationPresignedUrl: _keystrokehq_core0.Operation<z.ZodObject<{
103
- fileType: z.ZodDefault<z.ZodEnum<{
104
- zip: "zip";
105
- csv: "csv";
106
- }>>;
107
- }, z.core.$strip>, z.ZodObject<{
108
- job_id: z.ZodString;
109
- upload_uri: z.ZodString;
110
- upload_headers: z.ZodArray<z.ZodObject<{
111
- header: z.ZodString;
112
- value: z.ZodString;
113
- }, z.core.$strip>>;
114
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
115
- SENDGRID_API_KEY: z.ZodString;
116
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
117
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
118
- global: "global";
119
- eu: "eu";
120
- }>>;
121
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
122
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
123
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
124
- SENDGRID_API_KEY: z.ZodString;
125
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
126
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
127
- global: "global";
128
- eu: "eu";
129
- }>>;
130
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
131
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
132
- }, z.core.$strip>>[] | undefined>], undefined>;
133
- //#endregion
134
- export { createBulkEmailValidationPresignedUrl, getBulkEmailValidationJob, listBulkEmailValidationJobs, validateEmail };
@@ -1,73 +0,0 @@
1
- import { n as __exportAll, t as sendgridOperation } from "./factory-CToXR1jp.mjs";
2
- import { n as omitUndefined } from "./shared-BayZ0Lt6.mjs";
3
- import { createSendGridClient } from "./client.mjs";
4
- import { Dt as sendgridEmailValidationResponseSchema, Et as sendgridBulkEmailValidationPresignedUrlSchema, Tt as sendgridBulkEmailValidationJobSchema, in as sendgridEmailSchema, on as sendgridIdSchema, wt as sendgridBulkEmailValidationJobListSchema } from "./webhooks-CKdsIikb.mjs";
5
- import { z } from "zod";
6
-
7
- //#region src/email-validation.ts
8
- var email_validation_exports = /* @__PURE__ */ __exportAll({
9
- createBulkEmailValidationPresignedUrl: () => createBulkEmailValidationPresignedUrl,
10
- getBulkEmailValidationJob: () => getBulkEmailValidationJob,
11
- listBulkEmailValidationJobs: () => listBulkEmailValidationJobs,
12
- validateEmail: () => validateEmail
13
- });
14
- const validateEmail = sendgridOperation({
15
- id: "sendgrid.validate-email",
16
- name: "Validate Email",
17
- description: "Validate a single email address using SendGrid Email Validation. Requires the Email Validation add-on.",
18
- input: z.object({
19
- email: sendgridEmailSchema,
20
- source: z.string().max(30).optional()
21
- }),
22
- output: sendgridEmailValidationResponseSchema,
23
- run: async (input, credentials) => {
24
- const response = await createSendGridClient(credentials).request("/validations/email", {
25
- method: "POST",
26
- body: omitUndefined({
27
- email: input.email,
28
- source: input.source
29
- })
30
- });
31
- return sendgridEmailValidationResponseSchema.parse(response);
32
- }
33
- });
34
- const listBulkEmailValidationJobs = sendgridOperation({
35
- id: "sendgrid.list-bulk-email-validation-jobs",
36
- name: "List Bulk Email Validation Jobs",
37
- description: "List bulk email validation jobs.",
38
- input: z.object({}).optional(),
39
- output: sendgridBulkEmailValidationJobListSchema,
40
- run: async (_input, credentials) => {
41
- const response = await createSendGridClient(credentials).request("/validations/email/jobs");
42
- return sendgridBulkEmailValidationJobListSchema.parse(response ?? { result: [] });
43
- }
44
- });
45
- const getBulkEmailValidationJob = sendgridOperation({
46
- id: "sendgrid.get-bulk-email-validation-job",
47
- name: "Get Bulk Email Validation Job",
48
- description: "Retrieve status and results for a bulk validation job.",
49
- input: z.object({ jobId: sendgridIdSchema }),
50
- output: sendgridBulkEmailValidationJobSchema,
51
- run: async (input, credentials) => {
52
- const response = await createSendGridClient(credentials).request(`/validations/email/jobs/${encodeURIComponent(input.jobId)}`);
53
- return sendgridBulkEmailValidationJobSchema.parse(response);
54
- }
55
- });
56
- const createBulkEmailValidationPresignedUrl = sendgridOperation({
57
- id: "sendgrid.create-bulk-email-validation-presigned-url",
58
- name: "Create Bulk Email Validation Upload URL",
59
- description: "Allocate a presigned upload URL for a bulk email-validation CSV.",
60
- input: z.object({ fileType: z.enum(["csv", "zip"]).default("csv") }),
61
- output: sendgridBulkEmailValidationPresignedUrlSchema,
62
- needsApproval: true,
63
- run: async (input, credentials) => {
64
- const response = await createSendGridClient(credentials).request("/validations/email/jobs", {
65
- method: "PUT",
66
- body: { file_type: input.fileType }
67
- });
68
- return sendgridBulkEmailValidationPresignedUrlSchema.parse(response);
69
- }
70
- });
71
-
72
- //#endregion
73
- export { createBulkEmailValidationPresignedUrl, getBulkEmailValidationJob, listBulkEmailValidationJobs, email_validation_exports as t, validateEmail };
package/dist/events.d.mts DELETED
@@ -1,69 +0,0 @@
1
- import { z } from "zod";
2
-
3
- //#region src/events.d.ts
4
- /**
5
- * SendGrid Event Webhook event-name constants. Each webhook helper in
6
- * `./triggers` pins `event` to one of these values.
7
- */
8
- declare const sendgridEventWebhookEventNames: readonly ["processed", "dropped", "deferred", "delivered", "bounce", "open", "click", "spam_report", "unsubscribe", "group_unsubscribe", "group_resubscribe"];
9
- type SendGridEventWebhookEventName = (typeof sendgridEventWebhookEventNames)[number];
10
- declare const sendgridEventWebhookEventNameSchema: z.ZodEnum<{
11
- processed: "processed";
12
- dropped: "dropped";
13
- deferred: "deferred";
14
- delivered: "delivered";
15
- bounce: "bounce";
16
- open: "open";
17
- click: "click";
18
- spam_report: "spam_report";
19
- unsubscribe: "unsubscribe";
20
- group_unsubscribe: "group_unsubscribe";
21
- group_resubscribe: "group_resubscribe";
22
- }>;
23
- declare const sendgridEventEnvelopeSchema: z.ZodArray<z.ZodObject<{
24
- email: z.ZodString;
25
- timestamp: z.ZodNumber;
26
- event: z.ZodString;
27
- 'smtp-id': z.ZodOptional<z.ZodString>;
28
- sg_event_id: z.ZodString;
29
- sg_message_id: z.ZodOptional<z.ZodString>;
30
- category: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
31
- reason: z.ZodOptional<z.ZodString>;
32
- status: z.ZodOptional<z.ZodString>;
33
- response: z.ZodOptional<z.ZodString>;
34
- attempt: z.ZodOptional<z.ZodString>;
35
- url: z.ZodOptional<z.ZodString>;
36
- useragent: z.ZodOptional<z.ZodString>;
37
- ip: z.ZodOptional<z.ZodString>;
38
- asm_group_id: z.ZodOptional<z.ZodNumber>;
39
- tls: z.ZodOptional<z.ZodNumber>;
40
- type: z.ZodOptional<z.ZodString>;
41
- bounce_classification: z.ZodOptional<z.ZodString>;
42
- sg_machine_open: z.ZodOptional<z.ZodBoolean>;
43
- }, z.core.$catchall<z.ZodUnknown>>>;
44
- declare const sendgridEventSchema: z.ZodObject<{
45
- email: z.ZodString;
46
- timestamp: z.ZodNumber;
47
- event: z.ZodString;
48
- 'smtp-id': z.ZodOptional<z.ZodString>;
49
- sg_event_id: z.ZodString;
50
- sg_message_id: z.ZodOptional<z.ZodString>;
51
- category: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
52
- reason: z.ZodOptional<z.ZodString>;
53
- status: z.ZodOptional<z.ZodString>;
54
- response: z.ZodOptional<z.ZodString>;
55
- attempt: z.ZodOptional<z.ZodString>;
56
- url: z.ZodOptional<z.ZodString>;
57
- useragent: z.ZodOptional<z.ZodString>;
58
- ip: z.ZodOptional<z.ZodString>;
59
- asm_group_id: z.ZodOptional<z.ZodNumber>;
60
- tls: z.ZodOptional<z.ZodNumber>;
61
- type: z.ZodOptional<z.ZodString>;
62
- bounce_classification: z.ZodOptional<z.ZodString>;
63
- sg_machine_open: z.ZodOptional<z.ZodBoolean>;
64
- }, z.core.$catchall<z.ZodUnknown>>;
65
- type SendGridEvent = z.output<typeof sendgridEventSchema>;
66
- declare const sendgridInboundParseEventName: "inbound_parse.received";
67
- type SendGridInboundParseEventName = typeof sendgridInboundParseEventName;
68
- //#endregion
69
- export { SendGridEvent, SendGridEventWebhookEventName, SendGridInboundParseEventName, sendgridEventEnvelopeSchema, sendgridEventSchema, sendgridEventWebhookEventNameSchema, sendgridEventWebhookEventNames, sendgridInboundParseEventName };
package/dist/events.mjs DELETED
@@ -1,28 +0,0 @@
1
- import { r as sendgridEventWebhookPayloadSchema, t as sendgridEventWebhookEventSchema } from "./webhooks-CKdsIikb.mjs";
2
- import { z } from "zod";
3
-
4
- //#region src/events.ts
5
- /**
6
- * SendGrid Event Webhook event-name constants. Each webhook helper in
7
- * `./triggers` pins `event` to one of these values.
8
- */
9
- const sendgridEventWebhookEventNames = [
10
- "processed",
11
- "dropped",
12
- "deferred",
13
- "delivered",
14
- "bounce",
15
- "open",
16
- "click",
17
- "spam_report",
18
- "unsubscribe",
19
- "group_unsubscribe",
20
- "group_resubscribe"
21
- ];
22
- const sendgridEventWebhookEventNameSchema = z.enum(sendgridEventWebhookEventNames);
23
- const sendgridEventEnvelopeSchema = sendgridEventWebhookPayloadSchema;
24
- const sendgridEventSchema = sendgridEventWebhookEventSchema;
25
- const sendgridInboundParseEventName = "inbound_parse.received";
26
-
27
- //#endregion
28
- export { sendgridEventEnvelopeSchema, sendgridEventSchema, sendgridEventWebhookEventNameSchema, sendgridEventWebhookEventNames, sendgridInboundParseEventName };
@@ -1,24 +0,0 @@
1
- import { i as createOfficialOperationFactory, t as sendgrid } from "./integration-C9EALG65.mjs";
2
-
3
- //#region \0rolldown/runtime.js
4
- var __defProp = Object.defineProperty;
5
- var __exportAll = (all, no_symbols) => {
6
- let target = {};
7
- for (var name in all) {
8
- __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
12
- }
13
- if (!no_symbols) {
14
- __defProp(target, Symbol.toStringTag, { value: "Module" });
15
- }
16
- return target;
17
- };
18
-
19
- //#endregion
20
- //#region src/factory.ts
21
- const sendgridOperation = createOfficialOperationFactory(sendgrid);
22
-
23
- //#endregion
24
- export { __exportAll as n, sendgridOperation as t };
@@ -1,113 +0,0 @@
1
- import { CredentialSet, Operation } from "@keystrokehq/core";
2
- import { z } from "zod";
3
-
4
- //#region ../../packages/integration-authoring/dist/official/runtime.mjs
5
- const REGISTRY_KEY = "__ks_official_integration_metadata_registry";
6
- function getRegistry() {
7
- const globalStore = globalThis;
8
- if (!globalStore[REGISTRY_KEY]) globalStore[REGISTRY_KEY] = /* @__PURE__ */ new WeakMap();
9
- return globalStore[REGISTRY_KEY];
10
- }
11
- function registerOfficialOperation(operation, metadata) {
12
- getRegistry().set(operation, Object.freeze({ ...metadata }));
13
- }
14
-
15
- //#endregion
16
- //#region ../../packages/integration-authoring/dist/official/index.mjs
17
- const OFFICIAL_CREDENTIAL_SET_ID_PREFIX = "keystroke:";
18
- function stripOfficialCredentialSetIdPrefix(id) {
19
- return id.startsWith(OFFICIAL_CREDENTIAL_SET_ID_PREFIX) ? id.slice(10) : id;
20
- }
21
- /**
22
- * Creates a factory for Keystroke-official integration operations.
23
- *
24
- * It keeps the same flat `run(input, credentials)` ergonomics as the generic
25
- * operation factory, while registering official metadata for builder/runtime
26
- * operation metadata.
27
- */
28
- function createOfficialOperationFactory(credentialSet) {
29
- const integrationId = stripOfficialCredentialSetIdPrefix(credentialSet.id);
30
- return (config) => {
31
- const wrappedRun = async (input, ctx) => {
32
- const creds = ctx.credentials[credentialSet.id];
33
- return config.run(input, creds);
34
- };
35
- const operation = new Operation({
36
- id: config.id,
37
- name: config.name,
38
- description: config.description,
39
- input: config.input,
40
- output: config.output,
41
- credentialSets: [credentialSet],
42
- ...config.tags !== void 0 ? { tags: config.tags } : {},
43
- ...config.needsApproval !== void 0 ? { needsApproval: config.needsApproval } : {},
44
- ...config.requiredOAuthScopes !== void 0 ? { requiredOAuthScopes: config.requiredOAuthScopes } : {},
45
- ...config.retries !== void 0 ? { retries: config.retries } : {},
46
- ...config.timeout !== void 0 ? { timeout: config.timeout } : {},
47
- ...config.maxDurationMs !== void 0 ? { maxDurationMs: config.maxDurationMs } : {},
48
- run: wrappedRun
49
- });
50
- registerOfficialOperation(operation, { integrationId });
51
- return operation;
52
- };
53
- }
54
- /**
55
- * Creates an official integration bundle from a single config object.
56
- *
57
- * - Creates the public `CredentialSet` internally.
58
- * - Accepts optional `internal` fields for Keystroke-owned platform credentials.
59
- */
60
- function defineOfficialIntegration(config) {
61
- const internalCredentialSets = config.internal ?? {};
62
- const allInternalCredentialSets = [
63
- ...internalCredentialSets.providerApp ? [internalCredentialSets.providerApp] : [],
64
- ...internalCredentialSets.providerAppVariants ?? [],
65
- ...internalCredentialSets.webhookVerification ? [internalCredentialSets.webhookVerification] : [],
66
- ...internalCredentialSets.other ?? []
67
- ];
68
- const credentialSet = new CredentialSet({
69
- id: config.id,
70
- name: config.name,
71
- description: config.description,
72
- auth: config.auth,
73
- ...config.connections ? { connections: config.connections } : {},
74
- ...config.proxy ? { proxy: config.proxy } : {},
75
- ...config.needsRawSecret === true ? { needsRawSecret: true } : {}
76
- });
77
- return Object.freeze({
78
- integration: {
79
- id: config.id,
80
- name: config.name,
81
- ...config.description !== void 0 ? { description: config.description } : {},
82
- auth: config.auth,
83
- ...config.proxy ? { proxy: config.proxy } : {},
84
- ...config.needsRawSecret === true ? { needsRawSecret: true } : {},
85
- ...config.connections ? { connections: config.connections } : {}
86
- },
87
- credentialSet,
88
- internalCredentialSets,
89
- allInternalCredentialSets
90
- });
91
- }
92
-
93
- //#endregion
94
- //#region src/integration.ts
95
- const sendgridAuthSchema = z.object({
96
- SENDGRID_API_KEY: z.string().min(1).regex(/^SG\./u, "SendGrid API keys start with \"SG.\""),
97
- SENDGRID_SUBUSER: z.string().min(1).optional(),
98
- SENDGRID_ACCOUNT_REGION: z.enum(["global", "eu"]).default("global"),
99
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.string().min(1).optional(),
100
- SENDGRID_INBOUND_PARSE_TOKEN: z.string().min(1).optional()
101
- });
102
- const sendgridOfficialIntegration = {
103
- id: "sendgrid",
104
- name: "SendGrid",
105
- description: "SendGrid (Twilio) transactional + marketing email, templates, contacts, lists, segments, deliverability, and webhook helpers for Keystroke workflows",
106
- auth: sendgridAuthSchema,
107
- proxy: { hosts: ["api.sendgrid.com", "api.eu.sendgrid.com"] }
108
- };
109
- const sendgridBundle = defineOfficialIntegration(sendgridOfficialIntegration);
110
- const sendgrid = sendgridBundle.credentialSet;
111
-
112
- //#endregion
113
- export { createOfficialOperationFactory as i, sendgridBundle as n, sendgridOfficialIntegration as r, sendgrid as t };
@@ -1,56 +0,0 @@
1
- import * as _keystrokehq_core0 from "@keystrokehq/core";
2
- import { z } from "zod";
3
- import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
- import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
5
-
6
- //#region src/integration.d.ts
7
- declare const sendgridOfficialIntegration: {
8
- id: "sendgrid";
9
- name: string;
10
- description: string;
11
- auth: z.ZodObject<{
12
- SENDGRID_API_KEY: z.ZodString;
13
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
14
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
15
- global: "global";
16
- eu: "eu";
17
- }>>;
18
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
19
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
20
- }, z.core.$strip>;
21
- proxy: {
22
- hosts: string[];
23
- };
24
- };
25
- declare const sendgridBundle: undefined<"sendgrid", z.ZodObject<{
26
- SENDGRID_API_KEY: z.ZodString;
27
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
28
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
29
- global: "global";
30
- eu: "eu";
31
- }>>;
32
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
33
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
34
- }, z.core.$strip>>;
35
- declare const sendgrid: _keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
36
- SENDGRID_API_KEY: z.ZodString;
37
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
38
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
39
- global: "global";
40
- eu: "eu";
41
- }>>;
42
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
43
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
44
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
45
- SENDGRID_API_KEY: z.ZodString;
46
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
47
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
48
- global: "global";
49
- eu: "eu";
50
- }>>;
51
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
52
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
53
- }, z.core.$strip>>[] | undefined>;
54
- type SendGridCredentials = InferCredentialSetAuth<typeof sendgrid>;
55
- //#endregion
56
- export { sendgridOfficialIntegration as i, sendgrid as n, sendgridBundle as r, SendGridCredentials as t };