@activepieces/piece-smtp 0.0.5 → 0.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/package.json +12 -8
- package/src/index.d.ts +14 -1
- package/src/index.js +61 -1
- package/src/index.js.map +1 -1
- package/src/lib/actions/send-email.d.ts +15 -1
- package/src/lib/actions/send-email.js +8 -33
- package/src/lib/actions/send-email.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-smtp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@sinclair/typebox": "0.26.
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
5
|
+
"@sinclair/typebox": "^0.26.3",
|
|
6
|
+
"axios": "1.4.0",
|
|
7
|
+
"dayjs": "^1.11.8",
|
|
8
|
+
"is-base64": "^1.1.0",
|
|
9
|
+
"nanoid": "^3.3.4",
|
|
10
|
+
"nodemailer": "^6.9.3",
|
|
11
|
+
"object-sizeof": "^2.6.3",
|
|
12
|
+
"semver": "7.5.3",
|
|
13
|
+
"@activepieces/pieces-framework": "0.6.11",
|
|
14
|
+
"@activepieces/shared": "0.7.0",
|
|
15
|
+
"tslib": "1.14.1"
|
|
12
16
|
},
|
|
13
17
|
"main": "./src/index.js",
|
|
14
18
|
"types": "./src/index.d.ts"
|
package/src/index.d.ts
CHANGED
|
@@ -1 +1,14 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const smtpAuth: import("@activepieces/pieces-framework").CustomAuthProperty<true, {
|
|
2
|
+
host: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
port: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
TLS: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const smtp: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<true, {
|
|
9
|
+
host: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
+
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
11
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
12
|
+
port: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
+
TLS: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
14
|
+
}>>;
|
package/src/index.js
CHANGED
|
@@ -1,14 +1,74 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.smtp = void 0;
|
|
3
|
+
exports.smtp = exports.smtpAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
6
|
const send_email_1 = require("./lib/actions/send-email");
|
|
7
|
+
const nodemailer_1 = tslib_1.__importDefault(require("nodemailer"));
|
|
8
|
+
exports.smtpAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
9
|
+
required: true,
|
|
10
|
+
props: {
|
|
11
|
+
host: pieces_framework_1.Property.ShortText({
|
|
12
|
+
displayName: 'Host',
|
|
13
|
+
required: true,
|
|
14
|
+
}),
|
|
15
|
+
email: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Email',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
password: pieces_framework_1.PieceAuth.SecretText({
|
|
20
|
+
displayName: 'Password',
|
|
21
|
+
required: true,
|
|
22
|
+
}),
|
|
23
|
+
port: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'Port',
|
|
25
|
+
required: true,
|
|
26
|
+
}),
|
|
27
|
+
TLS: pieces_framework_1.Property.Checkbox({
|
|
28
|
+
displayName: 'Use TLS',
|
|
29
|
+
defaultValue: false,
|
|
30
|
+
required: true,
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
validate: ({ auth }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
34
|
+
try {
|
|
35
|
+
const transporter = nodemailer_1.default.createTransport({
|
|
36
|
+
host: auth.host,
|
|
37
|
+
port: +auth.port,
|
|
38
|
+
auth: {
|
|
39
|
+
user: auth.email,
|
|
40
|
+
pass: auth.password,
|
|
41
|
+
},
|
|
42
|
+
connectionTimeout: 5000,
|
|
43
|
+
secure: auth.TLS,
|
|
44
|
+
});
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
transporter.verify(function (error, success) {
|
|
47
|
+
if (error) {
|
|
48
|
+
resolve({ valid: false, error: JSON.stringify(error) });
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
resolve({ valid: true });
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
return {
|
|
58
|
+
valid: false,
|
|
59
|
+
error: JSON.stringify(e)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
});
|
|
6
64
|
exports.smtp = (0, pieces_framework_1.createPiece)({
|
|
7
65
|
displayName: 'SMTP',
|
|
66
|
+
minimumSupportedRelease: '0.5.0',
|
|
8
67
|
logoUrl: 'https://cdn.activepieces.com/pieces/smtp.png',
|
|
9
68
|
authors: [
|
|
10
69
|
'abaza738'
|
|
11
70
|
],
|
|
71
|
+
auth: exports.smtpAuth,
|
|
12
72
|
actions: [
|
|
13
73
|
send_email_1.sendEmail,
|
|
14
74
|
],
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/smtp/src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/smtp/src/index.ts"],"names":[],"mappings":";;;;AACA,qEAAkF;AAClF,yDAAqD;AACrD,oEAAoC;AAEvB,QAAA,QAAQ,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC3C,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACL,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,MAAM;YACnB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,4BAAS,CAAC,UAAU,CAAC;YAC7B,WAAW,EAAE,UAAU;YACvB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,MAAM;YACnB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,GAAG,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACrB,WAAW,EAAE,SAAS;YACtB,YAAY,EAAE,KAAK;YACnB,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,QAAQ,EAAE,CAAO,EAAE,IAAI,EAAE,EAAE,EAAE;QAC3B,IAAI;YACF,MAAM,WAAW,GAAG,oBAAU,CAAC,eAAe,CAAC;gBAC7C,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI;gBAChB,IAAI,EAAE;oBACJ,IAAI,EAAE,IAAI,CAAC,KAAK;oBAChB,IAAI,EAAE,IAAI,CAAC,QAAQ;iBACpB;gBACD,iBAAiB,EAAE,IAAI;gBACvB,MAAM,EAAE,IAAI,CAAC,GAAG;aACjB,CAAC,CAAC;YACH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBACrC,WAAW,CAAC,MAAM,CAAC,UAAU,KAAK,EAAE,OAAO;oBACzC,IAAI,KAAK,EAAE;wBACT,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;qBACzD;yBAAM;wBACL,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;qBAC1B;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;QAAC,OAAO,CAAC,EAAE;YACV,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;aACzB,CAAC;SACH;IACH,CAAC,CAAA;CACF,CAAC,CAAA;AAEW,QAAA,IAAI,GAAG,IAAA,8BAAW,EAAC;IAC9B,WAAW,EAAE,MAAM;IACnB,uBAAuB,EAAE,OAAO;IAChC,OAAO,EAAE,8CAA8C;IACvD,OAAO,EAAE;QACP,UAAU;KACX;IACD,IAAI,EAAE,gBAAQ;IACd,OAAO,EAAE;QACP,sBAAS;KACV;IACD,QAAQ,EAAE,EACT;CACF,CAAC,CAAC"}
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
export declare const sendEmail: import("@activepieces/pieces-framework").
|
|
1
|
+
export declare const sendEmail: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<true, {
|
|
2
|
+
host: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
port: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
TLS: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
7
|
+
}>, {
|
|
8
|
+
from: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
|
+
to: import("@activepieces/pieces-framework").ArrayProperty<true>;
|
|
10
|
+
cc: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
11
|
+
replyTo: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
+
bcc: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
13
|
+
subject: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
14
|
+
body: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
15
|
+
}>;
|
|
@@ -4,38 +4,13 @@ exports.sendEmail = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const nodemailer_1 = tslib_1.__importDefault(require("nodemailer"));
|
|
7
|
+
const __1 = require("../..");
|
|
7
8
|
exports.sendEmail = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: __1.smtpAuth,
|
|
8
10
|
name: 'send-email',
|
|
9
11
|
displayName: 'Send Email',
|
|
10
12
|
description: 'Send an email using a custom SMTP server.',
|
|
11
13
|
props: {
|
|
12
|
-
authentication: pieces_framework_1.Property.CustomAuth({
|
|
13
|
-
displayName: 'Authentication',
|
|
14
|
-
required: true,
|
|
15
|
-
props: {
|
|
16
|
-
host: pieces_framework_1.Property.ShortText({
|
|
17
|
-
displayName: 'Host',
|
|
18
|
-
required: true,
|
|
19
|
-
}),
|
|
20
|
-
email: pieces_framework_1.Property.ShortText({
|
|
21
|
-
displayName: 'Email',
|
|
22
|
-
required: true,
|
|
23
|
-
}),
|
|
24
|
-
password: pieces_framework_1.Property.SecretText({
|
|
25
|
-
displayName: 'Password',
|
|
26
|
-
required: true,
|
|
27
|
-
}),
|
|
28
|
-
port: pieces_framework_1.Property.ShortText({
|
|
29
|
-
displayName: 'Port',
|
|
30
|
-
required: true,
|
|
31
|
-
}),
|
|
32
|
-
TLS: pieces_framework_1.Property.Checkbox({
|
|
33
|
-
displayName: 'Use TLS',
|
|
34
|
-
defaultValue: false,
|
|
35
|
-
required: true,
|
|
36
|
-
}),
|
|
37
|
-
},
|
|
38
|
-
}),
|
|
39
14
|
from: pieces_framework_1.Property.ShortText({
|
|
40
15
|
displayName: 'From',
|
|
41
16
|
required: true,
|
|
@@ -65,16 +40,16 @@ exports.sendEmail = (0, pieces_framework_1.createAction)({
|
|
|
65
40
|
required: true,
|
|
66
41
|
}),
|
|
67
42
|
},
|
|
68
|
-
run: ({ propsValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
run: ({ auth, propsValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
69
44
|
var _a, _b;
|
|
70
45
|
const transporter = nodemailer_1.default.createTransport({
|
|
71
|
-
host:
|
|
72
|
-
port: +
|
|
46
|
+
host: auth.host,
|
|
47
|
+
port: +auth.port,
|
|
73
48
|
auth: {
|
|
74
|
-
user:
|
|
75
|
-
pass:
|
|
49
|
+
user: auth.email,
|
|
50
|
+
pass: auth.password,
|
|
76
51
|
},
|
|
77
|
-
secure:
|
|
52
|
+
secure: auth.TLS,
|
|
78
53
|
});
|
|
79
54
|
const info = yield transporter.sendMail({
|
|
80
55
|
from: propsValue.from,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-email.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/smtp/src/lib/actions/send-email.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,oEAAoC;
|
|
1
|
+
{"version":3,"file":"send-email.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/smtp/src/lib/actions/send-email.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,oEAAoC;AACpC,6BAAiC;AAEpB,QAAA,SAAS,GAAG,IAAA,+BAAY,EAAC;IAClC,IAAI,EAAE,YAAQ;IACV,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,2CAA2C;IACxD,KAAK,EAAE;QACH,IAAI,EAAE,2BAAQ,C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