@cogenta/channels 0.3.20 → 0.3.21
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-transport.d.ts","sourceRoot":"","sources":["../../../src/providers/email/file-transport.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAA4B,MAAM,gBAAgB,CAAA;AAE9E,MAAM,WAAW,yBAAyB;IACxC,0EAA0E;IAC1E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"file-transport.d.ts","sourceRoot":"","sources":["../../../src/providers/email/file-transport.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAA4B,MAAM,gBAAgB,CAAA;AAE9E,MAAM,WAAW,yBAAyB;IACxC,0EAA0E;IAC1E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,cAAc,CA8B3F"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { chmod, mkdir, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
/**
|
|
5
5
|
* The degraded, no-external-service `EmailTransport` (R1) — writes each
|
|
@@ -11,7 +11,13 @@ import { join } from 'node:path';
|
|
|
11
11
|
export function createFileEmailTransport(options) {
|
|
12
12
|
return {
|
|
13
13
|
async send(email) {
|
|
14
|
-
|
|
14
|
+
// A reset link or an invitation in these files is a credential: the
|
|
15
|
+
// directory and each message are the owner's alone. `mkdir` does not
|
|
16
|
+
// touch a directory that exists already, hence the explicit `chmod`
|
|
17
|
+
// (it can refuse on a directory someone else owns; the files are then
|
|
18
|
+
// still private on their own).
|
|
19
|
+
await mkdir(options.directory, { recursive: true, mode: 0o700 });
|
|
20
|
+
await chmod(options.directory, 0o700).catch(() => undefined);
|
|
15
21
|
const messageId = randomUUID();
|
|
16
22
|
const contents = [
|
|
17
23
|
`To: ${email.to}`,
|
|
@@ -25,7 +31,10 @@ export function createFileEmailTransport(options) {
|
|
|
25
31
|
email.html,
|
|
26
32
|
'',
|
|
27
33
|
].join('\n');
|
|
28
|
-
await writeFile(join(options.directory, `${messageId}.eml.txt`), contents,
|
|
34
|
+
await writeFile(join(options.directory, `${messageId}.eml.txt`), contents, {
|
|
35
|
+
encoding: 'utf8',
|
|
36
|
+
mode: 0o600,
|
|
37
|
+
});
|
|
29
38
|
return { messageId };
|
|
30
39
|
},
|
|
31
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-transport.js","sourceRoot":"","sources":["../../../src/providers/email/file-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"file-transport.js","sourceRoot":"","sources":["../../../src/providers/email/file-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAQhC;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAkC;IACzE,OAAO;QACL,KAAK,CAAC,IAAI,CAAC,KAAoB;YAC7B,oEAAoE;YACpE,qEAAqE;YACrE,oEAAoE;YACpE,sEAAsE;YACtE,+BAA+B;YAC/B,MAAM,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;YAChE,MAAM,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;YAC5D,MAAM,SAAS,GAAG,UAAU,EAAE,CAAA;YAC9B,MAAM,QAAQ,GAAG;gBACf,OAAO,KAAK,CAAC,EAAE,EAAE;gBACjB,YAAY,KAAK,CAAC,OAAO,EAAE;gBAC3B,eAAe,SAAS,EAAE;gBAC1B,EAAE;gBACF,oBAAoB;gBACpB,KAAK,CAAC,IAAI;gBACV,EAAE;gBACF,mBAAmB;gBACnB,KAAK,CAAC,IAAI;gBACV,EAAE;aACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACZ,MAAM,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,SAAS,UAAU,CAAC,EAAE,QAAQ,EAAE;gBACzE,QAAQ,EAAE,MAAM;gBAChB,IAAI,EAAE,KAAK;aACZ,CAAC,CAAA;YACF,OAAO,EAAE,SAAS,EAAE,CAAA;QACtB,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cogenta/channels",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
4
4
|
"description": "Channel adapter interface and registry — Telegram, Slack, Discord, email, webhooks.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"directory": "packages/channels"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@cogenta/agents": "0.11.
|
|
31
|
-
"@cogenta/core": "0.14.
|
|
30
|
+
"@cogenta/agents": "0.11.4",
|
|
31
|
+
"@cogenta/core": "0.14.4"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"typescript": "^7.0.2",
|
|
35
|
-
"vitest": "^4.1.
|
|
35
|
+
"vitest": "^4.1.12"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "tsc -p tsconfig.json",
|