@bgord/bun 1.5.11 → 1.6.1
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/cache-file.service.d.ts +3 -3
- package/dist/cache-file.service.js +2 -2
- package/dist/cache-file.service.js.map +1 -1
- package/dist/cache-repository-node-cache.adapter.d.ts +5 -4
- package/dist/cache-repository-node-cache.adapter.d.ts.map +1 -1
- package/dist/cache-repository-node-cache.adapter.js +6 -6
- package/dist/cache-repository-node-cache.adapter.js.map +1 -1
- package/dist/cache-repository.port.d.ts +4 -4
- package/dist/cache-repository.port.d.ts.map +1 -1
- package/dist/cache-resolver-simple.adapter.d.ts +4 -3
- package/dist/cache-resolver-simple.adapter.d.ts.map +1 -1
- package/dist/cache-resolver-simple.adapter.js +5 -5
- package/dist/cache-resolver-simple.adapter.js.map +1 -1
- package/dist/cache-resolver.port.d.ts +3 -3
- package/dist/cache-resolver.port.d.ts.map +1 -1
- package/dist/cache-response.middleware.d.ts +2 -4
- package/dist/cache-response.middleware.d.ts.map +1 -1
- package/dist/cache-response.middleware.js +2 -3
- package/dist/cache-response.middleware.js.map +1 -1
- package/dist/cache-subject-resolver.vo.d.ts +22 -0
- package/dist/cache-subject-resolver.vo.d.ts.map +1 -0
- package/dist/cache-subject-resolver.vo.js +19 -0
- package/dist/cache-subject-resolver.vo.js.map +1 -0
- package/dist/cache-subject-segment-cookie.d.ts +8 -0
- package/dist/cache-subject-segment-cookie.d.ts.map +1 -0
- package/dist/cache-subject-segment-cookie.js +13 -0
- package/dist/cache-subject-segment-cookie.js.map +1 -0
- package/dist/cache-subject-segment-fixed.d.ts +7 -0
- package/dist/cache-subject-segment-fixed.d.ts.map +1 -0
- package/dist/cache-subject-segment-fixed.js +10 -0
- package/dist/cache-subject-segment-fixed.js.map +1 -0
- package/dist/cache-subject-segment-header.d.ts +8 -0
- package/dist/cache-subject-segment-header.d.ts.map +1 -0
- package/dist/cache-subject-segment-header.js +10 -0
- package/dist/cache-subject-segment-header.js.map +1 -0
- package/dist/cache-subject-segment-path.d.ts +6 -0
- package/dist/cache-subject-segment-path.d.ts.map +1 -0
- package/dist/cache-subject-segment-path.js +6 -0
- package/dist/cache-subject-segment-path.js.map +1 -0
- package/dist/cache-subject-segment-query.d.ts +6 -0
- package/dist/cache-subject-segment-query.d.ts.map +1 -0
- package/dist/cache-subject-segment-query.js +10 -0
- package/dist/cache-subject-segment-query.js.map +1 -0
- package/dist/cache-subject-segment-user.d.ts +6 -0
- package/dist/cache-subject-segment-user.d.ts.map +1 -0
- package/dist/cache-subject-segment-user.js +6 -0
- package/dist/cache-subject-segment-user.js.map +1 -0
- package/dist/cache-subject-segment.port.d.ts +6 -0
- package/dist/cache-subject-segment.port.d.ts.map +1 -0
- package/dist/cache-subject-segment.port.js +2 -0
- package/dist/cache-subject-segment.port.js.map +1 -0
- package/dist/checksum.service.d.ts +2 -2
- package/dist/checksum.service.js +2 -2
- package/dist/checksum.service.js.map +1 -1
- package/dist/client.vo.d.ts +3 -1
- package/dist/client.vo.d.ts.map +1 -1
- package/dist/client.vo.js +8 -1
- package/dist/client.vo.js.map +1 -1
- package/dist/environment-loader-process-safe.adapter.d.ts +2 -0
- package/dist/environment-loader-process-safe.adapter.d.ts.map +1 -1
- package/dist/environment-loader-process-safe.adapter.js +5 -1
- package/dist/environment-loader-process-safe.adapter.js.map +1 -1
- package/dist/hash-content-noop.adapter.d.ts +6 -0
- package/dist/hash-content-noop.adapter.d.ts.map +1 -0
- package/dist/hash-content-noop.adapter.js +7 -0
- package/dist/hash-content-noop.adapter.js.map +1 -0
- package/dist/hash-content-sha256-bun.adapter.d.ts +6 -0
- package/dist/hash-content-sha256-bun.adapter.d.ts.map +1 -0
- package/dist/{content-hash-sha256-bun.adapter.js → hash-content-sha256-bun.adapter.js} +4 -3
- package/dist/hash-content-sha256-bun.adapter.js.map +1 -0
- package/dist/hash-content.port.d.ts +5 -0
- package/dist/hash-content.port.d.ts.map +1 -0
- package/dist/hash-content.port.js +2 -0
- package/dist/hash-content.port.js.map +1 -0
- package/dist/hash-file-noop.adapter.d.ts +12 -0
- package/dist/hash-file-noop.adapter.d.ts.map +1 -0
- package/dist/{file-hash-noop.adapter.js → hash-file-noop.adapter.js} +4 -4
- package/dist/hash-file-noop.adapter.js.map +1 -0
- package/dist/hash-file-sha256-bun.adapter.d.ts +18 -0
- package/dist/hash-file-sha256-bun.adapter.d.ts.map +1 -0
- package/dist/{file-hash-sha256-bun.adapter.js → hash-file-sha256-bun.adapter.js} +7 -5
- package/dist/hash-file-sha256-bun.adapter.js.map +1 -0
- package/dist/hash-file.port.d.ts +12 -0
- package/dist/hash-file.port.d.ts.map +1 -0
- package/dist/hash-file.port.js +2 -0
- package/dist/hash-file.port.js.map +1 -0
- package/dist/hash-value.vo.d.ts +8 -0
- package/dist/hash-value.vo.d.ts.map +1 -0
- package/dist/hash-value.vo.js +9 -0
- package/dist/hash-value.vo.js.map +1 -0
- package/dist/hash.vo.d.ts +12 -0
- package/dist/hash.vo.d.ts.map +1 -0
- package/dist/hash.vo.js +26 -0
- package/dist/hash.vo.js.map +1 -0
- package/dist/http-logger.middleware.js +2 -2
- package/dist/http-logger.middleware.js.map +1 -1
- package/dist/index.d.ts +17 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -16
- package/dist/index.js.map +1 -1
- package/dist/remote-file-storage-disk.adapter.d.ts +2 -2
- package/dist/remote-file-storage-disk.adapter.d.ts.map +1 -1
- package/dist/remote-file-storage-disk.adapter.js +2 -2
- package/dist/remote-file-storage-noop.adapter.js +2 -2
- package/dist/remote-file-storage-noop.adapter.js.map +1 -1
- package/dist/remote-file-storage.port.d.ts +3 -3
- package/dist/shield-rate-limit.adapter.d.ts +2 -5
- package/dist/shield-rate-limit.adapter.d.ts.map +1 -1
- package/dist/shield-rate-limit.adapter.js +2 -4
- package/dist/shield-rate-limit.adapter.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/visitor-id-client.adapter.d.ts +14 -0
- package/dist/visitor-id-client.adapter.d.ts.map +1 -0
- package/dist/visitor-id-client.adapter.js +14 -0
- package/dist/visitor-id-client.adapter.js.map +1 -0
- package/dist/visitor-id.port.d.ts +2 -2
- package/dist/visitor-id.port.d.ts.map +1 -1
- package/package.json +2 -2
- package/readme.md +17 -15
- package/src/cache-file.service.ts +7 -7
- package/src/cache-repository-node-cache.adapter.ts +8 -7
- package/src/cache-repository.port.ts +4 -5
- package/src/cache-resolver-simple.adapter.ts +7 -6
- package/src/cache-resolver.port.ts +3 -3
- package/src/cache-response.middleware.ts +4 -8
- package/src/cache-subject-resolver.vo.ts +30 -0
- package/src/cache-subject-segment-cookie.ts +12 -0
- package/src/cache-subject-segment-fixed.ts +9 -0
- package/src/cache-subject-segment-header.ts +10 -0
- package/src/cache-subject-segment-path.ts +8 -0
- package/src/cache-subject-segment-query.ts +13 -0
- package/src/cache-subject-segment-user.ts +8 -0
- package/src/cache-subject-segment.port.ts +7 -0
- package/src/checksum.service.ts +4 -4
- package/src/client.vo.ts +15 -1
- package/src/environment-loader-process-safe.adapter.ts +8 -2
- package/src/hash-content-noop.adapter.ts +8 -0
- package/src/{content-hash-sha256-bun.adapter.ts → hash-content-sha256-bun.adapter.ts} +4 -3
- package/src/hash-content.port.ts +5 -0
- package/src/{file-hash-noop.adapter.ts → hash-file-noop.adapter.ts} +4 -4
- package/src/{file-hash-sha256-bun.adapter.ts → hash-file-sha256-bun.adapter.ts} +8 -5
- package/src/{file-hash.port.ts → hash-file.port.ts} +5 -5
- package/src/hash-value.vo.ts +13 -0
- package/src/hash.vo.ts +29 -0
- package/src/http-logger.middleware.ts +2 -2
- package/src/index.ts +17 -16
- package/src/remote-file-storage-disk.adapter.ts +4 -4
- package/src/remote-file-storage-noop.adapter.ts +2 -2
- package/src/remote-file-storage.port.ts +3 -3
- package/src/shield-rate-limit.adapter.ts +4 -9
- package/src/visitor-id-client.adapter.ts +20 -0
- package/src/visitor-id.port.ts +2 -2
- package/dist/client-from-hono.adapter.d.ts +0 -6
- package/dist/client-from-hono.adapter.d.ts.map +0 -1
- package/dist/client-from-hono.adapter.js +0 -11
- package/dist/client-from-hono.adapter.js.map +0 -1
- package/dist/content-hash-noop.adapter.d.ts +0 -7
- package/dist/content-hash-noop.adapter.d.ts.map +0 -1
- package/dist/content-hash-noop.adapter.js +0 -6
- package/dist/content-hash-noop.adapter.js.map +0 -1
- package/dist/content-hash-sha256-bun.adapter.d.ts +0 -7
- package/dist/content-hash-sha256-bun.adapter.d.ts.map +0 -1
- package/dist/content-hash-sha256-bun.adapter.js.map +0 -1
- package/dist/content-hash.port.d.ts +0 -7
- package/dist/content-hash.port.d.ts.map +0 -1
- package/dist/content-hash.port.js +0 -2
- package/dist/content-hash.port.js.map +0 -1
- package/dist/file-etag.vo.d.ts +0 -8
- package/dist/file-etag.vo.d.ts.map +0 -1
- package/dist/file-etag.vo.js +0 -9
- package/dist/file-etag.vo.js.map +0 -1
- package/dist/file-hash-noop.adapter.d.ts +0 -11
- package/dist/file-hash-noop.adapter.d.ts.map +0 -1
- package/dist/file-hash-noop.adapter.js.map +0 -1
- package/dist/file-hash-sha256-bun.adapter.d.ts +0 -11
- package/dist/file-hash-sha256-bun.adapter.d.ts.map +0 -1
- package/dist/file-hash-sha256-bun.adapter.js.map +0 -1
- package/dist/file-hash.port.d.ts +0 -12
- package/dist/file-hash.port.d.ts.map +0 -1
- package/dist/file-hash.port.js +0 -2
- package/dist/file-hash.port.js.map +0 -1
- package/dist/markdown-generator-noop.adapter.d.ts +0 -5
- package/dist/markdown-generator-noop.adapter.d.ts.map +0 -1
- package/dist/markdown-generator-noop.adapter.js +0 -6
- package/dist/markdown-generator-noop.adapter.js.map +0 -1
- package/dist/markdown-generator.port.d.ts +0 -4
- package/dist/markdown-generator.port.d.ts.map +0 -1
- package/dist/markdown-generator.port.js +0 -3
- package/dist/markdown-generator.port.js.map +0 -1
- package/dist/secret-manager-noop.adapter.d.ts +0 -9
- package/dist/secret-manager-noop.adapter.d.ts.map +0 -1
- package/dist/secret-manager-noop.adapter.js +0 -10
- package/dist/secret-manager-noop.adapter.js.map +0 -1
- package/dist/secret-manager.port.d.ts +0 -5
- package/dist/secret-manager.port.d.ts.map +0 -1
- package/dist/secret-manager.port.js +0 -2
- package/dist/secret-manager.port.js.map +0 -1
- package/dist/visitor-id-hash-hono.adapter.d.ts +0 -8
- package/dist/visitor-id-hash-hono.adapter.d.ts.map +0 -1
- package/dist/visitor-id-hash-hono.adapter.js +0 -13
- package/dist/visitor-id-hash-hono.adapter.js.map +0 -1
- package/dist/visitor-id-hash.adapter.d.ts +0 -8
- package/dist/visitor-id-hash.adapter.d.ts.map +0 -1
- package/dist/visitor-id-hash.adapter.js +0 -18
- package/dist/visitor-id-hash.adapter.js.map +0 -1
- package/dist/visitor-id.vo.d.ts +0 -9
- package/dist/visitor-id.vo.d.ts.map +0 -1
- package/dist/visitor-id.vo.js +0 -12
- package/dist/visitor-id.vo.js.map +0 -1
- package/src/client-from-hono.adapter.ts +0 -16
- package/src/content-hash-noop.adapter.ts +0 -7
- package/src/content-hash.port.ts +0 -5
- package/src/file-etag.vo.ts +0 -13
- package/src/markdown-generator-noop.adapter.ts +0 -7
- package/src/markdown-generator.port.ts +0 -3
- package/src/secret-manager-noop.adapter.ts +0 -11
- package/src/secret-manager.port.ts +0 -5
- package/src/visitor-id-hash-hono.adapter.ts +0 -17
- package/src/visitor-id-hash.adapter.ts +0 -21
- package/src/visitor-id.vo.ts +0 -15
package/src/hash.vo.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { HashValue, type HashValueType } from "./hash-value.vo";
|
|
2
|
+
|
|
3
|
+
export class Hash {
|
|
4
|
+
private constructor(private readonly value: HashValueType) {}
|
|
5
|
+
|
|
6
|
+
static fromValue(value: HashValueType): Hash {
|
|
7
|
+
return new Hash(value);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static fromString(candidate: string): Hash {
|
|
11
|
+
return new Hash(HashValue.parse(candidate));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
get(): HashValueType {
|
|
15
|
+
return this.value;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
matches(another: Hash): boolean {
|
|
19
|
+
return this.value === another.value;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
toString(): string {
|
|
23
|
+
return this.value;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
toJSON(): string {
|
|
27
|
+
return this.value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -2,7 +2,7 @@ import * as tools from "@bgord/tools";
|
|
|
2
2
|
import { createMiddleware } from "hono/factory";
|
|
3
3
|
import { CacheSourceEnum } from "./cache-resolver.port";
|
|
4
4
|
import { CacheResponse } from "./cache-response.middleware";
|
|
5
|
-
import {
|
|
5
|
+
import { Client } from "./client.vo";
|
|
6
6
|
import type { ClockPort } from "./clock.port";
|
|
7
7
|
import type { LoggerPort } from "./logger.port";
|
|
8
8
|
|
|
@@ -45,7 +45,7 @@ export class HttpLogger {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
const correlationId = context.get("requestId");
|
|
48
|
-
const client =
|
|
48
|
+
const client = Client.fromHonoContext(context).toJSON();
|
|
49
49
|
|
|
50
50
|
const httpRequestBeforeMetadata = {
|
|
51
51
|
params: context.req.param(),
|
package/src/index.ts
CHANGED
|
@@ -15,21 +15,25 @@ export * from "./cache-repository-noop.adapter";
|
|
|
15
15
|
export * from "./cache-resolver.port";
|
|
16
16
|
export * from "./cache-resolver-simple.adapter";
|
|
17
17
|
export * from "./cache-response.middleware";
|
|
18
|
+
export * from "./cache-subject-resolver.vo";
|
|
19
|
+
export * from "./cache-subject-segment.port";
|
|
20
|
+
export * from "./cache-subject-segment-cookie";
|
|
21
|
+
export * from "./cache-subject-segment-fixed";
|
|
22
|
+
export * from "./cache-subject-segment-header";
|
|
23
|
+
export * from "./cache-subject-segment-path";
|
|
24
|
+
export * from "./cache-subject-segment-query";
|
|
25
|
+
export * from "./cache-subject-segment-user";
|
|
18
26
|
export * from "./certificate-inspector.port";
|
|
19
27
|
export * from "./certificate-inspector-noop.adapter";
|
|
20
28
|
export * from "./certificate-inspector-tls.adapter";
|
|
21
29
|
export * from "./checksum.service";
|
|
22
30
|
export * from "./client.vo";
|
|
23
|
-
export * from "./client-from-hono.adapter";
|
|
24
31
|
export * from "./clock.port";
|
|
25
32
|
export * from "./clock-fixed.adapter";
|
|
26
33
|
export * from "./clock-system.adapter";
|
|
27
34
|
export * from "./command.types";
|
|
28
35
|
export * from "./command-envelope";
|
|
29
36
|
export * from "./command-logger.service";
|
|
30
|
-
export * from "./content-hash.port";
|
|
31
|
-
export * from "./content-hash-noop.adapter";
|
|
32
|
-
export * from "./content-hash-sha256-bun.adapter";
|
|
33
37
|
export * from "./context.middleware";
|
|
34
38
|
export * from "./correlation-id.vo";
|
|
35
39
|
export * from "./correlation-storage.service";
|
|
@@ -68,10 +72,6 @@ export * from "./file-cleaner-bun-forgiving.adapter";
|
|
|
68
72
|
export * from "./file-cleaner-noop.adapter";
|
|
69
73
|
export * from "./file-draft.service";
|
|
70
74
|
export * from "./file-draft-zip.service";
|
|
71
|
-
export * from "./file-etag.vo";
|
|
72
|
-
export * from "./file-hash.port";
|
|
73
|
-
export * from "./file-hash-noop.adapter";
|
|
74
|
-
export * from "./file-hash-sha256-bun.adapter";
|
|
75
75
|
export * from "./file-renamer.port";
|
|
76
76
|
export * from "./file-renamer.port";
|
|
77
77
|
export * from "./file-renamer-fs.adapter";
|
|
@@ -86,6 +86,14 @@ export * from "./gzip.port";
|
|
|
86
86
|
export * from "./gzip-bun.adapter";
|
|
87
87
|
export * from "./gzip-noop.adapter";
|
|
88
88
|
export * from "./gzip-stream.adapter";
|
|
89
|
+
export * from "./hash.vo";
|
|
90
|
+
export * from "./hash-content.port";
|
|
91
|
+
export * from "./hash-content-noop.adapter";
|
|
92
|
+
export * from "./hash-content-sha256-bun.adapter";
|
|
93
|
+
export * from "./hash-file.port";
|
|
94
|
+
export * from "./hash-file-noop.adapter";
|
|
95
|
+
export * from "./hash-file-sha256-bun.adapter";
|
|
96
|
+
export * from "./hash-value.vo";
|
|
89
97
|
export * from "./hcaptcha-secret-key.vo";
|
|
90
98
|
export * from "./hcaptcha-site-key.vo";
|
|
91
99
|
export * from "./healthcheck.service";
|
|
@@ -138,9 +146,6 @@ export * from "./mailer.vo";
|
|
|
138
146
|
export * from "./mailer-noop.adapter";
|
|
139
147
|
export * from "./mailer-smtp.adapter";
|
|
140
148
|
export * from "./mailer-smtp-with-logger.adapter";
|
|
141
|
-
export * from "./markdown-generator.port";
|
|
142
|
-
// export * from "./markdown-generator-marked.adapter"; # release candidate
|
|
143
|
-
export * from "./markdown-generator-noop.adapter";
|
|
144
149
|
export * from "./memory-consumption.service";
|
|
145
150
|
export * as History from "./modules/history";
|
|
146
151
|
export * as Preferences from "./modules/preferences";
|
|
@@ -164,8 +169,6 @@ export * from "./remote-file-storage-disk.adapter";
|
|
|
164
169
|
export * from "./remote-file-storage-noop.adapter";
|
|
165
170
|
export * from "./safe-parse-body.service";
|
|
166
171
|
export * from "./secret.vo";
|
|
167
|
-
export * from "./secret-manager.port";
|
|
168
|
-
export * from "./secret-manager-noop.adapter";
|
|
169
172
|
export * from "./setup.service";
|
|
170
173
|
export * from "./shield.port";
|
|
171
174
|
export * from "./shield-api-key.adapter";
|
|
@@ -193,7 +196,5 @@ export * from "./translations.service";
|
|
|
193
196
|
export * from "./uptime.service";
|
|
194
197
|
export * from "./uuid.vo";
|
|
195
198
|
export * from "./visitor-id.port";
|
|
196
|
-
export * from "./visitor-id.
|
|
197
|
-
export * from "./visitor-id-hash.adapter";
|
|
198
|
-
export * from "./visitor-id-hash-hono.adapter";
|
|
199
|
+
export * from "./visitor-id-client.adapter";
|
|
199
200
|
export * from "./weak-etag-extractor.middleware";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import * as tools from "@bgord/tools";
|
|
3
3
|
import type { FileCleanerPort } from "./file-cleaner.port";
|
|
4
|
-
import type { FileHashPort } from "./file-hash.port";
|
|
5
4
|
import type { FileRenamerPort } from "./file-renamer.port";
|
|
5
|
+
import type { HashFilePort } from "./hash-file.port";
|
|
6
6
|
import type {
|
|
7
7
|
RemoteFileStoragePort,
|
|
8
8
|
RemoteHeadResult,
|
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
|
|
13
13
|
type RemoteFileStorageDiskConfig = { root: tools.DirectoryPathAbsoluteType };
|
|
14
14
|
|
|
15
|
-
type Dependencies = {
|
|
15
|
+
type Dependencies = { HashFile: HashFilePort; FileCleaner: FileCleanerPort; FileRenamer: FileRenamerPort };
|
|
16
16
|
|
|
17
17
|
export class RemoteFileStorageDiskAdapter implements RemoteFileStoragePort {
|
|
18
18
|
constructor(
|
|
@@ -39,14 +39,14 @@ export class RemoteFileStorageDiskAdapter implements RemoteFileStoragePort {
|
|
|
39
39
|
await Bun.write(temporary.get(), source);
|
|
40
40
|
await this.deps.FileRenamer.rename(temporary, final);
|
|
41
41
|
|
|
42
|
-
return this.deps.
|
|
42
|
+
return this.deps.HashFile.hash(final);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
async head(key: tools.ObjectKeyType): Promise<RemoteHeadResult> {
|
|
46
46
|
const path = this.resolveKeyToAbsoluteFilePath(key);
|
|
47
47
|
|
|
48
48
|
try {
|
|
49
|
-
return { exists: true, ...(await this.deps.
|
|
49
|
+
return { exists: true, ...(await this.deps.HashFile.hash(path)) };
|
|
50
50
|
} catch {
|
|
51
51
|
return { exists: false };
|
|
52
52
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as tools from "@bgord/tools";
|
|
2
2
|
import type { ClockPort } from "./clock.port";
|
|
3
|
-
import {
|
|
3
|
+
import { Hash } from "./hash.vo";
|
|
4
4
|
import type { LoggerPort } from "./logger.port";
|
|
5
5
|
import type {
|
|
6
6
|
RemoteFileStoragePort,
|
|
@@ -29,7 +29,7 @@ export class RemoteFileStorageNoopAdapter implements RemoteFileStoragePort {
|
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
return {
|
|
32
|
-
etag:
|
|
32
|
+
etag: Hash.fromString("0000000000000000000000000000000000000000000000000000000000000000"),
|
|
33
33
|
size: tools.Size.fromBytes(10),
|
|
34
34
|
lastModified: this.deps.Clock.now(),
|
|
35
35
|
mime: tools.MIMES.text,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type * as tools from "@bgord/tools";
|
|
2
|
-
import type {
|
|
2
|
+
import type { HashFileResult } from "./hash-file.port";
|
|
3
3
|
|
|
4
4
|
export type RemotePutFromPathInput = {
|
|
5
5
|
key: tools.ObjectKeyType;
|
|
6
6
|
path: tools.FilePathRelative | tools.FilePathAbsolute;
|
|
7
7
|
};
|
|
8
|
-
export type RemotePutFromPathResult =
|
|
9
|
-
export type RemoteHeadResult = { exists: false } | ({ exists: true } &
|
|
8
|
+
export type RemotePutFromPathResult = HashFileResult;
|
|
9
|
+
export type RemoteHeadResult = { exists: false } | ({ exists: true } & HashFileResult);
|
|
10
10
|
|
|
11
11
|
export interface RemoteFileStoragePort {
|
|
12
12
|
putFromPath(input: RemotePutFromPathInput): Promise<RemotePutFromPathResult>;
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import * as tools from "@bgord/tools";
|
|
2
|
-
import type { Context } from "hono";
|
|
3
2
|
import { createMiddleware } from "hono/factory";
|
|
4
3
|
import { HTTPException } from "hono/http-exception";
|
|
5
4
|
import type { CacheResolverPort } from "./cache-resolver.port";
|
|
5
|
+
import type { CacheSubjectResolver } from "./cache-subject-resolver.vo";
|
|
6
6
|
import type { ClockPort } from "./clock.port";
|
|
7
7
|
import type { ShieldPort } from "./shield.port";
|
|
8
8
|
|
|
9
|
-
type
|
|
10
|
-
type ShieldRateLimitOptionsType = { enabled: boolean; subject: SubjectResolver };
|
|
9
|
+
type ShieldRateLimitOptionsType = { enabled: boolean; resolver: CacheSubjectResolver };
|
|
11
10
|
|
|
12
11
|
type Dependencies = { Clock: ClockPort; CacheResolver: CacheResolverPort };
|
|
13
12
|
|
|
14
|
-
export const RateLimitSubjectAnon: SubjectResolver = (c) => `rate_limit_${c.req.url}_anon`;
|
|
15
|
-
export const RateLimitSubjectUser: SubjectResolver = (c) =>
|
|
16
|
-
c.get("user")?.id ? `rate_limit_${c.req.url}_${c.get("user")?.id}` : RateLimitSubjectAnon(c);
|
|
17
|
-
|
|
18
13
|
export const TooManyRequestsError = new HTTPException(429, { message: "app.too_many_requests" });
|
|
19
14
|
|
|
20
15
|
export class ShieldRateLimitAdapter implements ShieldPort {
|
|
@@ -26,10 +21,10 @@ export class ShieldRateLimitAdapter implements ShieldPort {
|
|
|
26
21
|
verify = createMiddleware(async (c, next) => {
|
|
27
22
|
if (!this.options.enabled) return next();
|
|
28
23
|
|
|
29
|
-
const subject = this.options.
|
|
24
|
+
const subject = await this.options.resolver.resolve(c);
|
|
30
25
|
|
|
31
26
|
const limiter = await this.deps.CacheResolver.resolve(
|
|
32
|
-
subject,
|
|
27
|
+
subject.hex,
|
|
33
28
|
async () => new tools.RateLimiter(this.deps.CacheResolver.ttl),
|
|
34
29
|
);
|
|
35
30
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Client } from "./client.vo";
|
|
2
|
+
import type { HashContentPort } from "./hash-content.port";
|
|
3
|
+
import type { VisitorIdPort } from "./visitor-id.port";
|
|
4
|
+
|
|
5
|
+
type Dependencies = { HashContent: HashContentPort };
|
|
6
|
+
|
|
7
|
+
export class VisitorIdClientAdapter implements VisitorIdPort {
|
|
8
|
+
constructor(
|
|
9
|
+
private readonly client: Client,
|
|
10
|
+
private readonly deps: Dependencies,
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
async get() {
|
|
14
|
+
const { ip, ua } = this.client.toJSON();
|
|
15
|
+
|
|
16
|
+
const value = `${ip}|${ua}`;
|
|
17
|
+
|
|
18
|
+
return this.deps.HashContent.hash(value);
|
|
19
|
+
}
|
|
20
|
+
}
|
package/src/visitor-id.port.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client-from-hono.adapter.d.ts","sourceRoot":"","sources":["../src/client-from-hono.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,qBAAa,qBAAqB;IAChC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;CAUzC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { getConnInfo } from "hono/bun";
|
|
2
|
-
import { Client } from "./client.vo";
|
|
3
|
-
export class ClientFromHonoAdapter {
|
|
4
|
-
static extract(context) {
|
|
5
|
-
const info = getConnInfo(context);
|
|
6
|
-
const ip = context.req.header("x-real-ip") || context.req.header("x-forwarded-for") || info?.remote?.address;
|
|
7
|
-
const ua = context.req.header("user-agent");
|
|
8
|
-
return Client.from(ip, ua);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=client-from-hono.adapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client-from-hono.adapter.js","sourceRoot":"","sources":["../src/client-from-hono.adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,OAAO,qBAAqB;IAChC,MAAM,CAAC,OAAO,CAAC,OAAgB;QAC7B,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;QAElC,MAAM,EAAE,GACN,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC;QAEpG,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAE5C,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-hash-noop.adapter.d.ts","sourceRoot":"","sources":["../src/content-hash-noop.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,qBAAa,sBAAuB,YAAW,eAAe;IACtD,IAAI,CAAC,QAAQ,EAAE,MAAM;;;CAG5B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-hash-noop.adapter.js","sourceRoot":"","sources":["../src/content-hash-noop.adapter.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,sBAAsB;IACjC,KAAK,CAAC,IAAI,CAAC,QAAgB;QACzB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-hash-sha256-bun.adapter.d.ts","sourceRoot":"","sources":["../src/content-hash-sha256-bun.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,qBAAa,2BAA4B,YAAW,eAAe;IAC3D,IAAI,CAAC,OAAO,EAAE,MAAM;;;CAM3B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-hash-sha256-bun.adapter.js","sourceRoot":"","sources":["../src/content-hash-sha256-bun.adapter.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,2BAA2B;IACtC,KAAK,CAAC,IAAI,CAAC,OAAe;QACxB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QACxF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAEjD,OAAO,EAAE,IAAI,EAAE,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-hash.port.d.ts","sourceRoot":"","sources":["../src/content-hash.port.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjD,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACnD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-hash.port.js","sourceRoot":"","sources":["../src/content-hash.port.ts"],"names":[],"mappings":""}
|
package/dist/file-etag.vo.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/v4";
|
|
2
|
-
export declare const FileEtagError: {
|
|
3
|
-
readonly Type: "file.etag.type";
|
|
4
|
-
readonly InvalidHex: "file.etag.invalid.hex";
|
|
5
|
-
};
|
|
6
|
-
export declare const FileEtag: z.core.$ZodBranded<z.ZodString, "FileEtag">;
|
|
7
|
-
export type FileEtagType = z.infer<typeof FileEtag>;
|
|
8
|
-
//# sourceMappingURL=file-etag.vo.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-etag.vo.d.ts","sourceRoot":"","sources":["../src/file-etag.vo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,eAAO,MAAM,aAAa;;;CAA2E,CAAC;AAKtG,eAAO,MAAM,QAAQ,6CAGD,CAAC;AAErB,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC"}
|
package/dist/file-etag.vo.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/v4";
|
|
2
|
-
export const FileEtagError = { Type: "file.etag.type", InvalidHex: "file.etag.invalid.hex" };
|
|
3
|
-
// 64 hex chars allowed
|
|
4
|
-
const CHARS_WHITELIST = /^[a-fA-F0-9]{64}$/;
|
|
5
|
-
export const FileEtag = z
|
|
6
|
-
.string(FileEtagError.Type)
|
|
7
|
-
.regex(CHARS_WHITELIST, FileEtagError.InvalidHex)
|
|
8
|
-
.brand("FileEtag");
|
|
9
|
-
//# sourceMappingURL=file-etag.vo.js.map
|
package/dist/file-etag.vo.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-etag.vo.js","sourceRoot":"","sources":["../src/file-etag.vo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,IAAI,EAAE,gBAAgB,EAAE,UAAU,EAAE,uBAAuB,EAAW,CAAC;AAEtG,uBAAuB;AACvB,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAE5C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC;KACtB,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC;KAC1B,KAAK,CAAC,eAAe,EAAE,aAAa,CAAC,UAAU,CAAC;KAChD,KAAK,CAAC,UAAU,CAAC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as tools from "@bgord/tools";
|
|
2
|
-
import type { FileHashPort } from "./file-hash.port";
|
|
3
|
-
export declare class FileHashNoopAdapter implements FileHashPort {
|
|
4
|
-
hash(_path: tools.FilePathAbsolute | tools.FilePathRelative): Promise<{
|
|
5
|
-
etag: string & import("zod").$brand<"FileEtag">;
|
|
6
|
-
size: tools.Size;
|
|
7
|
-
lastModified: tools.Timestamp;
|
|
8
|
-
mime: tools.Mime;
|
|
9
|
-
}>;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=file-hash-noop.adapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-hash-noop.adapter.d.ts","sourceRoot":"","sources":["../src/file-hash-noop.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,qBAAa,mBAAoB,YAAW,YAAY;IAChD,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB;;;;;;CAQlE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-hash-noop.adapter.js","sourceRoot":"","sources":["../src/file-hash-noop.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,MAAM,OAAO,mBAAmB;IAC9B,KAAK,CAAC,IAAI,CAAC,KAAsD;QAC/D,OAAO;YACL,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,kEAAkE,CAAC;YACxF,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9B,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC;YAC9C,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI;SACvB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as tools from "@bgord/tools";
|
|
2
|
-
import type { FileHashPort } from "./file-hash.port";
|
|
3
|
-
export declare class FileHashSha256BunAdapter implements FileHashPort {
|
|
4
|
-
hash(path: tools.FilePathAbsolute | tools.FilePathRelative): Promise<{
|
|
5
|
-
etag: string & import("zod").$brand<"FileEtag">;
|
|
6
|
-
size: tools.Size;
|
|
7
|
-
lastModified: tools.Timestamp;
|
|
8
|
-
mime: tools.Mime;
|
|
9
|
-
}>;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=file-hash-sha256-bun.adapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-hash-sha256-bun.adapter.d.ts","sourceRoot":"","sources":["../src/file-hash-sha256-bun.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,qBAAa,wBAAyB,YAAW,YAAY;IACrD,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB;;;;;;CAcjE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-hash-sha256-bun.adapter.js","sourceRoot":"","sources":["../src/file-hash-sha256-bun.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,MAAM,OAAO,wBAAwB;IACnC,KAAK,CAAC,IAAI,CAAC,IAAqD;QAC9D,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAClC,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,YAAY,EAAE,CAAC;QAEpD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC7C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAElE,OAAO;YACL,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACzD,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,UAAU,CAAC;YAClD,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC;YAC3D,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC;SAC1C,CAAC;IACJ,CAAC;CACF"}
|
package/dist/file-hash.port.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type * as tools from "@bgord/tools";
|
|
2
|
-
import type { FileEtagType } from "./file-etag.vo";
|
|
3
|
-
export type FileHashResult = {
|
|
4
|
-
etag: FileEtagType;
|
|
5
|
-
size: tools.Size;
|
|
6
|
-
lastModified: tools.Timestamp;
|
|
7
|
-
mime: tools.Mime;
|
|
8
|
-
};
|
|
9
|
-
export interface FileHashPort {
|
|
10
|
-
hash(path: tools.FilePathAbsolute | tools.FilePathRelative): Promise<FileHashResult>;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=file-hash.port.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-hash.port.d.ts","sourceRoot":"","sources":["../src/file-hash.port.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;IACjB,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;CAClB,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CACtF"}
|
package/dist/file-hash.port.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-hash.port.js","sourceRoot":"","sources":["../src/file-hash.port.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { MarkdownGeneratorPort } from "./markdown-generator.port";
|
|
2
|
-
export declare class MarkdownGeneratorNoopAdapter implements MarkdownGeneratorPort {
|
|
3
|
-
generate(_content: string): Promise<string>;
|
|
4
|
-
}
|
|
5
|
-
//# sourceMappingURL=markdown-generator-noop.adapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-generator-noop.adapter.d.ts","sourceRoot":"","sources":["../src/markdown-generator-noop.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,qBAAa,4BAA6B,YAAW,qBAAqB;IAClE,QAAQ,CAAC,QAAQ,EAAE,MAAM;CAGhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-generator-noop.adapter.js","sourceRoot":"","sources":["../src/markdown-generator-noop.adapter.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,4BAA4B;IACvC,KAAK,CAAC,QAAQ,CAAC,QAAgB;QAC7B,OAAO,aAAa,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-generator.port.d.ts","sourceRoot":"","sources":["../src/markdown-generator.port.ts"],"names":[],"mappings":"AAAA,8BAAsB,qBAAqB;IACzC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAClD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-generator.port.js","sourceRoot":"","sources":["../src/markdown-generator.port.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,qBAAqB;CAE1C"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type * as tools from "@bgord/tools";
|
|
2
|
-
import type { Secret } from "./secret.vo";
|
|
3
|
-
import type { SecretManagerPort } from "./secret-manager.port";
|
|
4
|
-
export declare class SecretManagerNoopAdapter implements SecretManagerPort {
|
|
5
|
-
private readonly secrets;
|
|
6
|
-
constructor(secrets?: Record<tools.ObjectKeyType, string>);
|
|
7
|
-
get<T>(secret: Secret<T>): Promise<T>;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=secret-manager-noop.adapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"secret-manager-noop.adapter.d.ts","sourceRoot":"","sources":["../src/secret-manager-noop.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,qBAAa,wBAAyB,YAAW,iBAAiB;IACpD,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,GAAE,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,MAAM,CAAM;IAExE,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAG5C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"secret-manager-noop.adapter.js","sourceRoot":"","sources":["../src/secret-manager-noop.adapter.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,wBAAwB;IACN;IAA7B,YAA6B,UAA+C,EAAE;QAAjD,YAAO,GAAP,OAAO,CAA0C;IAAG,CAAC;IAElF,KAAK,CAAC,GAAG,CAAI,MAAiB;QAC5B,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"secret-manager.port.d.ts","sourceRoot":"","sources":["../src/secret-manager.port.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACvC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"secret-manager.port.js","sourceRoot":"","sources":["../src/secret-manager.port.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Context } from "hono";
|
|
2
|
-
import type { VisitorIdPort } from "./visitor-id.port";
|
|
3
|
-
export declare class VisitorIdHashHonoAdapter implements VisitorIdPort {
|
|
4
|
-
private readonly delegate;
|
|
5
|
-
constructor(context: Context);
|
|
6
|
-
get(): Promise<string & import("zod").$brand<"VisitorId">>;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=visitor-id-hash-hono.adapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"visitor-id-hash-hono.adapter.d.ts","sourceRoot":"","sources":["../src/visitor-id-hash-hono.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIvD,qBAAa,wBAAyB,YAAW,aAAa;IAC5D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuB;gBAEpC,OAAO,EAAE,OAAO;IAItB,GAAG;CAGV"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ClientFromHonoAdapter } from "./client-from-hono.adapter";
|
|
2
|
-
import { VisitorId } from "./visitor-id.vo";
|
|
3
|
-
import { VisitorIdHashAdapter } from "./visitor-id-hash.adapter";
|
|
4
|
-
export class VisitorIdHashHonoAdapter {
|
|
5
|
-
delegate;
|
|
6
|
-
constructor(context) {
|
|
7
|
-
this.delegate = new VisitorIdHashAdapter(ClientFromHonoAdapter.extract(context));
|
|
8
|
-
}
|
|
9
|
-
async get() {
|
|
10
|
-
return VisitorId.parse(await this.delegate.get());
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=visitor-id-hash-hono.adapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"visitor-id-hash-hono.adapter.js","sourceRoot":"","sources":["../src/visitor-id-hash-hono.adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,OAAO,wBAAwB;IAClB,QAAQ,CAAuB;IAEhD,YAAY,OAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,oBAAoB,CAAC,qBAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACnF,CAAC;IAED,KAAK,CAAC,GAAG;QACP,OAAO,SAAS,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC;IACpD,CAAC;CACF"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Client } from "./client.vo";
|
|
2
|
-
import type { VisitorIdPort } from "./visitor-id.port";
|
|
3
|
-
export declare class VisitorIdHashAdapter implements VisitorIdPort {
|
|
4
|
-
private readonly client;
|
|
5
|
-
constructor(client: Client);
|
|
6
|
-
get(): Promise<string & import("zod").$brand<"VisitorId">>;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=visitor-id-hash.adapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"visitor-id-hash.adapter.d.ts","sourceRoot":"","sources":["../src/visitor-id-hash.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,qBAAa,oBAAqB,YAAW,aAAa;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAErC,GAAG;CAaV"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { VisitorId } from "./visitor-id.vo";
|
|
2
|
-
export class VisitorIdHashAdapter {
|
|
3
|
-
client;
|
|
4
|
-
constructor(client) {
|
|
5
|
-
this.client = client;
|
|
6
|
-
}
|
|
7
|
-
async get() {
|
|
8
|
-
const { ip, ua } = this.client.toJSON();
|
|
9
|
-
const value = `${ip}|${ua}`;
|
|
10
|
-
const buffer = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(value));
|
|
11
|
-
const result = Array.from(new Uint8Array(buffer))
|
|
12
|
-
.slice(0, 8)
|
|
13
|
-
.map((b) => b.toString(16).padStart(2, "0"))
|
|
14
|
-
.join("");
|
|
15
|
-
return VisitorId.parse(result);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=visitor-id-hash.adapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"visitor-id-hash.adapter.js","sourceRoot":"","sources":["../src/visitor-id-hash.adapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,OAAO,oBAAoB;IACF;IAA7B,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE/C,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAExC,MAAM,KAAK,GAAG,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAEtF,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;aAC9C,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;aACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;aAC3C,IAAI,CAAC,EAAE,CAAC,CAAC;QAEZ,OAAO,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;CACF"}
|