@bgord/bun 1.7.6 → 1.7.7
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/image-processor.port.d.ts +4 -4
- package/dist/image-processor.port.d.ts.map +1 -1
- package/dist/redactor-compact-object.strategy.d.ts +1 -1
- package/dist/redactor-compact-object.strategy.d.ts.map +1 -1
- package/dist/redactor-compact-object.strategy.js +2 -1
- package/dist/redactor-compact-object.strategy.js.map +1 -1
- package/dist/security-countermeasure.strategy.d.ts +1 -1
- package/dist/security-countermeasure.strategy.d.ts.map +1 -1
- package/dist/security-rule-violation-threshold.strategy.d.ts +1 -1
- package/dist/security-rule-violation-threshold.strategy.d.ts.map +1 -1
- package/dist/security-rule-violation-threshold.strategy.js +2 -1
- package/dist/security-rule-violation-threshold.strategy.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/image-processor.port.ts +4 -4
- package/src/redactor-compact-object.strategy.ts +3 -3
- package/src/security-countermeasure.strategy.ts +1 -1
- package/src/security-rule-violation-threshold.strategy.ts +6 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bgord/bun",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Bartosz Gordon",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"zod": "4.2.1"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@bgord/tools": "1.2.
|
|
42
|
+
"@bgord/tools": "1.2.12",
|
|
43
43
|
"better-auth": "1.4.9",
|
|
44
44
|
"croner": "9.1.0",
|
|
45
45
|
"csv": "6.4.1",
|
|
@@ -5,17 +5,17 @@ type ImageProcessorOutputPathStrategy = {
|
|
|
5
5
|
strategy: "output_path";
|
|
6
6
|
input: tools.FilePathRelative | tools.FilePathAbsolute;
|
|
7
7
|
output: tools.FilePathRelative | tools.FilePathAbsolute;
|
|
8
|
-
maxSide:
|
|
8
|
+
maxSide: tools.IntegerPositiveType;
|
|
9
9
|
to: tools.ExtensionType;
|
|
10
|
-
quality?:
|
|
10
|
+
quality?: tools.IntegerPositiveType;
|
|
11
11
|
background?: ImageBackground;
|
|
12
12
|
};
|
|
13
13
|
type ImageProcessorInPlaceStrategy = {
|
|
14
14
|
strategy: "in_place";
|
|
15
15
|
input: tools.FilePathRelative | tools.FilePathAbsolute;
|
|
16
|
-
maxSide:
|
|
16
|
+
maxSide: tools.IntegerPositiveType;
|
|
17
17
|
to: tools.ExtensionType;
|
|
18
|
-
quality?:
|
|
18
|
+
quality?: tools.IntegerPositiveType;
|
|
19
19
|
background?: ImageBackground;
|
|
20
20
|
};
|
|
21
21
|
export type ImageProcessorStrategy = ImageProcessorInPlaceStrategy | ImageProcessorOutputPathStrategy;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as tools from "@bgord/tools";
|
|
2
2
|
import _ from "lodash";
|
|
3
3
|
import type { RedactorStrategy } from "./redactor.strategy";
|
|
4
4
|
|
|
5
5
|
type RedactorWideObjectOptions = { maxKeys?: tools.IntegerPositiveType };
|
|
6
6
|
|
|
7
7
|
export class RedactorCompactObjectStrategy implements RedactorStrategy {
|
|
8
|
-
private static readonly DEFAULT_MAX_KEYS = 20;
|
|
8
|
+
private static readonly DEFAULT_MAX_KEYS = tools.IntegerPositive.parse(20);
|
|
9
9
|
|
|
10
|
-
private readonly maxKeys:
|
|
10
|
+
private readonly maxKeys: tools.IntegerPositiveType;
|
|
11
11
|
|
|
12
12
|
constructor(options: RedactorWideObjectOptions = {}) {
|
|
13
13
|
this.maxKeys = options.maxKeys ?? RedactorCompactObjectStrategy.DEFAULT_MAX_KEYS;
|
|
@@ -7,7 +7,7 @@ export type SecurityAction =
|
|
|
7
7
|
| { kind: "allow" }
|
|
8
8
|
| { kind: "deny"; reason: string; response: { status: ContentfulStatusCode } }
|
|
9
9
|
| { kind: "delay"; duration: tools.Duration; after: SecurityAction }
|
|
10
|
-
| { kind: "mirage"; response: { status:
|
|
10
|
+
| { kind: "mirage"; response: { status: ContentfulStatusCode } };
|
|
11
11
|
|
|
12
12
|
export interface SecurityCountermeasureStrategy {
|
|
13
13
|
execute(context: SecurityContext): Promise<SecurityAction>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as tools from "@bgord/tools";
|
|
2
2
|
import type { Context } from "hono";
|
|
3
3
|
import type { CacheRepositoryPort } from "./cache-repository.port";
|
|
4
4
|
import { CacheSubjectResolver } from "./cache-subject-resolver.vo";
|
|
@@ -30,9 +30,12 @@ export class SecurityRuleViolationThresholdStrategy implements SecurityRuleStrat
|
|
|
30
30
|
if (!violated) return false;
|
|
31
31
|
|
|
32
32
|
try {
|
|
33
|
-
const count = (await this.deps.CacheRepository.get<
|
|
33
|
+
const count = (await this.deps.CacheRepository.get<tools.IntegerNonNegativeType>(subject.hex)) ?? 0;
|
|
34
34
|
|
|
35
|
-
await this.deps.CacheRepository.set<
|
|
35
|
+
await this.deps.CacheRepository.set<tools.IntegerNonNegativeType>(
|
|
36
|
+
subject.hex,
|
|
37
|
+
tools.IntegerNonNegative.parse(count + 1),
|
|
38
|
+
);
|
|
36
39
|
|
|
37
40
|
if (count + 1 >= this.config.threshold) return true;
|
|
38
41
|
return false;
|