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 Mar 8, 2024
1 parent e89bf8f commit f01a873
Show file tree
Hide file tree
Showing 14 changed files with 79 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .browserslistrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Generated data.
# <generated:start>

# Last generated Mar 7, 2024 9:03 PM UTC.
# Last generated Mar 8, 2024 10:49 PM UTC.

[production]
node >= 20.9.0
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 Mar 7, 2024 9:03 PM UTC.
# Last generated Mar 8, 2024 10:49 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="j0pdIMi5eRbQg/VAF6SUfeZszgx4kmG2tqXiXo9Ilk2vD3cqqKRCC5RtZyENE+9O6ri7JOl2VRK/jv8GjFTwcOyJgqWiaApmZaTNcKfGy/5S+3eE7Ggz8d1J5LdLzT1v81x2bp3OsbZ0CJiMNbZRjQE6i6no0WgjLNTMxzod9oXMQY/I4xoY09sXPK4pmiK057PFnsmjjhcdEw8BW65ZH8q8SZsGHvTERJWX02Ycv106NotbYeV7HBvjrEqY9BqKjYhvoHT5NasnsBKVVAKmI41neV+X/+oQAJlMLbDe6G3V0rMZR9ii+bMVxfLtizPfQYr703znG07XzrSiFUgYPobsxvirDHXSuSTLju38K78qy5dT+DTA7olK8ksGhC/u1nryWUX+RG1CKuaRpMEa32DUtN4EKoI3NCa8jWfDEIsujm7pTJmt8vo6D/DkKC5K/6I9PBFV4Axh4HNOtll7q/bynqD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_VERSION=261

# 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 Mar 7, 2024 9:03 PM UTC.
# Last generated Mar 8, 2024 10:49 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 Mar 7, 2024 9:03 PM UTC.
# Last generated Mar 8, 2024 10:49 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 Mar 7, 2024 9:03 PM UTC.
# Last generated Mar 8, 2024 10:49 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 Mar 7, 2024 9:03 PM UTC.
# Last generated Mar 8, 2024 10:49 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` Mar 7, 2024 9:03 PM UTC.
* Last generated using `./settings.mjs` Mar 8, 2024 10:49 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 Mar 7, 2024 9:03 PM UTC.
# Last generated Mar 8, 2024 10:49 PM UTC.

# Locals

Expand Down
88 changes: 50 additions & 38 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.283",
"version": "1.0.284",
"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 @@ -64,7 +64,7 @@
},
"dependencies": {},
"peerDependencies": {
"@clevercanyon/utilities": "^1.0.890",
"@clevercanyon/utilities": "^1.0.891",
"@cloudflare/ai": "1.0.53",
"@upstash/ratelimit": "1.0.0",
"@upstash/redis": "1.28.0"
Expand Down
23 changes: 13 additions & 10 deletions src/cfw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,28 +106,31 @@ const maybeInitializeGlobals = async (ircData: InitialRequestContextData): Promi
* @returns Response promise.
*/
export const handleFetchEvent = async (ircData: InitialRequestContextData): Promise<$type.cfw.Response> => {
const { scheduledEvent, ctx, env, routes } = ircData;
let { request } = ircData; // Extracts wwritable irc data.
let { request } = ircData; // Extracts writable data.
const { scheduledEvent, ctx, env, routes } = ircData,
subrequestCounter = { value: 0 };

await maybeInitializeGlobals(ircData); // Initializes worker globals.

const Logger = $class.getLogger(), // Initializes base audit and consent loggers.
baseAuditLogger = new Logger({ endpointToken: $env.get('APP_AUDIT_LOGGER_BEARER_TOKEN', { type: 'string', require: true }) }),
baseConsentLogger = new Logger({ endpointToken: $env.get('APP_CONSENT_LOGGER_BEARER_TOKEN', { type: 'string', require: true }) });
//
auditLoggerBearerToken = $env.get('APP_AUDIT_LOGGER_BEARER_TOKEN', { type: 'string', require: true }),
consentLoggerBearerToken = $env.get('APP_CONSENT_LOGGER_BEARER_TOKEN', { type: 'string', require: true }),
//
baseAuditLogger = new Logger({ cfw: { ctx, subrequestCounter }, endpointToken: auditLoggerBearerToken }),
baseConsentLogger = new Logger({ cfw: { ctx, subrequestCounter }, endpointToken: consentLoggerBearerToken });

// Initializes audit logger early so it’s available for any errors below.
// However, `request` is potentially rewritten, so reinitialize if it changes.
let auditLogger = baseAuditLogger.withContext({}, { cfw: { ctx }, request });
let auditLogger = baseAuditLogger.withContext({}, { request });

try {
let originalRequest = request; // Potentially rewritten.
request = (await $http.prepareRequest(request, {})) as $type.cfw.Request;

if (request !== originalRequest /* Reinitializes using rewritten request. */) {
auditLogger = baseAuditLogger.withContext({}, { cfw: { ctx }, request });
auditLogger = baseAuditLogger.withContext({}, { request });
}
const url = $url.parse(request.url) as $type.cfw.URL,
consentLogger = baseConsentLogger.withContext({}, { cfw: { ctx }, request }),
consentLogger = baseConsentLogger.withContext({}, { request }),
rcData = $obj.freeze({
scheduledEvent,

Expand All @@ -140,7 +143,7 @@ export const handleFetchEvent = async (ircData: InitialRequestContextData): Prom

auditLogger,
consentLogger,
subrequestCounter: { value: 0 },
subrequestCounter,
});
let response: Promise<$type.cfw.Response>; // Initialize.

Expand Down
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` Mar 7, 2024 9:03 PM UTC.
* Last generated using `./tsconfig.mjs` Mar 8, 2024 10:49 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` Mar 7, 2024 9:03 PM UTC.
# Last generated using `./wrangler.mjs` Mar 8, 2024 10:49 PM UTC.
##

send_metrics = false
Expand Down

0 comments on commit f01a873

Please sign in to comment.