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 11, 2024
1 parent ff9579b commit a5f5c86
Show file tree
Hide file tree
Showing 14 changed files with 56 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 Apr 11, 2024 8:59 AM UTC.
# Last generated Apr 11, 2024 10:22 AM 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 Apr 11, 2024 8:59 AM UTC.
# Last generated Apr 11, 2024 10:22 AM 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="7GW98NfL4hM4N6HbfeDXCKreVxKvcVPupFRnZ8XJ+pomaQ=="
DOTENV_VAULT_MAIN_VERSION=1

# dev
DOTENV_VAULT_DEV="kIu9u/NTqrUs80hDQwX9rJh/lRtKiV5B4cBzKN69/KS9DgYpaMABF1THG6Cwn2u1tUzw4k8ZSdbHd3er76iOad2dZeMdd5q87PStodFmBTfv4X9OA1fPZW0CDqXAPM3E/mnTPs75XcMz7NIsKcSeRmJZGcILSJBbYApcXMcMQd2HFg+8xeObaGSmKK0dlUDE5vL9IzHh/n9CtJ+WLyCsftIQhhTAjGfq5rBoDFrLto/MHwHDW0MBByHPEfYJNzyWfA=="
DOTENV_VAULT_DEV_VERSION=537
DOTENV_VAULT_DEV="tx+AF0/wIv83wy2NXqUftMKOwPA1DFytmxZ9Qky7IxAqLsi6pHx8YZJL2Nz/mQWeimEiKyE9+P059dZv30rsfoSUj1isROf1Prt0Mt7/u5BMTjxL1FUnTGbow9DH/ux2mcetcNWgsAzt6SX2t4piGaJoNFaMcV51x7FNYtmdvzXz64Fb0XhaoHORtFzzty9W11ck8FEsp5WtPoOgCVcUfAYOhqqOTwdpA+DwU81yfdEbG5y3N2MeRW/LLpLxC4YzBQ=="
DOTENV_VAULT_DEV_VERSION=539

# ci
DOTENV_VAULT_CI="Edz2bvpt9PnxRdyL8/oucHFk3SQJ9Pfno33dkslLsNoPgNWBZqZSBUjyEleE7btmYJ8lgWr8EYqJtIvanslFFrBXuzSnTzgCZORVVGEdhPYL05ibAG5b4RdRpDCtZr6bld227yVPmQfNr5BQVUDzddL5jT55verd58VuHVV/Uw=="
DOTENV_VAULT_CI_VERSION=537
DOTENV_VAULT_CI="cWnpmjrAeOsw2xSVnQFnDj/H6XTg6kMqKNm8AjGhu0KotThxUmQk0DKO6Xje2/KzBiTB4h49AAAeDSFx6L9B663iJHXAqjEUtw4Qf3fnn9tSNAthc9IgQdBvdt4aOF+QkxXv6kVSKPQc6wlEaMFebpfZ6A/OS4NNe2dekNB8Jw=="
DOTENV_VAULT_CI_VERSION=539

# stage
DOTENV_VAULT_STAGE="aRP8su2YV4jZu3w1HZ/SLaots0IwJDFw75TCpvXEFeNp7tw="
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 11, 2024 8:59 AM UTC.
# Last generated Apr 11, 2024 10:22 AM 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 11, 2024 8:59 AM UTC.
# Last generated Apr 11, 2024 10:22 AM 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 11, 2024 8:59 AM UTC.
# Last generated Apr 11, 2024 10:22 AM 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 11, 2024 8:59 AM UTC.
# Last generated Apr 11, 2024 10:22 AM 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 11, 2024 8:59 AM UTC.
* Last generated using `./settings.mjs` Apr 11, 2024 10:22 AM 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 11, 2024 8:59 AM UTC.
# Last generated Apr 11, 2024 10:22 AM UTC.

# Locals

Expand Down
62 changes: 31 additions & 31 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publishConfig": {
"access": "public"
},
"version": "1.0.955",
"version": "1.0.956",
"license": "GPL-3.0-or-later",
"name": "@clevercanyon/utilities",
"description": "Utilities for JavaScript apps running in any environment.",
Expand Down
28 changes: 10 additions & 18 deletions src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,21 @@ import { $app, $crypto, $env, $fn, $gzip, $is, $json, $mime, $obj, $path, $str,
/**
* Defines types.
*/
export type RouteConfig = Partial<
// Partial response configuration.
Pick<ResponseConfig, 'enableCORs' | 'cacheUsers' | 'cacheVersion' | 'varyOn'>
>;
export type RouteConfig = {
enableCORs?: boolean;
cacheUsers?: boolean;
cacheVersion?: string;
varyOn?: string[];
};
export type RequestConfig = {
cspNonce?: string;
enforceAppBaseURLOrigin?: boolean;
enforceNoTrailingSlash?: boolean;
};
export type ResponseConfig = {
enableCORs?: boolean;

export type ResponseConfig = RouteConfig & {
status?: number;
statusText?: string;

cacheUsers?: boolean;
cacheVersion?: string;
varyOn?: string[];

maxAge?: number | null;
sMaxAge?: number | null;
staleAge?: number | null;
Expand Down Expand Up @@ -87,6 +83,8 @@ export type BrowserUAHeaders = {
export const routeConfig = (config?: RouteConfig): Required<RouteConfig> => {
return $obj.defaults({}, config || {}, {
enableCORs: false,
cacheUsers: true,
cacheVersion: '',
varyOn: [],
}) as Required<RouteConfig>;
};
Expand Down Expand Up @@ -526,15 +524,9 @@ export const supportedRequestMethods = (): string[] => ['OPTIONS', 'HEAD', 'GET'
* @returns HTTP response config promise.
*/
export const responseConfig = async (config?: ResponseConfig): Promise<Required<ResponseConfig>> => {
return $obj.defaults({}, config || {}, {
enableCORs: false,

return $obj.defaults({}, config || {}, routeConfig(), {
status: 405,

cacheUsers: false,
cacheVersion: '',
varyOn: [],

maxAge: null,
sMaxAge: null,
staleAge: null,
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` Apr 11, 2024 8:59 AM UTC.
* Last generated using `./tsconfig.mjs` Apr 11, 2024 10:22 AM 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 11, 2024 8:59 AM UTC.
# Last generated using `./wrangler.mjs` Apr 11, 2024 10:22 AM UTC.
##

send_metrics = false
Expand Down

0 comments on commit a5f5c86

Please sign in to comment.