pipework 0.166.0 → 0.167.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.167.0
|
|
4
|
+
|
|
5
|
+
- **Fixed: `mail.devStandIn` writes each mail file whole before it appears** (#707). `send` wrote straight to `<dir>/<messageId>.json`, so a test or dev tool polling the directory could read a file still being written and fail to parse it (`Unexpected end of JSON input`). It now writes `.<messageId>.json.tmp` in the same directory and renames it into place, so a `*.json` file is complete the moment it is visible; a failed write removes the temp file.
|
|
6
|
+
|
|
3
7
|
## 0.166.0
|
|
4
8
|
|
|
5
9
|
- **Fixed: `quota.record` takes a live response whose reset is earlier than the stored one** (#705). A row that once took a later reset ignored every real response from the actual window until that later time passed, so a budget the upstream reported as spent (`remaining: 0`) still read as plenty left and `bulk` calls were granted past the reserve. Now a response whose reset is still in the future replaces the row's `remaining`, `reset_at` and `limit`, earlier or later; within one window (same reset second) the lower `remaining` is kept, as before; a response whose reset has already passed is ignored. `retry-after` handling is unchanged.
|
|
@@ -36,7 +36,7 @@ export declare function ses(config: SesConfig): MailProvider;
|
|
|
36
36
|
/**
|
|
37
37
|
* Development stand-in: writes each rendered message to `<dir>/<messageId>.json`
|
|
38
38
|
* (from, to, subject, text, html, and headers when there are any) and logs one line, sending nothing.
|
|
39
|
-
* `mail.create` refuses it when the environment is production.
|
|
39
|
+
* The file appears only once it is complete. `mail.create` refuses it when the environment is production.
|
|
40
40
|
*/
|
|
41
41
|
export declare function devStandIn(config: {
|
|
42
42
|
readonly dir: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../../src/infra/email/providers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAG7D,iDAAiD;AACjD,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 @@
|
|
|
1
|
-
import { mkdir, writeFile } from 'node:fs/promises';
|
|
1
|
+
import { mkdir, rename, rm, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { getBaseLogger } from '../../core/logging/index.js';
|
|
4
4
|
import { signV4 } from '../aws/sigv4.js';
|
|
@@ -57,7 +57,7 @@ export function ses(config) {
|
|
|
57
57
|
/**
|
|
58
58
|
* Development stand-in: writes each rendered message to `<dir>/<messageId>.json`
|
|
59
59
|
* (from, to, subject, text, html, and headers when there are any) and logs one line, sending nothing.
|
|
60
|
-
* `mail.create` refuses it when the environment is production.
|
|
60
|
+
* The file appears only once it is complete. `mail.create` refuses it when the environment is production.
|
|
61
61
|
*/
|
|
62
62
|
export function devStandIn(config) {
|
|
63
63
|
return {
|
|
@@ -66,10 +66,18 @@ export function devStandIn(config) {
|
|
|
66
66
|
await mkdir(config.dir, { recursive: true });
|
|
67
67
|
const file = join(config.dir, `${message.messageId}.json`);
|
|
68
68
|
const { from, to, subject, text, html, headers } = message;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
const tmp = join(config.dir, `.${message.messageId}.json.tmp`);
|
|
70
|
+
try {
|
|
71
|
+
await writeFile(tmp, JSON.stringify({
|
|
72
|
+
from, to, subject, text, ...(html !== undefined ? { html } : {}),
|
|
73
|
+
...(headers !== undefined && Object.keys(headers).length > 0 ? { headers } : {}),
|
|
74
|
+
}, null, 2));
|
|
75
|
+
await rename(tmp, file);
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
await rm(tmp, { force: true }).catch(() => { });
|
|
79
|
+
throw err;
|
|
80
|
+
}
|
|
73
81
|
getBaseLogger().info({ event: 'email dev stand-in', to, file }, 'email written to file instead of sent');
|
|
74
82
|
return { providerMessageId: `dev-${message.messageId}` };
|
|
75
83
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../../../src/infra/email/providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../../../src/infra/email/providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAuB,MAAM,iBAAiB,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AA+BtD;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,MAAiB;IACnC,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,IAAI,cAAc,EAAE,CAAA;IAC7D,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,IAAI,iBAAiB,MAAM,CAAC,MAAM,gBAAgB,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IACpG,OAAO;QACL,IAAI,EAAE,KAAK;QACX,KAAK,CAAC,IAAI,CAAC,OAAO;YAChB,MAAM,GAAG,GAAG,OAAO,CAAC,gBAAgB,IAAI,MAAM,CAAC,gBAAgB,CAAA;YAC/D,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;YAClG,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;gBAC1B,gBAAgB,EAAE,OAAO,CAAC,IAAI;gBAC9B,WAAW,EAAE,EAAE,WAAW,EAAE,CAAC,OAAO,C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