@t4h.framework/smtp 0.6.4 → 0.7.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/.ai/skills/framework-smtp/SKILL.md +6 -6
- package/CHANGELOG.md +40 -0
- package/dist/activities/SmtpSendEmailActivity.d.ts +2 -2
- package/dist/activities/SmtpSendEmailActivity.d.ts.map +1 -1
- package/dist/activities/SmtpSendEmailActivity.js.map +1 -1
- package/dist/models/Smtp.d.ts +4 -4
- package/dist/models/Smtp.d.ts.map +1 -1
- package/dist/models/Smtp.js.map +1 -1
- package/package.json +3 -3
|
@@ -95,7 +95,7 @@ input shapes:
|
|
|
95
95
|
|
|
96
96
|
| Field | Type | Notes |
|
|
97
97
|
|-------|------|-------|
|
|
98
|
-
| `connectionString` | `
|
|
98
|
+
| `connectionString` | `Secret` | From `smtp.connectionString`; the host reads the value when it sends |
|
|
99
99
|
| `from` | `string?` | `content.from ?? smtp.options.from` |
|
|
100
100
|
| `to` | `readonly string[]` | Always an array after `toInput` |
|
|
101
101
|
| `cc` | `readonly string[]?` | Omitted if not set |
|
|
@@ -121,10 +121,10 @@ Use framework `Binary` instances (e.g. from an HTTP `response.body`).
|
|
|
121
121
|
|
|
122
122
|
## Smtp client
|
|
123
123
|
|
|
124
|
-
High-level API: holds `connectionString` and optional default `from`, extends `SerializableClass` for workflow persistence.
|
|
124
|
+
High-level API: holds `connectionString` (a `Secret` from the `EnvDesign`, since the URL `smtp://user:pass@host:587` carries the password — a string is a `tsc` error) and optional default `from`, extends `SerializableClass` for workflow persistence.
|
|
125
125
|
|
|
126
126
|
```typescript
|
|
127
|
-
const smtp = new Smtp(
|
|
127
|
+
const smtp = new Smtp(environments.SMTP_URL, {
|
|
128
128
|
from: 'noreply@example.com',
|
|
129
129
|
})
|
|
130
130
|
|
|
@@ -163,7 +163,7 @@ ready, replay-safe helper. Never define or extend your own activity:
|
|
|
163
163
|
import { History } from '@t4h.framework/core'
|
|
164
164
|
import { Smtp, SmtpSendEmailActivity } from '@t4h.framework/smtp'
|
|
165
165
|
|
|
166
|
-
const smtp = new Smtp(
|
|
166
|
+
const smtp = new Smtp(environments.SMTP_URL) // Secret
|
|
167
167
|
const result = await History.reconciler(SmtpSendEmailActivity, smtp, {
|
|
168
168
|
to: 'user@example.com',
|
|
169
169
|
subject: 'Subject',
|
|
@@ -191,13 +191,13 @@ Activity and `Smtp.send` surface this type, not the raw `{ messageId }` object.
|
|
|
191
191
|
## Workflow example
|
|
192
192
|
|
|
193
193
|
```typescript
|
|
194
|
-
import { App, EnvDesign, Workflow } from '@t4h.framework/core'
|
|
194
|
+
import { App, EnvDesign, Secret, Workflow } from '@t4h.framework/core'
|
|
195
195
|
import { http } from '@t4h.framework/http'
|
|
196
196
|
import { Smtp } from '@t4h.framework/smtp'
|
|
197
197
|
import Type from 'typebox'
|
|
198
198
|
|
|
199
199
|
const env = EnvDesign({
|
|
200
|
-
SMTP_CONNECTION_STRING: { type:
|
|
200
|
+
SMTP_CONNECTION_STRING: { type: Secret }, // carries the password
|
|
201
201
|
SMTP_FROM: { type: String },
|
|
202
202
|
})
|
|
203
203
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @t4h.framework/smtp
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#181](https://github.com/tech4humans-brasil/framework/pull/181) [`9449e4e`](https://github.com/tech4humans-brasil/framework/commit/9449e4e9889f42dea1d52418140f47d25dff0535) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - A credential is a `Secret`, never a string. An env entry declared with
|
|
8
|
+
`type: Secret` hands the workflow the name of the variable; the host binds the
|
|
9
|
+
value where the activity runs, so no input, output or history record holds it.
|
|
10
|
+
|
|
11
|
+
**Breaking**: every field that carries a credential now accepts only a
|
|
12
|
+
`Secret`. Declare the entry with `type: Secret` in your `EnvDesign` and pass it
|
|
13
|
+
whole; `tsc` points at each remaining string.
|
|
14
|
+
|
|
15
|
+
**core**: `Secret` (a `SerializableClass` whose `toString`, `valueOf` and
|
|
16
|
+
`toJSON` throw), `Secret.resolve` and `Secret.read` for hosts, `Secret.FORMAT`
|
|
17
|
+
for the manifest. `EnvDesign` accepts `type: Secret`, refuses a `defaultValue`
|
|
18
|
+
on a secret entry and throws when a `String` entry receives a secret.
|
|
19
|
+
`AsyncActivityCallbackAuth` carries a `Secret` in `secret`, `password`, `token`
|
|
20
|
+
and `value`.
|
|
21
|
+
|
|
22
|
+
**http**: `auth` accepts `{ username, password }`, `{ bearer }` or
|
|
23
|
+
`{ header, value }` besides an `HttpAuth`, all with a `Secret`, and the
|
|
24
|
+
activity writes the header on the host. `clientSecret` and `password` of the
|
|
25
|
+
OAuth2 grants are a `Secret`.
|
|
26
|
+
|
|
27
|
+
**smtp**, **sftp**, **orm**: `connectionString` is a `Secret`. The
|
|
28
|
+
`SftpConnectionString` and `ORMConnectionString` aliases are gone.
|
|
29
|
+
|
|
30
|
+
**hmac**: the callback authorizer reads the secret through `Secret.read`.
|
|
31
|
+
|
|
32
|
+
**dev**: the codec writes a `Secret` by name and binds the env value only where
|
|
33
|
+
an activity runs, reading the input back from the database as the runtime does.
|
|
34
|
+
The SFTP and SMTP claims read the value on connect.
|
|
35
|
+
|
|
36
|
+
**webhook**: documents the `Secret` in `auth`.
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- Updated dependencies [[`9449e4e`](https://github.com/tech4humans-brasil/framework/commit/9449e4e9889f42dea1d52418140f47d25dff0535), [`9449e4e`](https://github.com/tech4humans-brasil/framework/commit/9449e4e9889f42dea1d52418140f47d25dff0535)]:
|
|
41
|
+
- @t4h.framework/core@0.15.0
|
|
42
|
+
|
|
3
43
|
## 0.6.4
|
|
4
44
|
|
|
5
45
|
### Patch Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Binary, SyncActivity } from '@t4h.framework/core';
|
|
1
|
+
import { Binary, SyncActivity, type Secret } from '@t4h.framework/core';
|
|
2
2
|
import type { Smtp } from '../models/Smtp.js';
|
|
3
3
|
import { SmtpSendEmailOutput, type ISmtpSendEmailOutput } from '../models/SmtpSendEmailOutput.js';
|
|
4
4
|
export type SmtpSendEmailActivityAttachment = {
|
|
@@ -15,7 +15,7 @@ export type SmtpSendEmailActivityOptions = {
|
|
|
15
15
|
attachments?: readonly SmtpSendEmailActivityAttachment[];
|
|
16
16
|
};
|
|
17
17
|
export type SmtpSendEmailActivityInput = {
|
|
18
|
-
connectionString:
|
|
18
|
+
connectionString: Secret;
|
|
19
19
|
from?: string;
|
|
20
20
|
subject: string;
|
|
21
21
|
html: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmtpSendEmailActivity.d.ts","sourceRoot":"","sources":["../../src/activities/SmtpSendEmailActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAS,YAAY,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"SmtpSendEmailActivity.d.ts","sourceRoot":"","sources":["../../src/activities/SmtpSendEmailActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAS,YAAY,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAE9E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAE7C,OAAO,EACL,mBAAmB,EACnB,KAAK,oBAAoB,EAC1B,MAAM,kCAAkC,CAAA;AAEzC,MAAM,MAAM,+BAA+B,GAAG;IAC5C,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,EAAE,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAA;IAC9B,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAA;IAC/B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAA;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,SAAS,+BAA+B,EAAE,CAAA;CACzD,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,gBAAgB,EAAE,MAAM,CAAA;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,SAAS,MAAM,EAAE,CAAA;IACrB,EAAE,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACtB,GAAG,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACvB,WAAW,CAAC,EAAE,SAAS,+BAA+B,EAAE,CAAA;CACzD,CAAA;AAED,QAAA,MAAM,+BAA+B,eAEpC,CAAA;AAED,qBAAa,qBAAsB,SAAQ,YAAY,CACrD,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,4BAA4B,CAAC,EAC5D,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,CACpB;IACC,OAAO,CAAC,QAAQ,CAAC,CAAC,+BAA+B,CAAC,CAEhD;IAEK,OAAO,CACZ,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,GACpC,0BAA0B;IA6BtB,GAAG,CAAC,OAAO,EAAE,0BAA0B;IAIvC,QAAQ,CAAC,MAAM,EAAE,oBAAoB;CAG7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmtpSendEmailActivity.js","sourceRoot":"","sources":["../../src/activities/SmtpSendEmailActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"SmtpSendEmailActivity.js","sourceRoot":"","sources":["../../src/activities/SmtpSendEmailActivity.ts"],"names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IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,EAAE;YACF,EAAE;YACF,GAAG;YACH,WAAW,EAAE,OAAO,CAAC,WAAW;SACjC,CAAA;IACH,CAAC;IAEM,GAAG,CAAC,OAAmC;QAC5C,OAAO,IAAI,CAAC,+BAA+B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACjE,CAAC;IAEM,QAAQ,CAAC,MAA4B;QAC1C,OAAO,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAA;IACxC,CAAC;CACF"}
|
package/dist/models/Smtp.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { SerializableClass, type PromiseLikeType } from '@t4h.framework/core';
|
|
1
|
+
import { SerializableClass, type PromiseLikeType, type Secret } from '@t4h.framework/core';
|
|
2
2
|
import { type SmtpSendEmailActivityOptions } from '../activities/SmtpSendEmailActivity.js';
|
|
3
3
|
export type SmtpOptions = {
|
|
4
4
|
from?: string;
|
|
5
5
|
};
|
|
6
6
|
export declare class Smtp extends SerializableClass {
|
|
7
|
-
readonly connectionString:
|
|
7
|
+
readonly connectionString: Secret;
|
|
8
8
|
readonly options: SmtpOptions;
|
|
9
9
|
toSerializable(): {
|
|
10
|
-
connectionString:
|
|
10
|
+
connectionString: Secret;
|
|
11
11
|
options: SmtpOptions;
|
|
12
12
|
};
|
|
13
13
|
protected fromSerializable(serializable: PromiseLikeType<ReturnType<this['toSerializable']>>): void;
|
|
14
|
-
constructor(connectionString:
|
|
14
|
+
constructor(connectionString: Secret, options?: SmtpOptions);
|
|
15
15
|
send(options: SmtpSendEmailActivityOptions): Promise<import("./SmtpSendEmailOutput.js").SmtpSendEmailOutput>;
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=Smtp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Smtp.d.ts","sourceRoot":"","sources":["../../src/models/Smtp.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"Smtp.d.ts","sourceRoot":"","sources":["../../src/models/Smtp.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,MAAM,EACZ,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,wCAAwC,CAAA;AAI/C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,qBAAa,IAAK,SAAQ,iBAAiB;aAmBvB,gBAAgB,EAAE,MAAM;aACxB,OAAO,EAAE,WAAW;IAnB/B,cAAc;;;;IAOrB,SAAS,CAAC,gBAAgB,CACxB,YAAY,EAAE,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAChE,IAAI;gBASW,gBAAgB,EAAE,MAAM,EACxB,OAAO,GAAE,WAAgB;IAKpC,IAAI,CAAC,OAAO,EAAE,4BAA4B;CAGlD"}
|
package/dist/models/Smtp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Smtp.js","sourceRoot":"","sources":["../../src/models/Smtp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,iBAAiB,
|
|
1
|
+
{"version":3,"file":"Smtp.js","sourceRoot":"","sources":["../../src/models/Smtp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,iBAAiB,GAGlB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACL,qBAAqB,GAEtB,MAAM,wCAAwC,CAAA;AAE/C,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAA;AAMhD,MAAM,OAAO,IAAK,SAAQ,iBAAiB;IAmBvB;IACA;IAnBX,cAAc;QACnB,OAAO;YACL,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAA;IACH,CAAC;IAES,gBAAgB,CACxB,YAAiE;QAEjE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,kBAAkB,EAAE;YAC9C,KAAK,EAAE,YAAY,CAAC,gBAAgB;SACrC,CAAC,CAAA;QAEF,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC,CAAA;IACzE,CAAC;IAED,YACkB,gBAAwB,EACxB,UAAuB,EAAE;QAEzC,KAAK,EAAE,CAAA;QAHS,qBAAgB,GAAhB,gBAAgB,CAAQ;QACxB,YAAO,GAAP,OAAO,CAAkB;IAG3C,CAAC;IAEM,IAAI,CAAC,OAAqC;QAC/C,OAAO,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAC5B,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t4h.framework/smtp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "SMTP module for the T4H Framework",
|
|
5
5
|
"homepage": "https://github.com/tech4humans-brasil/framework/tree/main/packages/smtp",
|
|
6
6
|
"bugs": "https://github.com/tech4humans-brasil/framework/issues",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"test:watch": "vitest"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@t4h.framework/core": "^0.
|
|
34
|
+
"@t4h.framework/core": "^0.15.0",
|
|
35
35
|
"typescript": "^5.9.3",
|
|
36
36
|
"vitest": "^4.0.18"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@t4h.framework/core": "^0.
|
|
39
|
+
"@t4h.framework/core": "^0.15.0"
|
|
40
40
|
},
|
|
41
41
|
"packageManager": "yarn@4.12.0",
|
|
42
42
|
"engines": {
|