@thijsattenza/piece-sendgrid-eu 1.0.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.
- package/README.md +7 -0
- package/bun.lock +63 -0
- package/package.json +25 -0
- package/src/i18n/ca.json +40 -0
- package/src/i18n/de.json +41 -0
- package/src/i18n/es.json +41 -0
- package/src/i18n/fr.json +41 -0
- package/src/i18n/hi.json +40 -0
- package/src/i18n/id.json +40 -0
- package/src/i18n/ja.json +41 -0
- package/src/i18n/nl.json +41 -0
- package/src/i18n/pt.json +41 -0
- package/src/i18n/ru.json +40 -0
- package/src/i18n/translation.json +46 -0
- package/src/i18n/vi.json +40 -0
- package/src/i18n/zh.json +41 -0
- package/src/index.d.ts +3 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +39 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/send-dynamic-template.d.ts +9 -0
- package/src/lib/actions/send-dynamic-template.d.ts.map +1 -0
- package/src/lib/actions/send-dynamic-template.js +74 -0
- package/src/lib/actions/send-dynamic-template.js.map +1 -0
- package/src/lib/actions/send-email.d.ts +10 -0
- package/src/lib/actions/send-email.d.ts.map +1 -0
- package/src/lib/actions/send-email.js +105 -0
- package/src/lib/actions/send-email.js.map +1 -0
- package/src/lib/common/index.d.ts +4 -0
- package/src/lib/common/index.d.ts.map +1 -0
- package/src/lib/common/index.js +7 -0
- package/src/lib/common/index.js.map +1 -0
- package/tsconfig.tsbuildinfo +1 -0
package/src/i18n/zh.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Email delivery service for sending transactional and marketing emails": "Email delivery service for sending transactional and marketing emails",
|
|
3
|
+
"API key acquired from your SendGrid settings": "API key acquired from your SendGrid settings",
|
|
4
|
+
"Send Email": "Send Email",
|
|
5
|
+
"Send Dynamic Template": "Send Dynamic Template",
|
|
6
|
+
"Custom API Call": "自定义 API 呼叫",
|
|
7
|
+
"Send a text or HTML email": "Send a text or HTML email",
|
|
8
|
+
"Send an email using a dynamic template": "Send an email using a dynamic template",
|
|
9
|
+
"Make a custom API call to a specific endpoint": "将一个自定义 API 调用到一个特定的终点",
|
|
10
|
+
"To": "To",
|
|
11
|
+
"From (Email)": "From (Email)",
|
|
12
|
+
"From (Name)": "From (Name)",
|
|
13
|
+
"Reply To": "Reply To",
|
|
14
|
+
"Subject": "Subject",
|
|
15
|
+
"Content Type": "Content Type",
|
|
16
|
+
"Content": "Content",
|
|
17
|
+
"Template Id": "Template Id",
|
|
18
|
+
"Template Data": "Template Data",
|
|
19
|
+
"Method": "方法",
|
|
20
|
+
"Headers": "信头",
|
|
21
|
+
"Query Parameters": "查询参数",
|
|
22
|
+
"Body": "正文内容",
|
|
23
|
+
"Response is Binary ?": "Response is Binary ?",
|
|
24
|
+
"No Error on Failure": "失败时没有错误",
|
|
25
|
+
"Timeout (in seconds)": "超时(秒)",
|
|
26
|
+
"Emails of the recipients": "Emails of the recipients",
|
|
27
|
+
"Sender email, must be on your SendGrid": "Sender email, must be on your SendGrid",
|
|
28
|
+
"Sender name": "Sender name",
|
|
29
|
+
"Email to receive replies on (defaults to sender)": "Email to receive replies on (defaults to sender)",
|
|
30
|
+
"HTML is only allowed if you selected HTML as type": "HTML is only allowed if you selected HTML as type",
|
|
31
|
+
"Dynamic template id": "Dynamic template id",
|
|
32
|
+
"Dynamic template data": "Dynamic template data",
|
|
33
|
+
"Authorization headers are injected automatically from your connection.": "授权头自动从您的连接中注入。",
|
|
34
|
+
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
|
|
35
|
+
"GET": "获取",
|
|
36
|
+
"POST": "帖子",
|
|
37
|
+
"PATCH": "PATCH",
|
|
38
|
+
"PUT": "弹出",
|
|
39
|
+
"DELETE": "删除",
|
|
40
|
+
"HEAD": "黑色"
|
|
41
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const sendgridAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
2
|
+
export declare const sendgrid: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/pieces/community/sendgrid-eu/src/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,YAAY,mEAIvB,CAAC;AAEH,eAAO,MAAM,QAAQ,mHAsBnB,CAAC"}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendgrid = exports.sendgridAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const shared_1 = require("@activepieces/shared");
|
|
8
|
+
const send_dynamic_template_1 = require("./lib/actions/send-dynamic-template");
|
|
9
|
+
const send_email_1 = require("./lib/actions/send-email");
|
|
10
|
+
const common_1 = require("./lib/common");
|
|
11
|
+
exports.sendgridAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
12
|
+
displayName: 'API Key',
|
|
13
|
+
required: true,
|
|
14
|
+
description: 'API key acquired from your SendGrid settings',
|
|
15
|
+
});
|
|
16
|
+
exports.sendgrid = (0, pieces_framework_1.createPiece)({
|
|
17
|
+
displayName: 'SendGrid - EU',
|
|
18
|
+
description: 'Email delivery service for sending transactional and marketing emails',
|
|
19
|
+
minimumSupportedRelease: '0.30.0',
|
|
20
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/sendgrid.png',
|
|
21
|
+
authors: ["ashrafsamhouri", "kishanprmr", "MoShizzle", "khaledmashaly", "abuaboud"],
|
|
22
|
+
categories: [shared_1.PieceCategory.COMMUNICATION, shared_1.PieceCategory.MARKETING],
|
|
23
|
+
auth: exports.sendgridAuth,
|
|
24
|
+
actions: [
|
|
25
|
+
send_email_1.sendEmail,
|
|
26
|
+
send_dynamic_template_1.sendDynamicTemplate,
|
|
27
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
28
|
+
baseUrl: () => common_1.sendgridCommon.baseUrl,
|
|
29
|
+
auth: exports.sendgridAuth,
|
|
30
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
+
return ({
|
|
32
|
+
Authorization: `Bearer ${auth.secret_text}`,
|
|
33
|
+
});
|
|
34
|
+
}),
|
|
35
|
+
}),
|
|
36
|
+
],
|
|
37
|
+
triggers: [],
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/sendgrid-eu/src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,qEAAwE;AACxE,iDAAqD;AACrD,+EAA0E;AAC1E,yDAAqD;AACrD,yCAA8C;AAEjC,QAAA,YAAY,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC/C,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,8CAA8C;CAC5D,CAAC,CAAC;AAEU,QAAA,QAAQ,GAAG,IAAA,8BAAW,EAAC;IAClC,WAAW,EAAE,eAAe;IAC5B,WAAW,EACT,uEAAuE;IAEzE,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,kDAAkD;IAC3D,OAAO,EAAE,CAAC,gBAAgB,EAAC,YAAY,EAAC,WAAW,EAAC,eAAe,EAAC,UAAU,CAAC;IAC/E,UAAU,EAAE,CAAC,sBAAa,CAAC,aAAa,EAAE,sBAAa,CAAC,SAAS,CAAC;IAClE,IAAI,EAAE,oBAAY;IAClB,OAAO,EAAE;QACP,sBAAS;QACT,2CAAmB;QACnB,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,uBAAc,CAAC,OAAO;YACrC,IAAI,EAAE,oBAAY;YAClB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC5B,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE;iBAC5C,CAAC,CAAA;cAAA;SACH,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const sendDynamicTemplate: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
to: import("@activepieces/pieces-framework").ArrayProperty<true>;
|
|
3
|
+
from_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
from: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
template_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
template_data: import("@activepieces/pieces-framework").JsonProperty<true>;
|
|
7
|
+
reply_to: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=send-dynamic-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-dynamic-template.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/sendgrid-eu/src/lib/actions/send-dynamic-template.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,mBAAmB;;;;;;;EAgE9B,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendDynamicTemplate = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
const __1 = require("../..");
|
|
9
|
+
exports.sendDynamicTemplate = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: __1.sendgridAuth,
|
|
11
|
+
name: 'send_dynamic_template',
|
|
12
|
+
displayName: 'Send Dynamic Template',
|
|
13
|
+
description: 'Send an email using a dynamic template',
|
|
14
|
+
props: {
|
|
15
|
+
to: pieces_framework_1.Property.Array({
|
|
16
|
+
displayName: 'To',
|
|
17
|
+
description: 'Emails of the recipients',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
from_name: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'From (Name)',
|
|
22
|
+
description: 'Sender name',
|
|
23
|
+
required: false,
|
|
24
|
+
}),
|
|
25
|
+
from: pieces_framework_1.Property.ShortText({
|
|
26
|
+
displayName: 'From (Email)',
|
|
27
|
+
description: 'Sender email, must be on your SendGrid',
|
|
28
|
+
required: true,
|
|
29
|
+
}),
|
|
30
|
+
template_id: pieces_framework_1.Property.ShortText({
|
|
31
|
+
displayName: 'Template Id',
|
|
32
|
+
description: 'Dynamic template id',
|
|
33
|
+
required: true,
|
|
34
|
+
}),
|
|
35
|
+
template_data: pieces_framework_1.Property.Json({
|
|
36
|
+
displayName: 'Template Data',
|
|
37
|
+
description: 'Dynamic template data',
|
|
38
|
+
required: true,
|
|
39
|
+
}),
|
|
40
|
+
reply_to: pieces_framework_1.Property.ShortText({
|
|
41
|
+
displayName: 'Reply To',
|
|
42
|
+
description: 'Email to receive replies on (defaults to sender)',
|
|
43
|
+
required: false,
|
|
44
|
+
}),
|
|
45
|
+
},
|
|
46
|
+
run(context) {
|
|
47
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const { to, from, template_id, template_data, reply_to, from_name } = context.propsValue;
|
|
49
|
+
const message = {
|
|
50
|
+
personalizations: to.map((email) => ({
|
|
51
|
+
to: [{ email: email.trim() }],
|
|
52
|
+
dynamic_template_data: template_data,
|
|
53
|
+
})),
|
|
54
|
+
from: { email: from, name: from_name },
|
|
55
|
+
reply_to: { email: reply_to !== null && reply_to !== void 0 ? reply_to : from },
|
|
56
|
+
template_id,
|
|
57
|
+
};
|
|
58
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
59
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
60
|
+
url: `${common_1.sendgridCommon.baseUrl}/mail/send`,
|
|
61
|
+
body: message,
|
|
62
|
+
authentication: {
|
|
63
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
64
|
+
token: context.auth.secret_text,
|
|
65
|
+
},
|
|
66
|
+
queryParams: {},
|
|
67
|
+
});
|
|
68
|
+
return {
|
|
69
|
+
success: true,
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=send-dynamic-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-dynamic-template.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/sendgrid-eu/src/lib/actions/send-dynamic-template.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAIqC;AACrC,sCAA2C;AAC3C,6BAAqC;AAExB,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,gBAAY;IAClB,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,uBAAuB;IACpC,WAAW,EAAE,wCAAwC;IACrD,KAAK,EAAE;QACL,EAAE,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACjB,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC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Ac,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;iBAChC;gBACD,WAAW,EAAE,EAAE;aAChB,CAAC,CAAC;YACH,OAAO;gBACL,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const sendEmail: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
to: import("@activepieces/pieces-framework").ArrayProperty<true>;
|
|
3
|
+
from: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
from_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
reply_to: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
subject: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
content_type: import("@activepieces/pieces-framework").DropdownProperty<"text" | "html", true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
8
|
+
content: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=send-email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-email.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/sendgrid-eu/src/lib/actions/send-email.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,SAAS;;;;;;;;EA+FpB,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendEmail = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
const __1 = require("../..");
|
|
9
|
+
exports.sendEmail = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: __1.sendgridAuth,
|
|
11
|
+
name: 'send_email',
|
|
12
|
+
displayName: 'Send Email',
|
|
13
|
+
description: 'Send a text or HTML email',
|
|
14
|
+
props: {
|
|
15
|
+
to: pieces_framework_1.Property.Array({
|
|
16
|
+
displayName: 'To',
|
|
17
|
+
description: 'Emails of the recipients',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
from: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'From (Email)',
|
|
22
|
+
description: 'Sender email, must be on your SendGrid',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
from_name: pieces_framework_1.Property.ShortText({
|
|
26
|
+
displayName: 'From (Name)',
|
|
27
|
+
description: 'Sender name',
|
|
28
|
+
required: false,
|
|
29
|
+
}),
|
|
30
|
+
reply_to: pieces_framework_1.Property.ShortText({
|
|
31
|
+
displayName: 'Reply To',
|
|
32
|
+
description: 'Email to receive replies on (defaults to sender)',
|
|
33
|
+
required: false,
|
|
34
|
+
}),
|
|
35
|
+
subject: pieces_framework_1.Property.ShortText({
|
|
36
|
+
displayName: 'Subject',
|
|
37
|
+
description: undefined,
|
|
38
|
+
required: true,
|
|
39
|
+
}),
|
|
40
|
+
content_type: pieces_framework_1.Property.Dropdown({
|
|
41
|
+
displayName: 'Content Type',
|
|
42
|
+
refreshers: [],
|
|
43
|
+
required: true,
|
|
44
|
+
auth: __1.sendgridAuth,
|
|
45
|
+
options: () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
+
return {
|
|
47
|
+
disabled: false,
|
|
48
|
+
options: [
|
|
49
|
+
{ label: 'Plain Text', value: 'text' },
|
|
50
|
+
{ label: 'HTML', value: 'html' },
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
}),
|
|
54
|
+
}),
|
|
55
|
+
content: pieces_framework_1.Property.ShortText({
|
|
56
|
+
displayName: 'Content',
|
|
57
|
+
description: 'HTML is only allowed if you selected HTML as type',
|
|
58
|
+
required: true,
|
|
59
|
+
}),
|
|
60
|
+
},
|
|
61
|
+
run(context) {
|
|
62
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
const { to, from, from_name, reply_to, subject, content_type, content } = context.propsValue;
|
|
64
|
+
const request = {
|
|
65
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
66
|
+
url: `${common_1.sendgridCommon.baseUrl}/mail/send`,
|
|
67
|
+
body: {
|
|
68
|
+
personalizations: to.map((x) => {
|
|
69
|
+
return {
|
|
70
|
+
to: [
|
|
71
|
+
{
|
|
72
|
+
email: x.trim(),
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
};
|
|
76
|
+
}),
|
|
77
|
+
from: {
|
|
78
|
+
email: from,
|
|
79
|
+
name: from_name,
|
|
80
|
+
},
|
|
81
|
+
reply_to: {
|
|
82
|
+
email: reply_to !== null && reply_to !== void 0 ? reply_to : from,
|
|
83
|
+
},
|
|
84
|
+
subject: subject,
|
|
85
|
+
content: [
|
|
86
|
+
{
|
|
87
|
+
type: content_type == 'text' ? 'text/plain' : 'text/html',
|
|
88
|
+
value: content,
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
authentication: {
|
|
93
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
94
|
+
token: context.auth.secret_text,
|
|
95
|
+
},
|
|
96
|
+
queryParams: {},
|
|
97
|
+
};
|
|
98
|
+
yield pieces_common_1.httpClient.sendRequest(request);
|
|
99
|
+
return {
|
|
100
|
+
success: true,
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
//# sourceMappingURL=send-email.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-email.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/sendgrid-eu/src/lib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O,CAAC,CAAC;YAEtC,OAAO;gBACL,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/sendgrid-eu/src/lib/common/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;CAE1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/sendgrid-eu/src/lib/common/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE,gCAAgC;CAC1C,CAAC"}
|