aboutsummaryrefslogtreecommitdiff
path: root/deno
diff options
context:
space:
mode:
Diffstat (limited to 'deno')
-rw-r--r--deno/base/config.ts2
-rw-r--r--deno/base/deno.json3
-rw-r--r--deno/base/lib.ts (renamed from deno/base/date.ts)4
-rw-r--r--deno/base/log.ts2
-rw-r--r--deno/base/text.ts3
-rw-r--r--deno/deno.json6
-rw-r--r--deno/mail-relay/aws/app.ts10
-rw-r--r--deno/mail-relay/aws/deliver.ts8
-rw-r--r--deno/mail-relay/aws/fetch.ts7
-rw-r--r--deno/mail-relay/dovecot.ts4
-rw-r--r--deno/mail-relay/mail.test.ts2
-rw-r--r--deno/tools/deno.json2
-rw-r--r--deno/tools/template.ts4
13 files changed, 31 insertions, 26 deletions
diff --git a/deno/base/config.ts b/deno/base/config.ts
index 8fce1d8..a5f5d86 100644
--- a/deno/base/config.ts
+++ b/deno/base/config.ts
@@ -1,4 +1,4 @@
-import { camelCaseToKebabCase } from "./text.ts";
+import { camelCaseToKebabCase } from "./lib.ts";
export interface ConfigDefinitionItem {
readonly description: string;
diff --git a/deno/base/deno.json b/deno/base/deno.json
index 2c2d550..dabc02a 100644
--- a/deno/base/deno.json
+++ b/deno/base/deno.json
@@ -2,10 +2,9 @@
"name": "@crupest/base",
"version": "0.1.0",
"exports": {
+ ".": "./lib.ts",
"./config": "./config.ts",
"./cron": "./cron.ts",
- "./date": "./date.ts",
- "./text": "./text.ts",
"./log": "./log.ts"
}
}
diff --git a/deno/base/date.ts b/deno/base/lib.ts
index e65691e..a5e4a6a 100644
--- a/deno/base/date.ts
+++ b/deno/base/lib.ts
@@ -1,3 +1,7 @@
+export function camelCaseToKebabCase(str: string): string {
+ return str.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase());
+}
+
export function toFileNameString(date: Date, dateOnly?: boolean): string {
const str = date.toISOString();
return dateOnly === true
diff --git a/deno/base/log.ts b/deno/base/log.ts
index bfd5fae..940f569 100644
--- a/deno/base/log.ts
+++ b/deno/base/log.ts
@@ -1,6 +1,6 @@
import { join } from "@std/path";
-import { toFileNameString } from "./date.ts";
+import { toFileNameString } from "./lib.ts";
export interface ExternalLogStream extends Disposable {
stream: WritableStream;
diff --git a/deno/base/text.ts b/deno/base/text.ts
deleted file mode 100644
index f3e4020..0000000
--- a/deno/base/text.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export function camelCaseToKebabCase(str: string): string {
- return str.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase());
-}
diff --git a/deno/deno.json b/deno/deno.json
index f4859d1..53cdf7a 100644
--- a/deno/deno.json
+++ b/deno/deno.json
@@ -1,7 +1,7 @@
{
- "workspace": ["./base", "./mail-relay", "./tools" ],
+ "workspace": ["./base", "./mail-relay", "./tools"],
"tasks": {
- "compile:mail-relay": "deno task --cwd=mail-relay compile",
+ "compile:mail-relay": "deno task --cwd=mail-relay compile"
},
"imports": {
"@std/collections": "jsr:@std/collections@^1.1.1",
@@ -13,7 +13,7 @@
"@std/testing": "jsr:@std/testing@^1.0.13",
"@std/dotenv": "jsr:@std/dotenv@^0.225.5",
"@std/fs": "jsr:@std/fs@^1.0.18",
- "yargs": "npm:yargs@^18.0.0"
+ "yargs": "npm:yargs@^18.0.0",
"@types/yargs": "npm:@types/yargs@^17.0.33"
}
}
diff --git a/deno/mail-relay/aws/app.ts b/deno/mail-relay/aws/app.ts
index 13db351..cb275ae 100644
--- a/deno/mail-relay/aws/app.ts
+++ b/deno/mail-relay/aws/app.ts
@@ -18,7 +18,7 @@ import {
} from "./mail.ts";
import { AwsMailDeliverer } from "./deliver.ts";
import { AwsMailFetcher, AwsS3MailConsumer } from "./fetch.ts";
-import { createInbound, createHono, sendMail, createSmtp } from "../app.ts";
+import { createHono, createInbound, createSmtp, sendMail } from "../app.ts";
const PREFIX = "crupest-mail-server";
const CONFIG_DEFINITIONS = {
@@ -103,7 +103,7 @@ function createOutbound(
);
deliverer.postHooks.push(
new AwsMailMessageIdSaveHook((original, aws) =>
- db.addMessageIdMap({ message_id: original, aws_message_id: aws }).then(),
+ db.addMessageIdMap({ message_id: original, aws_message_id: aws }).then()
),
);
return deliverer;
@@ -210,8 +210,10 @@ function createServerServices() {
path: config.get("awsInboundPath"),
auth: config.get("awsInboundKey"),
callback: (s3Key, recipients) => {
- return fetcher.consumeS3Mail(s3Key, (rawMail, _) =>
- inbound.deliver({ mail: new Mail(rawMail), recipients }).then(),
+ return fetcher.consumeS3Mail(
+ s3Key,
+ (rawMail, _) =>
+ inbound.deliver({ mail: new Mail(rawMail), recipients }).then(),
);
},
});
diff --git a/deno/mail-relay/aws/deliver.ts b/deno/mail-relay/aws/deliver.ts
index a002eda..4dd4b3a 100644
--- a/deno/mail-relay/aws/deliver.ts
+++ b/deno/mail-relay/aws/deliver.ts
@@ -40,14 +40,14 @@ export class AwsMailDeliverer extends SyncMailDeliverer {
if (res.MessageId == null) {
console.warn("Aws send-email returns no message id.");
} else {
- context.result.awsMessageId = `${res.MessageId}@${
- this.#aws.region
- }.amazonses.com`;
+ context.result.awsMessageId =
+ `${res.MessageId}@${this.#aws.region}.amazonses.com`;
}
context.result.recipients.set("*", {
kind: "done",
- message: `Successfully called aws send-email, message id ${context.result.awsMessageId}.`,
+ message:
+ `Successfully called aws send-email, message id ${context.result.awsMessageId}.`,
});
} catch (cause) {
context.result.recipients.set("*", {
diff --git a/deno/mail-relay/aws/fetch.ts b/deno/mail-relay/aws/fetch.ts
index bbb671a..9278e63 100644
--- a/deno/mail-relay/aws/fetch.ts
+++ b/deno/mail-relay/aws/fetch.ts
@@ -7,7 +7,7 @@ import {
S3ClientConfig,
} from "@aws-sdk/client-s3";
-import { toFileNameString } from "@crupest/base/date";
+import { toFileNameString } from "@crupest/base";
import { Mail } from "../mail.ts";
@@ -104,8 +104,9 @@ export class AwsMailFetcher {
.sections()
.headers()
.date();
- const dateString =
- date != null ? toFileNameString(date, true) : "invalid-date";
+ const dateString = date != null
+ ? toFileNameString(date, true)
+ : "invalid-date";
const newPath = `${this.#archivePrefix}${dateString}/${s3Key}`;
console.info(`Archiving s3 mail ${s3Key} to ${newPath}...`);
diff --git a/deno/mail-relay/dovecot.ts b/deno/mail-relay/dovecot.ts
index 333b803..bace225 100644
--- a/deno/mail-relay/dovecot.ts
+++ b/deno/mail-relay/dovecot.ts
@@ -46,8 +46,8 @@ export class DovecotMailDeliverer extends MailDeliverer {
});
const ldaProcess = ldaCommand.spawn();
- using logFiles =
- await this.#logFileProvider.createExternalLogStreamsForProgram(
+ using logFiles = await this.#logFileProvider
+ .createExternalLogStreamsForProgram(
ldaBinName,
);
ldaProcess.stdout.pipeTo(logFiles.stdout);
diff --git a/deno/mail-relay/mail.test.ts b/deno/mail-relay/mail.test.ts
index 6abb7d7..cd0c38d 100644
--- a/deno/mail-relay/mail.test.ts
+++ b/deno/mail-relay/mail.test.ts
@@ -87,7 +87,7 @@ describe("Mail", () => {
}),
]).toEqual(
[...mockToAddresses, mockCcAddress].filter((a) =>
- a.endsWith("example.com"),
+ a.endsWith("example.com")
),
);
});
diff --git a/deno/tools/deno.json b/deno/tools/deno.json
index 1b2cf32..355046a 100644
--- a/deno/tools/deno.json
+++ b/deno/tools/deno.json
@@ -3,6 +3,6 @@
"tasks": {
},
"imports": {
- "mustache": "npm:mustache@^4.2.0",
+ "mustache": "npm:mustache@^4.2.0"
}
}
diff --git a/deno/tools/template.ts b/deno/tools/template.ts
index 0b043a1..1b67eb8 100644
--- a/deno/tools/template.ts
+++ b/deno/tools/template.ts
@@ -73,7 +73,9 @@ export class TemplateDir {
generate(vars: Record<string, string>, generatedDir?: string) {
console.log(
- `Generating, template dir: ${this.dir}, generated dir: ${generatedDir ?? "[dry-run]"}:`,
+ `Generating, template dir: ${this.dir}, generated dir: ${
+ generatedDir ?? "[dry-run]"
+ }:`,
);
const undefinedVars = this.allNeededVars().filter((v) => !(v in vars));