digital-tools 2.0.2 → 2.1.1
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.
- package/CHANGELOG.md +17 -0
- package/package.json +3 -4
- package/src/define.js +267 -0
- package/src/entities/advertising.js +999 -0
- package/src/entities/ai.js +756 -0
- package/src/entities/analytics.js +1588 -0
- package/src/entities/automation.js +601 -0
- package/src/entities/communication.js +1150 -0
- package/src/entities/crm.js +1386 -0
- package/src/entities/design.js +546 -0
- package/src/entities/development.js +2212 -0
- package/src/entities/document.js +874 -0
- package/src/entities/ecommerce.js +1429 -0
- package/src/entities/experiment.js +1039 -0
- package/src/entities/finance.js +3478 -0
- package/src/entities/forms.js +1892 -0
- package/src/entities/hr.js +661 -0
- package/src/entities/identity.js +997 -0
- package/src/entities/index.js +282 -0
- package/src/entities/infrastructure.js +1153 -0
- package/src/entities/knowledge.js +1438 -0
- package/src/entities/marketing.js +1610 -0
- package/src/entities/media.js +1634 -0
- package/src/entities/notification.js +1199 -0
- package/src/entities/presentation.js +1274 -0
- package/src/entities/productivity.js +1317 -0
- package/src/entities/project-management.js +1136 -0
- package/src/entities/recruiting.js +736 -0
- package/src/entities/shipping.js +509 -0
- package/src/entities/signature.js +1102 -0
- package/src/entities/site.js +222 -0
- package/src/entities/spreadsheet.js +1341 -0
- package/src/entities/storage.js +1198 -0
- package/src/entities/support.js +1166 -0
- package/src/entities/video-conferencing.js +1750 -0
- package/src/entities/video.js +950 -0
- package/src/entities.js +1663 -0
- package/src/index.js +74 -0
- package/src/providers/analytics/index.js +17 -0
- package/src/providers/analytics/mixpanel.js +255 -0
- package/src/providers/calendar/cal-com.js +303 -0
- package/src/providers/calendar/google-calendar.js +335 -0
- package/src/providers/calendar/index.js +20 -0
- package/src/providers/crm/hubspot.js +566 -0
- package/src/providers/crm/index.js +17 -0
- package/src/providers/development/github.js +472 -0
- package/src/providers/development/index.js +17 -0
- package/src/providers/ecommerce/index.js +17 -0
- package/src/providers/ecommerce/shopify.js +378 -0
- package/src/providers/email/index.js +20 -0
- package/src/providers/email/resend.js +258 -0
- package/src/providers/email/sendgrid.js +161 -0
- package/src/providers/finance/index.js +17 -0
- package/src/providers/finance/stripe.js +549 -0
- package/src/providers/forms/index.js +17 -0
- package/src/providers/forms/typeform.js +500 -0
- package/src/providers/index.js +123 -0
- package/src/providers/knowledge/index.js +17 -0
- package/src/providers/knowledge/notion.js +389 -0
- package/src/providers/marketing/index.js +17 -0
- package/src/providers/marketing/mailchimp.js +443 -0
- package/src/providers/media/cloudinary.js +318 -0
- package/src/providers/media/index.js +17 -0
- package/src/providers/messaging/index.js +20 -0
- package/src/providers/messaging/slack.js +393 -0
- package/src/providers/messaging/twilio-sms.js +249 -0
- package/src/providers/project-management/index.js +17 -0
- package/src/providers/project-management/linear.js +575 -0
- package/src/providers/registry.js +86 -0
- package/src/providers/spreadsheet/google-sheets.js +375 -0
- package/src/providers/spreadsheet/index.js +20 -0
- package/src/providers/spreadsheet/xlsx.js +423 -0
- package/src/providers/storage/index.js +24 -0
- package/src/providers/storage/s3.js +419 -0
- package/src/providers/support/index.js +17 -0
- package/src/providers/support/zendesk.js +373 -0
- package/src/providers/tasks/index.js +17 -0
- package/src/providers/tasks/todoist.js +286 -0
- package/src/providers/types.js +9 -0
- package/src/providers/video-conferencing/google-meet.js +286 -0
- package/src/providers/video-conferencing/index.js +31 -0
- package/src/providers/video-conferencing/jitsi.js +254 -0
- package/src/providers/video-conferencing/teams.js +270 -0
- package/src/providers/video-conferencing/zoom.js +332 -0
- package/src/registry.js +128 -0
- package/src/tools/communication.js +184 -0
- package/src/tools/data.js +205 -0
- package/src/tools/index.js +11 -0
- package/src/tools/web.js +137 -0
- package/src/types.js +10 -0
- package/test/define.test.js +306 -0
- package/test/registry.test.js +357 -0
- package/test/tools.test.js +363 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SendGrid Email Provider
|
|
3
|
+
*
|
|
4
|
+
* Concrete implementation of EmailProvider using SendGrid API.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
import { defineProvider } from '../registry.js';
|
|
9
|
+
const SENDGRID_API_URL = 'https://api.sendgrid.com/v3';
|
|
10
|
+
/**
|
|
11
|
+
* SendGrid provider info
|
|
12
|
+
*/
|
|
13
|
+
export const sendgridInfo = {
|
|
14
|
+
id: 'email.sendgrid',
|
|
15
|
+
name: 'SendGrid',
|
|
16
|
+
description: 'SendGrid email delivery service by Twilio',
|
|
17
|
+
category: 'email',
|
|
18
|
+
website: 'https://sendgrid.com',
|
|
19
|
+
docsUrl: 'https://docs.sendgrid.com',
|
|
20
|
+
requiredConfig: ['apiKey'],
|
|
21
|
+
optionalConfig: ['defaultFrom', 'sandboxMode'],
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Create SendGrid email provider
|
|
25
|
+
*/
|
|
26
|
+
export function createSendGridProvider(config) {
|
|
27
|
+
let apiKey;
|
|
28
|
+
let defaultFrom;
|
|
29
|
+
return {
|
|
30
|
+
info: sendgridInfo,
|
|
31
|
+
async initialize(cfg) {
|
|
32
|
+
apiKey = cfg.apiKey;
|
|
33
|
+
defaultFrom = cfg.defaultFrom;
|
|
34
|
+
if (!apiKey) {
|
|
35
|
+
throw new Error('SendGrid API key is required');
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
async healthCheck() {
|
|
39
|
+
const start = Date.now();
|
|
40
|
+
try {
|
|
41
|
+
const response = await fetch(`${SENDGRID_API_URL}/scopes`, {
|
|
42
|
+
headers: {
|
|
43
|
+
Authorization: `Bearer ${apiKey}`,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
healthy: response.ok,
|
|
48
|
+
latencyMs: Date.now() - start,
|
|
49
|
+
message: response.ok ? 'Connected' : `HTTP ${response.status}`,
|
|
50
|
+
checkedAt: new Date(),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
return {
|
|
55
|
+
healthy: false,
|
|
56
|
+
latencyMs: Date.now() - start,
|
|
57
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
58
|
+
checkedAt: new Date(),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
async dispose() {
|
|
63
|
+
// No cleanup needed
|
|
64
|
+
},
|
|
65
|
+
async send(options) {
|
|
66
|
+
const from = options.from || defaultFrom;
|
|
67
|
+
if (!from) {
|
|
68
|
+
return {
|
|
69
|
+
success: false,
|
|
70
|
+
error: { code: 'MISSING_FROM', message: 'From address is required' },
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const personalizations = [
|
|
74
|
+
{
|
|
75
|
+
to: options.to.map((email) => ({ email })),
|
|
76
|
+
...(options.cc && { cc: options.cc.map((email) => ({ email })) }),
|
|
77
|
+
...(options.bcc && { bcc: options.bcc.map((email) => ({ email })) }),
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
const body = {
|
|
81
|
+
personalizations,
|
|
82
|
+
from: { email: from },
|
|
83
|
+
subject: options.subject,
|
|
84
|
+
content: [
|
|
85
|
+
...(options.text ? [{ type: 'text/plain', value: options.text }] : []),
|
|
86
|
+
...(options.html ? [{ type: 'text/html', value: options.html }] : []),
|
|
87
|
+
],
|
|
88
|
+
};
|
|
89
|
+
if (options.replyTo) {
|
|
90
|
+
body.reply_to = { email: options.replyTo };
|
|
91
|
+
}
|
|
92
|
+
if (options.attachments?.length) {
|
|
93
|
+
body.attachments = options.attachments.map((att) => ({
|
|
94
|
+
content: typeof att.content === 'string' ? att.content : att.content.toString('base64'),
|
|
95
|
+
filename: att.filename,
|
|
96
|
+
type: att.contentType,
|
|
97
|
+
content_id: att.contentId,
|
|
98
|
+
disposition: att.contentId ? 'inline' : 'attachment',
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
if (options.sendAt) {
|
|
102
|
+
body.send_at = Math.floor(options.sendAt.getTime() / 1000);
|
|
103
|
+
}
|
|
104
|
+
if (options.trackOpens !== undefined || options.trackClicks !== undefined) {
|
|
105
|
+
body.tracking_settings = {
|
|
106
|
+
...(options.trackOpens !== undefined && {
|
|
107
|
+
open_tracking: { enable: options.trackOpens },
|
|
108
|
+
}),
|
|
109
|
+
...(options.trackClicks !== undefined && {
|
|
110
|
+
click_tracking: { enable: options.trackClicks },
|
|
111
|
+
}),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
if (options.tags?.length) {
|
|
115
|
+
body.categories = options.tags;
|
|
116
|
+
}
|
|
117
|
+
if (options.metadata) {
|
|
118
|
+
body.custom_args = options.metadata;
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
const response = await fetch(`${SENDGRID_API_URL}/mail/send`, {
|
|
122
|
+
method: 'POST',
|
|
123
|
+
headers: {
|
|
124
|
+
'Content-Type': 'application/json',
|
|
125
|
+
Authorization: `Bearer ${apiKey}`,
|
|
126
|
+
},
|
|
127
|
+
body: JSON.stringify(body),
|
|
128
|
+
});
|
|
129
|
+
if (response.ok || response.status === 202) {
|
|
130
|
+
const messageId = response.headers.get('X-Message-Id') || undefined;
|
|
131
|
+
return { success: true, messageId };
|
|
132
|
+
}
|
|
133
|
+
const errorData = await response.json().catch(() => ({}));
|
|
134
|
+
return {
|
|
135
|
+
success: false,
|
|
136
|
+
error: {
|
|
137
|
+
code: `HTTP_${response.status}`,
|
|
138
|
+
message: errorData?.errors?.[0]?.message || response.statusText,
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
return {
|
|
144
|
+
success: false,
|
|
145
|
+
error: {
|
|
146
|
+
code: 'NETWORK_ERROR',
|
|
147
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
async sendBatch(emails) {
|
|
153
|
+
// SendGrid doesn't have a true batch endpoint, so we send in parallel
|
|
154
|
+
return Promise.all(emails.map((email) => this.send(email)));
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* SendGrid provider definition
|
|
160
|
+
*/
|
|
161
|
+
export const sendgridProvider = defineProvider(sendgridInfo, async (config) => createSendGridProvider(config));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finance Providers
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
export { stripeInfo, stripeProvider, createStripeProvider } from './stripe.js';
|
|
7
|
+
import { stripeProvider } from './stripe.js';
|
|
8
|
+
/**
|
|
9
|
+
* Register all finance providers
|
|
10
|
+
*/
|
|
11
|
+
export function registerFinanceProviders() {
|
|
12
|
+
stripeProvider.register();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* All finance providers
|
|
16
|
+
*/
|
|
17
|
+
export const financeProviders = [stripeProvider];
|