Skip to content

Commit

Permalink
Project update. [p][robotic]
Browse files Browse the repository at this point in the history
  • Loading branch information
jaswrks committed Apr 2, 2024
1 parent 87182e0 commit 4862e26
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 53 deletions.
12 changes: 6 additions & 6 deletions .browserslistrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
# Generated data.
# <generated:start>

# Last generated Apr 1, 2024 4:33 PM UTC.
# Last generated Apr 2, 2024 2:01 PM UTC.

[production]
node >= 20.9.0
and_chr >= 92
chrome >= 92
and_ff >= 90
android >= 122
android >= 123
edge >= 92
samsung >= 16.0
safari >= 15.4
Expand All @@ -48,7 +48,7 @@ node >= 20.9.0
and_chr >= 92
chrome >= 92
and_ff >= 90
android >= 122
android >= 123
edge >= 92
samsung >= 16.0
safari >= 15.4
Expand All @@ -72,7 +72,7 @@ node >= 20.9.0
and_chr >= 92
chrome >= 92
and_ff >= 90
android >= 122
android >= 123
edge >= 92
samsung >= 16.0
safari >= 15.4
Expand Down Expand Up @@ -107,7 +107,7 @@ not dead
and_chr >= 92
chrome >= 92
and_ff >= 90
android >= 122
android >= 123
edge >= 92
samsung >= 16.0
safari >= 15.4
Expand All @@ -130,7 +130,7 @@ not dead
and_chr >= 92
chrome >= 92
and_ff >= 90
android >= 122
android >= 123
edge >= 92
samsung >= 16.0
safari >= 15.4
Expand Down
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Generated data.
# <generated:start>

# Last generated Apr 1, 2024 4:33 PM UTC.
# Last generated Apr 2, 2024 2:01 PM UTC.

# Locals

Expand Down
8 changes: 4 additions & 4 deletions .env.vault
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ DOTENV_VAULT_MAIN="3rfi+ClkONvfHPiU9FTBcC1+Um/L8QeM9dRw1jFzEqzZXw=="
DOTENV_VAULT_MAIN_VERSION=1

# dev
DOTENV_VAULT_DEV="I+O6hGwTS+s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VYAtBGHKxFBTRQT+UVabqpO9MVfSyAyY2h/+aTIegAdIaYN9T0D7S9lAqkrzEN/B5CeLQAokzyfeL7ug53XYx/cN9SXbDMnrUDKh1hKM8dHAPhQlhvMd+w3Al5ohE6KcMYjf32rfw7wJ9Jmtb0LUOEKP77aZjwBbYgdHxKY9IumvMUovPCZjPFE3HVReQx6EY+9Eb1LdUxBn8lEUUP242WAc0y1eN/Jlv+yJP+7Z9zDU7KO30HsTpTQIt9PzHcQWF6nNK33agjYsoDU0TT13OtyVlP8a3+AiOaHDY6s9q9NXl1DPxXnotwfnSpAy4838j0FlXEZc5e3Sncg2ttNlEvX8HbGAvq+tIrI/z/02/SbfxHQmyOJ8h5m/x1wQlIbLprh63dXfWAXYzBrPuAI/XDk8OUUG97pWZ1x50gQIL6zZfg4VPo5F1DKwToflmc"
DOTENV_VAULT_CI_VERSION=303

# stage
DOTENV_VAULT_STAGE="bfqZYD8oVLWMZ0JR5LICV+sB/btaXavszxZLxTfwSH8U5fg="
Expand Down
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Generated data.
# <generated:start>

# Last generated Apr 1, 2024 4:33 PM UTC.
# Last generated Apr 2, 2024 2:01 PM UTC.

# Default

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Generated data.
# <generated:start>

# Last generated Apr 1, 2024 4:33 PM UTC.
# Last generated Apr 2, 2024 2:01 PM UTC.

# Locals

Expand Down
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# Generated data.
# <generated:start>

# Last generated Apr 1, 2024 4:33 PM UTC.
# Last generated Apr 2, 2024 2:01 PM UTC.

# Locals

Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Generated data.
# <generated:start>

# Last generated Apr 1, 2024 4:33 PM UTC.
# Last generated Apr 2, 2024 2:01 PM UTC.

# Packages

Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @note This entire file will be updated automatically.
* @note Instead of editing here, please review `./settings.mjs`.
*
* Last generated using `./settings.mjs` Apr 1, 2024 4:33 PM UTC.
* Last generated using `./settings.mjs` Apr 2, 2024 2:01 PM UTC.
*/
{
"editor.formatOnType": false,
Expand Down
2 changes: 1 addition & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Generated data.
# <generated:start>

# Last generated Apr 1, 2024 4:33 PM UTC.
# Last generated Apr 2, 2024 2:01 PM UTC.

# Locals

Expand Down
44 changes: 22 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publishConfig": {
"access": "public"
},
"version": "1.0.304",
"version": "1.0.305",
"license": "GPL-3.0-or-later",
"name": "@clevercanyon/utilities.cfw",
"description": "Utilities for JavaScript apps running in a Cloudflare Worker environment.",
Expand Down Expand Up @@ -74,7 +74,7 @@
},
"dependencies": {},
"peerDependencies": {
"@clevercanyon/utilities": "^1.0.935",
"@clevercanyon/utilities": "^1.0.936",
"@cloudflare/ai": "1.0.53",
"@upstash/ratelimit": "1.0.0",
"@upstash/redis": "1.28.0"
Expand Down
2 changes: 1 addition & 1 deletion src/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ const rateLimiterCore = $fn.memo(
opts = $obj.defaults({}, $obj.omit(options || {}, instanceOptionKeys), {
prefix: '', // Default key prefix is set below, based on options.
slidingWindow: [10, '10s'], // e.g., `10` requests every `10s` periodicity.
ephemeralCacheMaxSize: 10240, // 1048576b = 1MB, x 5 = 5242880b, / ~512b per entry, = 10240.
ephemeralCacheMaxSize: 10240, // 1048576b = 1MB, x 5 = 5242880b, / ~512b per entry = 10240.
analytics: false, // Enabling analytics uses an additional 'command' per `.limit()` invocation, and persistent storage keys.
// We don’t use Upstash proper, we use it via Digital Ocean, which doesn’t support automatic eviction, so we shouldn’t enable analytics.
timeout: 0, // If network issues arise, we allow requests in after this delay, when greater than `0`.
Expand Down
23 changes: 14 additions & 9 deletions src/smtp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import '#@initialize.ts';

import { $root, cfw } from '#index.ts';
import { $app, $env, $json, $obj, $str, $time, $to, type $type } from '@clevercanyon/utilities';
import { $app, $env, $is, $json, $obj, $str, $time, $to, type $type } from '@clevercanyon/utilities';

/**
* Defines types.
Expand Down Expand Up @@ -43,9 +43,9 @@ export type ResponsePayload = $type.ReadonlyDeep<{
* @param rcData Request context data.
* @param options {@see SendOptions}.
*
* @returns Promise of boolean `true` on success, else `false` on failure.
* @returns Promise of {@see ResponsePayload}.
*/
export const send = async (rcData: $type.$cfw.RequestContextData, options: SendOptions): Promise<boolean> => {
export const send = async (rcData: $type.$cfw.RequestContextData, options: SendOptions): Promise<ResponsePayload> => {
const { Request, AbortSignal } = cfw,
{ auditLogger } = rcData,
//
Expand All @@ -54,7 +54,7 @@ export const send = async (rcData: $type.$cfw.RequestContextData, options: SendO
from: brand ? $str.quote(brand.name, { type: 'double' }) + ' <' + brand.contacts.support.email + '>' : '',
}) as SendOptions,
//
request = new Request('https://workers.hop.gdn/api/smtp/v1', {
smtpRequest = new Request('https://workers.hop.gdn/api/smtp/v1', {
method: 'POST',
headers: {
'content-type': $json.contentType(),
Expand All @@ -65,13 +65,18 @@ export const send = async (rcData: $type.$cfw.RequestContextData, options: SendO
});
return (
$root
.fetch(rcData, request)
.fetch(rcData, smtpRequest) // Via root API route; {@see ResponsePayload}.
.then(async (response) => $to.plainObject(await response.json()) as ResponsePayload)
.then((payload): boolean => (payload.ok ? true : false))
//
.catch((thrown: unknown): boolean => {
void auditLogger.warn('SMTP send error.', { request, thrown });
return false;
.catch((thrown: unknown): ResponsePayload => {
const auditLogMessage =
'SMTP error' + // As verbose as possible.
($is.error(thrown) && thrown.message // Have message?
? ': ' + $str.rTrim(thrown.message, '.') + '.'
: ' code: QXsH9kYC.');

void auditLogger.warn(auditLogMessage, { smtpRequest, thrown });
return { ok: false, error: { message: 'SMTP error code: QXsH9kYC.' } } as ResponsePayload;
})
);
};
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @note This entire file will be updated automatically.
* @note Instead of editing here, please review `./tsconfig.mjs`.
*
* Last generated using `./tsconfig.mjs` Apr 1, 2024 4:33 PM UTC.
* Last generated using `./tsconfig.mjs` Apr 2, 2024 2:01 PM UTC.
*/
{
"include": ["./src/**/*", "./dev-types.d.ts"],
Expand Down
2 changes: 1 addition & 1 deletion wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# @note This entire file will be updated automatically.
# @note Instead of editing here, please review `./wrangler.mjs`.
#
# Last generated using `./wrangler.mjs` Apr 1, 2024 4:33 PM UTC.
# Last generated using `./wrangler.mjs` Apr 2, 2024 2:01 PM UTC.
##

send_metrics = false
Expand Down

0 comments on commit 4862e26

Please sign in to comment.