@bgord/bun 1.23.9 → 1.23.11
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/dist/cron-scheduler.adapter.d.ts.map +1 -1
- package/dist/cron-scheduler.adapter.js +2 -1
- package/dist/cron-scheduler.adapter.js.map +1 -1
- package/dist/cron-task-handler-bare.strategy.d.ts.map +1 -1
- package/dist/cron-task-handler-bare.strategy.js +4 -2
- package/dist/cron-task-handler-bare.strategy.js.map +1 -1
- package/dist/csv-formula-sanitizer.service.d.ts +5 -0
- package/dist/csv-formula-sanitizer.service.d.ts.map +1 -0
- package/dist/csv-formula-sanitizer.service.js +8 -0
- package/dist/csv-formula-sanitizer.service.js.map +1 -0
- package/dist/environment-loader-process-safe.adapter.d.ts +2 -12
- package/dist/environment-loader-process-safe.adapter.d.ts.map +1 -1
- package/dist/environment-loader-process-safe.adapter.js +2 -10
- package/dist/environment-loader-process-safe.adapter.js.map +1 -1
- package/dist/environment-loader-with-memo.adapter.d.ts +12 -0
- package/dist/environment-loader-with-memo.adapter.d.ts.map +1 -0
- package/dist/environment-loader-with-memo.adapter.js +17 -0
- package/dist/environment-loader-with-memo.adapter.js.map +1 -0
- package/dist/event-store-dispatching.adapter.d.ts.map +1 -1
- package/dist/event-store-dispatching.adapter.js +2 -1
- package/dist/event-store-dispatching.adapter.js.map +1 -1
- package/dist/hash-bytes-noop.strategy.d.ts +6 -0
- package/dist/hash-bytes-noop.strategy.d.ts.map +1 -0
- package/dist/hash-bytes-noop.strategy.js +7 -0
- package/dist/hash-bytes-noop.strategy.js.map +1 -0
- package/dist/hash-bytes-sha256.strategy.d.ts +6 -0
- package/dist/hash-bytes-sha256.strategy.d.ts.map +1 -0
- package/dist/hash-bytes-sha256.strategy.js +8 -0
- package/dist/hash-bytes-sha256.strategy.js.map +1 -0
- package/dist/hash-bytes.strategy.d.ts +5 -0
- package/dist/hash-bytes.strategy.d.ts.map +1 -0
- package/dist/hash-bytes.strategy.js +2 -0
- package/dist/hash-bytes.strategy.js.map +1 -0
- package/dist/hash-file-sha256.adapter.d.ts +4 -4
- package/dist/hash-file-sha256.adapter.d.ts.map +1 -1
- package/dist/hash-file-sha256.adapter.js +2 -2
- package/dist/hash-file-sha256.adapter.js.map +1 -1
- package/dist/idempotency-store-cache.adapter.d.ts.map +1 -1
- package/dist/idempotency-store-cache.adapter.js +1 -0
- package/dist/idempotency-store-cache.adapter.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/job-queue.adapter.d.ts.map +1 -1
- package/dist/job-queue.adapter.js +10 -3
- package/dist/job-queue.adapter.js.map +1 -1
- package/dist/markdown-generator.adapter.d.ts +1 -0
- package/dist/markdown-generator.adapter.d.ts.map +1 -1
- package/dist/markdown-generator.adapter.js +8 -1
- package/dist/markdown-generator.adapter.js.map +1 -1
- package/dist/redactor-key.vo.d.ts +8 -0
- package/dist/redactor-key.vo.d.ts.map +1 -0
- package/dist/redactor-key.vo.js +16 -0
- package/dist/redactor-key.vo.js.map +1 -0
- package/dist/redactor-mask.strategy.d.ts.map +1 -1
- package/dist/redactor-mask.strategy.js +7 -2
- package/dist/redactor-mask.strategy.js.map +1 -1
- package/dist/redactor-url-query.strategy.d.ts.map +1 -1
- package/dist/redactor-url-query.strategy.js +3 -2
- package/dist/redactor-url-query.strategy.js.map +1 -1
- package/dist/shield-body-limit.strategy.d.ts.map +1 -1
- package/dist/shield-body-limit.strategy.js +1 -0
- package/dist/shield-body-limit.strategy.js.map +1 -1
- package/dist/trailing-slash.middleware.d.ts +2 -2
- package/dist/trailing-slash.middleware.d.ts.map +1 -1
- package/dist/trailing-slash.middleware.js +5 -5
- package/dist/trailing-slash.middleware.js.map +1 -1
- package/package.json +5 -5
- package/readme.md +6 -0
- package/src/cron-scheduler.adapter.ts +2 -1
- package/src/cron-task-handler-bare.strategy.ts +5 -3
- package/src/csv-formula-sanitizer.service.ts +9 -0
- package/src/environment-loader-process-safe.adapter.ts +2 -22
- package/src/environment-loader-with-memo.adapter.ts +21 -0
- package/src/event-store-dispatching.adapter.ts +2 -1
- package/src/hash-bytes-noop.strategy.ts +8 -0
- package/src/hash-bytes-sha256.strategy.ts +10 -0
- package/src/hash-bytes.strategy.ts +5 -0
- package/src/hash-file-sha256.adapter.ts +6 -6
- package/src/idempotency-store-cache.adapter.ts +1 -0
- package/src/index.ts +5 -0
- package/src/job-queue.adapter.ts +11 -3
- package/src/markdown-generator.adapter.ts +10 -1
- package/src/redactor-key.vo.ts +15 -0
- package/src/redactor-mask.strategy.ts +9 -2
- package/src/redactor-url-query.strategy.ts +5 -2
- package/src/shield-body-limit.strategy.ts +1 -0
- package/src/trailing-slash.middleware.ts +8 -10
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import * as tools from "@bgord/tools";
|
|
2
2
|
import type { RedactorStrategy } from "./redactor.strategy";
|
|
3
|
+
import { RedactorKey } from "./redactor-key.vo";
|
|
3
4
|
import { RedactorMask } from "./redactor-mask.strategy";
|
|
4
5
|
|
|
5
6
|
export class RedactorUrlQuery implements RedactorStrategy {
|
|
6
7
|
private readonly keys: Set<string>;
|
|
7
8
|
|
|
8
9
|
constructor(keys?: ReadonlyArray<string>) {
|
|
9
|
-
this.keys = new Set(
|
|
10
|
+
this.keys = new Set(
|
|
11
|
+
(keys?.length ? keys : RedactorMask.DEFAULT_KEYS).map((key) => RedactorKey.fromString(key).get()),
|
|
12
|
+
);
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
redact<T>(input: T): T {
|
|
@@ -24,7 +27,7 @@ export class RedactorUrlQuery implements RedactorStrategy {
|
|
|
24
27
|
const masked = new URLSearchParams(
|
|
25
28
|
Array.from(new URLSearchParams(query), ([key, value]) => [
|
|
26
29
|
key,
|
|
27
|
-
this.keys.has(key.
|
|
30
|
+
this.keys.has(RedactorKey.fromString(key).get()) ? "***" : value,
|
|
28
31
|
]),
|
|
29
32
|
);
|
|
30
33
|
|
|
@@ -12,6 +12,7 @@ export class ShieldBodyLimitStrategy {
|
|
|
12
12
|
evaluate(context: HasRequestHeader): boolean {
|
|
13
13
|
const header = context.request.header("content-length");
|
|
14
14
|
|
|
15
|
+
// Header-only check: bodies without Content-Length (chunked/streamed) are bounded by Bun.serve's maxRequestBodySize instead.
|
|
15
16
|
if (header === undefined) return true;
|
|
16
17
|
|
|
17
18
|
const contentLength = v.safeParse(tools.SizeBytes, Number(header));
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HasRequestUrl } from "./request-context.port";
|
|
2
2
|
|
|
3
3
|
export type TrailingSlashResult = { redirect: false } | { redirect: true; pathname: string; status: 308 };
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
const LEADING_SLASHES = /^\/+/;
|
|
5
|
+
const EDGE_SLASHES = /^\/+|\/+$/g;
|
|
7
6
|
|
|
8
7
|
export class TrailingSlashMiddleware {
|
|
9
8
|
// RFC 7231 6.4.7 - 308 preserves the request method and body, unlike 301.
|
|
10
9
|
static readonly STATUS = 308;
|
|
11
10
|
|
|
12
|
-
evaluate(context:
|
|
13
|
-
|
|
14
|
-
if (context.request.path === "/") return { redirect: false };
|
|
11
|
+
evaluate(context: HasRequestUrl): TrailingSlashResult {
|
|
12
|
+
const path = new URL(context.request.url()).pathname;
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
)
|
|
14
|
+
if (!path.endsWith("/")) return { redirect: false };
|
|
15
|
+
if (path === "/") return { redirect: false };
|
|
16
|
+
|
|
17
|
+
const pathname = `/${path.replace(EDGE_SLASHES, "")}`;
|
|
20
18
|
|
|
21
19
|
return { redirect: true, pathname, status: TrailingSlashMiddleware.STATUS };
|
|
22
20
|
}
|