@ddd-ts-kit/kernel 0.8.0 → 0.9.0
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/README.md +69 -0
- package/dist/application/files/accepts-media-type.d.ts +3 -0
- package/dist/application/files/accepts-media-type.d.ts.map +1 -0
- package/dist/application/files/accepts-media-type.js +11 -0
- package/dist/application/files/accepts-media-type.js.map +1 -0
- package/dist/application/files/assert-expiry.d.ts +3 -0
- package/dist/application/files/assert-expiry.d.ts.map +1 -0
- package/dist/application/files/assert-expiry.js +10 -0
- package/dist/application/files/assert-expiry.js.map +1 -0
- package/dist/application/files/assert-file-key.d.ts +3 -0
- package/dist/application/files/assert-file-key.d.ts.map +1 -0
- package/dist/application/files/assert-file-key.js +10 -0
- package/dist/application/files/assert-file-key.js.map +1 -0
- package/dist/application/files/assert-final-key.d.ts +3 -0
- package/dist/application/files/assert-final-key.d.ts.map +1 -0
- package/dist/application/files/assert-final-key.js +11 -0
- package/dist/application/files/assert-final-key.js.map +1 -0
- package/dist/application/files/content-disposition.d.ts +3 -0
- package/dist/application/files/content-disposition.d.ts.map +1 -0
- package/dist/application/files/content-disposition.js +9 -0
- package/dist/application/files/content-disposition.js.map +1 -0
- package/dist/application/files/content-expectation.d.ts +6 -0
- package/dist/application/files/content-expectation.d.ts.map +1 -0
- package/dist/application/files/content-expectation.js +2 -0
- package/dist/application/files/content-expectation.js.map +1 -0
- package/dist/application/files/content-matches.d.ts +7 -0
- package/dist/application/files/content-matches.d.ts.map +1 -0
- package/dist/application/files/content-matches.js +39 -0
- package/dist/application/files/content-matches.js.map +1 -0
- package/dist/application/files/download-url-options.d.ts +7 -0
- package/dist/application/files/download-url-options.d.ts.map +1 -0
- package/dist/application/files/download-url-options.js +2 -0
- package/dist/application/files/download-url-options.js.map +1 -0
- package/dist/application/files/file-content.d.ts +8 -0
- package/dist/application/files/file-content.d.ts.map +1 -0
- package/dist/application/files/file-content.js +2 -0
- package/dist/application/files/file-content.js.map +1 -0
- package/dist/application/files/file-error.d.ts +28 -0
- package/dist/application/files/file-error.d.ts.map +1 -0
- package/dist/application/files/file-error.js +29 -0
- package/dist/application/files/file-error.js.map +1 -0
- package/dist/application/files/file-metadata.d.ts +10 -0
- package/dist/application/files/file-metadata.d.ts.map +1 -0
- package/dist/application/files/file-metadata.js +2 -0
- package/dist/application/files/file-metadata.js.map +1 -0
- package/dist/application/files/file-source.d.ts +4 -0
- package/dist/application/files/file-source.d.ts.map +1 -0
- package/dist/application/files/file-source.js +2 -0
- package/dist/application/files/file-source.js.map +1 -0
- package/dist/application/files/file-upload.d.ts +25 -0
- package/dist/application/files/file-upload.d.ts.map +1 -0
- package/dist/application/files/file-upload.js +36 -0
- package/dist/application/files/file-upload.js.map +1 -0
- package/dist/application/files/index.d.ts +31 -0
- package/dist/application/files/index.d.ts.map +1 -0
- package/dist/application/files/index.js +31 -0
- package/dist/application/files/index.js.map +1 -0
- package/dist/application/files/inspection-limits.d.ts +8 -0
- package/dist/application/files/inspection-limits.d.ts.map +1 -0
- package/dist/application/files/inspection-limits.js +2 -0
- package/dist/application/files/inspection-limits.js.map +1 -0
- package/dist/application/files/is-file-key.d.ts +7 -0
- package/dist/application/files/is-file-key.d.ts.map +1 -0
- package/dist/application/files/is-file-key.js +11 -0
- package/dist/application/files/is-file-key.js.map +1 -0
- package/dist/application/files/listed-file.d.ts +7 -0
- package/dist/application/files/listed-file.d.ts.map +1 -0
- package/dist/application/files/listed-file.js +2 -0
- package/dist/application/files/listed-file.js.map +1 -0
- package/dist/application/files/max-signed-url-seconds.d.ts +3 -0
- package/dist/application/files/max-signed-url-seconds.d.ts.map +1 -0
- package/dist/application/files/max-signed-url-seconds.js +3 -0
- package/dist/application/files/max-signed-url-seconds.js.map +1 -0
- package/dist/application/files/media-type-of.d.ts +3 -0
- package/dist/application/files/media-type-of.d.ts.map +1 -0
- package/dist/application/files/media-type-of.js +5 -0
- package/dist/application/files/media-type-of.js.map +1 -0
- package/dist/application/files/pending-upload-link.d.ts +10 -0
- package/dist/application/files/pending-upload-link.d.ts.map +1 -0
- package/dist/application/files/pending-upload-link.js +2 -0
- package/dist/application/files/pending-upload-link.js.map +1 -0
- package/dist/application/files/pending-upload.d.ts +15 -0
- package/dist/application/files/pending-upload.d.ts.map +1 -0
- package/dist/application/files/pending-upload.js +2 -0
- package/dist/application/files/pending-upload.js.map +1 -0
- package/dist/application/files/put-options.d.ts +7 -0
- package/dist/application/files/put-options.d.ts.map +1 -0
- package/dist/application/files/put-options.js +2 -0
- package/dist/application/files/put-options.js.map +1 -0
- package/dist/application/files/received-file.d.ts +15 -0
- package/dist/application/files/received-file.d.ts.map +1 -0
- package/dist/application/files/received-file.js +2 -0
- package/dist/application/files/received-file.js.map +1 -0
- package/dist/application/files/scan-verdict.d.ts +8 -0
- package/dist/application/files/scan-verdict.d.ts.map +1 -0
- package/dist/application/files/scan-verdict.js +2 -0
- package/dist/application/files/scan-verdict.js.map +1 -0
- package/dist/application/files/signature-of.d.ts +3 -0
- package/dist/application/files/signature-of.d.ts.map +1 -0
- package/dist/application/files/signature-of.js +28 -0
- package/dist/application/files/signature-of.js.map +1 -0
- package/dist/application/files/signed-download.d.ts +6 -0
- package/dist/application/files/signed-download.d.ts.map +1 -0
- package/dist/application/files/signed-download.js +2 -0
- package/dist/application/files/signed-download.js.map +1 -0
- package/dist/application/files/signed-upload.d.ts +9 -0
- package/dist/application/files/signed-upload.d.ts.map +1 -0
- package/dist/application/files/signed-upload.js +2 -0
- package/dist/application/files/signed-upload.js.map +1 -0
- package/dist/application/files/signed-url.d.ts +6 -0
- package/dist/application/files/signed-url.d.ts.map +1 -0
- package/dist/application/files/signed-url.js +2 -0
- package/dist/application/files/signed-url.js.map +1 -0
- package/dist/application/files/staged-key-of.d.ts +5 -0
- package/dist/application/files/staged-key-of.d.ts.map +1 -0
- package/dist/application/files/staged-key-of.js +7 -0
- package/dist/application/files/staged-key-of.js.map +1 -0
- package/dist/application/files/stored-file.d.ts +16 -0
- package/dist/application/files/stored-file.d.ts.map +1 -0
- package/dist/application/files/stored-file.js +2 -0
- package/dist/application/files/stored-file.js.map +1 -0
- package/dist/application/files/upload-url-options.d.ts +12 -0
- package/dist/application/files/upload-url-options.d.ts.map +1 -0
- package/dist/application/files/upload-url-options.js +2 -0
- package/dist/application/files/upload-url-options.js.map +1 -0
- package/dist/application/ports/file-keys.d.ts +9 -0
- package/dist/application/ports/file-keys.d.ts.map +1 -0
- package/dist/application/ports/file-keys.js +10 -0
- package/dist/application/ports/file-keys.js.map +1 -0
- package/dist/application/ports/file-scanner.d.ts +13 -0
- package/dist/application/ports/file-scanner.d.ts.map +1 -0
- package/dist/application/ports/file-scanner.js +12 -0
- package/dist/application/ports/file-scanner.js.map +1 -0
- package/dist/application/ports/file-storage.d.ts +40 -0
- package/dist/application/ports/file-storage.d.ts.map +1 -0
- package/dist/application/ports/file-storage.js +15 -0
- package/dist/application/ports/file-storage.js.map +1 -0
- package/dist/application/ports/served-file-storage.d.ts +16 -0
- package/dist/application/ports/served-file-storage.d.ts.map +1 -0
- package/dist/application/ports/served-file-storage.js +12 -0
- package/dist/application/ports/served-file-storage.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/domain-events/after-commit.d.ts +10 -0
- package/dist/infrastructure/domain-events/after-commit.d.ts.map +1 -0
- package/dist/infrastructure/domain-events/after-commit.js +19 -0
- package/dist/infrastructure/domain-events/after-commit.js.map +1 -0
- package/dist/infrastructure/domain-events/at-commit.d.ts +11 -0
- package/dist/infrastructure/domain-events/at-commit.d.ts.map +1 -0
- package/dist/infrastructure/domain-events/at-commit.js +19 -0
- package/dist/infrastructure/domain-events/at-commit.js.map +1 -0
- package/dist/infrastructure/domain-events/commit-step.d.ts +10 -0
- package/dist/infrastructure/domain-events/commit-step.d.ts.map +1 -0
- package/dist/infrastructure/domain-events/commit-step.js +2 -0
- package/dist/infrastructure/domain-events/commit-step.js.map +1 -0
- package/dist/infrastructure/domain-events/unit-of-work-scope.d.ts +5 -0
- package/dist/infrastructure/domain-events/unit-of-work-scope.d.ts.map +1 -1
- package/dist/infrastructure/domain-events/unit-of-work-scope.js.map +1 -1
- package/dist/infrastructure/domain-events/within-unit-of-work.d.ts +3 -1
- package/dist/infrastructure/domain-events/within-unit-of-work.d.ts.map +1 -1
- package/dist/infrastructure/domain-events/within-unit-of-work.js +32 -5
- package/dist/infrastructure/domain-events/within-unit-of-work.js.map +1 -1
- package/dist/infrastructure/files/accept-every-file-scanner.d.ts +7 -0
- package/dist/infrastructure/files/accept-every-file-scanner.d.ts.map +1 -0
- package/dist/infrastructure/files/accept-every-file-scanner.js +7 -0
- package/dist/infrastructure/files/accept-every-file-scanner.js.map +1 -0
- package/dist/infrastructure/files/collect.d.ts +4 -0
- package/dist/infrastructure/files/collect.d.ts.map +1 -0
- package/dist/infrastructure/files/collect.js +11 -0
- package/dist/infrastructure/files/collect.js.map +1 -0
- package/dist/infrastructure/files/file-grant.d.ts +11 -0
- package/dist/infrastructure/files/file-grant.d.ts.map +1 -0
- package/dist/infrastructure/files/file-grant.js +2 -0
- package/dist/infrastructure/files/file-grant.js.map +1 -0
- package/dist/infrastructure/files/file-inspection.d.ts +22 -0
- package/dist/infrastructure/files/file-inspection.d.ts.map +1 -0
- package/dist/infrastructure/files/file-inspection.js +66 -0
- package/dist/infrastructure/files/file-inspection.js.map +1 -0
- package/dist/infrastructure/files/file-staging.d.ts +59 -0
- package/dist/infrastructure/files/file-staging.d.ts.map +1 -0
- package/dist/infrastructure/files/file-staging.js +142 -0
- package/dist/infrastructure/files/file-staging.js.map +1 -0
- package/dist/infrastructure/files/file-uploads-middleware.d.ts +11 -0
- package/dist/infrastructure/files/file-uploads-middleware.d.ts.map +1 -0
- package/dist/infrastructure/files/file-uploads-middleware.js +25 -0
- package/dist/infrastructure/files/file-uploads-middleware.js.map +1 -0
- package/dist/infrastructure/files/in-memory-file-storage.d.ts +25 -0
- package/dist/infrastructure/files/in-memory-file-storage.d.ts.map +1 -0
- package/dist/infrastructure/files/in-memory-file-storage.js +73 -0
- package/dist/infrastructure/files/in-memory-file-storage.js.map +1 -0
- package/dist/infrastructure/files/is-file-grant.d.ts +3 -0
- package/dist/infrastructure/files/is-file-grant.d.ts.map +1 -0
- package/dist/infrastructure/files/is-file-grant.js +16 -0
- package/dist/infrastructure/files/is-file-grant.js.map +1 -0
- package/dist/infrastructure/files/is-stored-metadata.d.ts +3 -0
- package/dist/infrastructure/files/is-stored-metadata.d.ts.map +1 -0
- package/dist/infrastructure/files/is-stored-metadata.js +8 -0
- package/dist/infrastructure/files/is-stored-metadata.js.map +1 -0
- package/dist/infrastructure/files/local-file-storage-options.d.ts +6 -0
- package/dist/infrastructure/files/local-file-storage-options.d.ts.map +1 -0
- package/dist/infrastructure/files/local-file-storage-options.js +2 -0
- package/dist/infrastructure/files/local-file-storage-options.js.map +1 -0
- package/dist/infrastructure/files/local-file-storage.d.ts +29 -0
- package/dist/infrastructure/files/local-file-storage.d.ts.map +1 -0
- package/dist/infrastructure/files/local-file-storage.js +103 -0
- package/dist/infrastructure/files/local-file-storage.js.map +1 -0
- package/dist/infrastructure/files/local-paths.d.ts +12 -0
- package/dist/infrastructure/files/local-paths.d.ts.map +1 -0
- package/dist/infrastructure/files/local-paths.js +33 -0
- package/dist/infrastructure/files/local-paths.js.map +1 -0
- package/dist/infrastructure/files/purge-staged-files.d.ts +16 -0
- package/dist/infrastructure/files/purge-staged-files.d.ts.map +1 -0
- package/dist/infrastructure/files/purge-staged-files.js +21 -0
- package/dist/infrastructure/files/purge-staged-files.js.map +1 -0
- package/dist/infrastructure/files/self-signed-file-storage.d.ts +23 -0
- package/dist/infrastructure/files/self-signed-file-storage.d.ts.map +1 -0
- package/dist/infrastructure/files/self-signed-file-storage.js +57 -0
- package/dist/infrastructure/files/self-signed-file-storage.js.map +1 -0
- package/dist/infrastructure/files/signed-file-tokens.d.ts +20 -0
- package/dist/infrastructure/files/signed-file-tokens.d.ts.map +1 -0
- package/dist/infrastructure/files/signed-file-tokens.js +45 -0
- package/dist/infrastructure/files/signed-file-tokens.js.map +1 -0
- package/dist/infrastructure/files/signed-link-options.d.ts +10 -0
- package/dist/infrastructure/files/signed-link-options.d.ts.map +1 -0
- package/dist/infrastructure/files/signed-link-options.js +2 -0
- package/dist/infrastructure/files/signed-link-options.js.map +1 -0
- package/dist/infrastructure/files/stored-metadata.d.ts +6 -0
- package/dist/infrastructure/files/stored-metadata.d.ts.map +1 -0
- package/dist/infrastructure/files/stored-metadata.js +2 -0
- package/dist/infrastructure/files/stored-metadata.js.map +1 -0
- package/dist/infrastructure/files/tenant-file-keys.d.ts +20 -0
- package/dist/infrastructure/files/tenant-file-keys.d.ts.map +1 -0
- package/dist/infrastructure/files/tenant-file-keys.js +27 -0
- package/dist/infrastructure/files/tenant-file-keys.js.map +1 -0
- package/dist/infrastructure/files/upload-desk.d.ts +8 -0
- package/dist/infrastructure/files/upload-desk.d.ts.map +1 -0
- package/dist/infrastructure/files/upload-desk.js +2 -0
- package/dist/infrastructure/files/upload-desk.js.map +1 -0
- package/dist/infrastructure/files/without-trailing-slashes.d.ts +3 -0
- package/dist/infrastructure/files/without-trailing-slashes.d.ts.map +1 -0
- package/dist/infrastructure/files/without-trailing-slashes.js +9 -0
- package/dist/infrastructure/files/without-trailing-slashes.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a key is one the storages accept: segments separated by `/`, each made of letters,
|
|
3
|
+
* digits, dots, hyphens and underscores and none starting with a dot, so a key can never climb
|
|
4
|
+
* out of its directory or prefix (`..`), be absolute, or hide a file.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isFileKey(key: string): boolean;
|
|
7
|
+
//# sourceMappingURL=is-file-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-file-key.d.ts","sourceRoot":"","sources":["../../../src/application/files/is-file-key.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE9C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const SEGMENT = /^[A-Za-z0-9_-][A-Za-z0-9._-]*$/;
|
|
2
|
+
const MAX_KEY_LENGTH = 1_024;
|
|
3
|
+
/**
|
|
4
|
+
* Whether a key is one the storages accept: segments separated by `/`, each made of letters,
|
|
5
|
+
* digits, dots, hyphens and underscores and none starting with a dot, so a key can never climb
|
|
6
|
+
* out of its directory or prefix (`..`), be absolute, or hide a file.
|
|
7
|
+
*/
|
|
8
|
+
export function isFileKey(key) {
|
|
9
|
+
return key.length > 0 && key.length <= MAX_KEY_LENGTH && key.split('/').every((segment) => SEGMENT.test(segment));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=is-file-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-file-key.js","sourceRoot":"","sources":["../../../src/application/files/is-file-key.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,gCAAgC,CAAC;AACjD,MAAM,cAAc,GAAG,KAAK,CAAC;AAE7B;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,IAAI,cAAc,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AACpH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listed-file.d.ts","sourceRoot":"","sources":["../../../src/application/files/listed-file.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listed-file.js","sourceRoot":"","sources":["../../../src/application/files/listed-file.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"max-signed-url-seconds.d.ts","sourceRoot":"","sources":["../../../src/application/files/max-signed-url-seconds.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,eAAO,MAAM,sBAAsB,OAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"max-signed-url-seconds.js","sourceRoot":"","sources":["../../../src/application/files/max-signed-url-seconds.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-type-of.d.ts","sourceRoot":"","sources":["../../../src/application/files/media-type-of.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-type-of.js","sourceRoot":"","sources":["../../../src/application/files/media-type-of.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,MAAM,UAAU,WAAW,CAAC,WAAmB;IAC7C,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PendingUpload } from './pending-upload.js';
|
|
2
|
+
import type { SignedUpload } from './signed-upload.js';
|
|
3
|
+
/** What `FileStaging.uploadUrl` answers: the request for the client, and the grant for the server to keep. */
|
|
4
|
+
export interface PendingUploadLink {
|
|
5
|
+
/** Handed to the client. */
|
|
6
|
+
readonly link: SignedUpload;
|
|
7
|
+
/** Kept on the server, on the aggregate that awaits the file; never handed to the client to send back. */
|
|
8
|
+
readonly pending: PendingUpload;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=pending-upload-link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pending-upload-link.d.ts","sourceRoot":"","sources":["../../../src/application/files/pending-upload-link.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,8GAA8G;AAC9G,MAAM,WAAW,iBAAiB;IAChC,4BAA4B;IAC5B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,0GAA0G;IAC1G,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pending-upload-link.js","sourceRoot":"","sources":["../../../src/application/files/pending-upload-link.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ContentExpectation } from './content-expectation.js';
|
|
2
|
+
/**
|
|
3
|
+
* What the server granted when it signed a link to upload a file straight to the storage: the
|
|
4
|
+
* key, the size cap and the media types. Recorded on the server, on the aggregate that awaits
|
|
5
|
+
* the file, by the command that signed the link; the command that confirms the upload reads it
|
|
6
|
+
* back from there, never from what the client sends, so a client can neither choose the key it
|
|
7
|
+
* confirms nor raise the cap.
|
|
8
|
+
*/
|
|
9
|
+
export interface PendingUpload extends ContentExpectation {
|
|
10
|
+
/** The final key, generated by `FileKeys`; the file waits under its staged key. */
|
|
11
|
+
readonly key: string;
|
|
12
|
+
/** In bytes: what `FileStaging.confirm` accepts at most. */
|
|
13
|
+
readonly maxBytes: number;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=pending-upload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pending-upload.d.ts","sourceRoot":"","sources":["../../../src/application/files/pending-upload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE;;;;;;GAMG;AACH,MAAM,WAAW,aAAc,SAAQ,kBAAkB;IACvD,mFAAmF;IACnF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pending-upload.js","sourceRoot":"","sources":["../../../src/application/files/pending-upload.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface PutOptions {
|
|
2
|
+
/** The media type the content was verified to be. */
|
|
3
|
+
readonly mediaType: string;
|
|
4
|
+
/** Beyond it the write fails with `FILE_TOO_LARGE` and leaves nothing under the key. */
|
|
5
|
+
readonly maxBytes?: number;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=put-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"put-options.d.ts","sourceRoot":"","sources":["../../../src/application/files/put-options.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,qDAAqD;IACrD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,wFAAwF;IACxF,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"put-options.js","sourceRoot":"","sources":["../../../src/application/files/put-options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Readable } from 'node:stream';
|
|
2
|
+
/**
|
|
3
|
+
* A file received from a client, still streaming: what a controller hands to a command, and the
|
|
4
|
+
* handler to `FileStaging.stage`. Nothing of it is trusted but its bytes, which the edge checks
|
|
5
|
+
* against the declared media type as they stream.
|
|
6
|
+
*/
|
|
7
|
+
export interface ReceivedFile {
|
|
8
|
+
/** The name the client gave: shown back to a person, never a key or a path. */
|
|
9
|
+
readonly fileName: string;
|
|
10
|
+
/** The media type the client declared, which the first bytes must prove. */
|
|
11
|
+
readonly mediaType: string;
|
|
12
|
+
/** The content, to consume once. It fails on its way with `FILE_TOO_LARGE` or `UNSUPPORTED_MEDIA_TYPE`. */
|
|
13
|
+
readonly stream: Readable;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=received-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"received-file.d.ts","sourceRoot":"","sources":["../../../src/application/files/received-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,+EAA+E;IAC/E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,2GAA2G;IAC3G,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"received-file.js","sourceRoot":"","sources":["../../../src/application/files/received-file.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** What a `FileScanner` concludes: accepted, or refused with a stable reason (`INFECTED`, `ENCRYPTED_ARCHIVE`). */
|
|
2
|
+
export type ScanVerdict = {
|
|
3
|
+
readonly accepted: true;
|
|
4
|
+
} | {
|
|
5
|
+
readonly accepted: false;
|
|
6
|
+
readonly reason: string;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=scan-verdict.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan-verdict.d.ts","sourceRoot":"","sources":["../../../src/application/files/scan-verdict.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan-verdict.js","sourceRoot":"","sources":["../../../src/application/files/scan-verdict.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signature-of.d.ts","sourceRoot":"","sources":["../../../src/application/files/signature-of.ts"],"names":[],"mappings":"AAuBA,uGAAuG;AACvG,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAGhE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** The leading bytes of the binary formats the kit recognises, written as latin1 strings. */
|
|
2
|
+
const SIGNATURES = [
|
|
3
|
+
{ mediaType: 'application/pdf', parts: [[0, '%PDF-']] },
|
|
4
|
+
{ mediaType: 'image/png', parts: [[0, '\x89PNG\r\n\x1a\n']] },
|
|
5
|
+
{ mediaType: 'image/jpeg', parts: [[0, '\xff\xd8\xff']] },
|
|
6
|
+
{ mediaType: 'image/gif', parts: [[0, 'GIF8']] },
|
|
7
|
+
{
|
|
8
|
+
mediaType: 'image/webp',
|
|
9
|
+
parts: [
|
|
10
|
+
[0, 'RIFF'],
|
|
11
|
+
[8, 'WEBP'],
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
{ mediaType: 'application/zip', parts: [[0, 'PK\x03\x04']] },
|
|
15
|
+
{ mediaType: 'application/gzip', parts: [[0, '\x1f\x8b']] },
|
|
16
|
+
];
|
|
17
|
+
/** The binary format the first bytes of a content announce, or `undefined` when none is recognised. */
|
|
18
|
+
export function signatureOf(head) {
|
|
19
|
+
return SIGNATURES.find((signature) => signature.parts.every(([offset, bytes]) => startsWith(head, offset, bytes)))
|
|
20
|
+
?.mediaType;
|
|
21
|
+
}
|
|
22
|
+
function startsWith(head, offset, bytes) {
|
|
23
|
+
if (head.length < offset + bytes.length) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return Array.from({ length: bytes.length }, (_, index) => index).every((index) => head[offset + index] === bytes.charCodeAt(index));
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=signature-of.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signature-of.js","sourceRoot":"","sources":["../../../src/application/files/signature-of.ts"],"names":[],"mappings":"AAMA,6FAA6F;AAC7F,MAAM,UAAU,GAAyB;IACvC,EAAE,SAAS,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE;IACvD,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,EAAE;IAC7D,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE;IACzD,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE;IAChD;QACE,SAAS,EAAE,YAAY;QACvB,KAAK,EAAE;YACL,CAAC,CAAC,EAAE,MAAM,CAAC;YACX,CAAC,CAAC,EAAE,MAAM,CAAC;SACZ;KACF;IACD,EAAE,SAAS,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE;IAC5D,EAAE,SAAS,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE;CAC5D,CAAC;AAEF,uGAAuG;AACvG,MAAM,UAAU,WAAW,CAAC,IAAgB;IAC1C,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;QAChH,EAAE,SAAS,CAAC;AAChB,CAAC;AAED,SAAS,UAAU,CAAC,IAAgB,EAAE,MAAc,EAAE,KAAa;IACjE,IAAI,IAAI,CAAC,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,CACpE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAC5D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FileContent } from './file-content.js';
|
|
2
|
+
/** A download a signed link granted: the file, and the name to offer the browser when one was signed. */
|
|
3
|
+
export interface SignedDownload extends FileContent {
|
|
4
|
+
readonly fileName?: string;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=signed-download.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signed-download.d.ts","sourceRoot":"","sources":["../../../src/application/files/signed-download.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,yGAAyG;AACzG,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signed-download.js","sourceRoot":"","sources":["../../../src/application/files/signed-download.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** What a client needs to send a file straight to the storage: the request to make, and until when. */
|
|
2
|
+
export interface SignedUpload {
|
|
3
|
+
readonly url: string;
|
|
4
|
+
readonly method: 'PUT';
|
|
5
|
+
/** To send as they are: the signature covers them. */
|
|
6
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
7
|
+
readonly expiresAt: Date;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=signed-upload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signed-upload.d.ts","sourceRoot":"","sources":["../../../src/application/files/signed-upload.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;IACvB,sDAAsD;IACtD,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signed-upload.js","sourceRoot":"","sources":["../../../src/application/files/signed-upload.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signed-url.d.ts","sourceRoot":"","sources":["../../../src/application/files/signed-url.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signed-url.js","sourceRoot":"","sources":["../../../src/application/files/signed-url.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Where a file waits until the transaction that references it commits: nothing reads there, and no final key starts with it. */
|
|
2
|
+
export declare const STAGING_PREFIX = "staging/";
|
|
3
|
+
/** The staged key of a final key. */
|
|
4
|
+
export declare function stagedKeyOf(key: string): string;
|
|
5
|
+
//# sourceMappingURL=staged-key-of.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staged-key-of.d.ts","sourceRoot":"","sources":["../../../src/application/files/staged-key-of.ts"],"names":[],"mappings":"AAAA,iIAAiI;AACjI,eAAO,MAAM,cAAc,aAAa,CAAC;AAEzC,qCAAqC;AACrC,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Where a file waits until the transaction that references it commits: nothing reads there, and no final key starts with it. */
|
|
2
|
+
export const STAGING_PREFIX = 'staging/';
|
|
3
|
+
/** The staged key of a final key. */
|
|
4
|
+
export function stagedKeyOf(key) {
|
|
5
|
+
return `${STAGING_PREFIX}${key}`;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=staged-key-of.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staged-key-of.js","sourceRoot":"","sources":["../../../src/application/files/staged-key-of.ts"],"names":[],"mappings":"AAAA,iIAAiI;AACjI,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;AAEzC,qCAAqC;AACrC,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG,cAAc,GAAG,GAAG,EAAE,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The reference to a file that an aggregate keeps, and all it keeps: the content lives in a
|
|
3
|
+
* `FileStorage`, never in the database. It names no provider, no bucket and no URL, so the
|
|
4
|
+
* connector can change without touching a row.
|
|
5
|
+
*/
|
|
6
|
+
export interface StoredFile {
|
|
7
|
+
/** Generated by the server (`FileKeys`), never taken from the user. */
|
|
8
|
+
readonly key: string;
|
|
9
|
+
/** In bytes. */
|
|
10
|
+
readonly size: number;
|
|
11
|
+
/** Verified on the content, not only on the name the client gave. */
|
|
12
|
+
readonly mediaType: string;
|
|
13
|
+
/** `sha256:<hex>` of the content, computed while it streamed. */
|
|
14
|
+
readonly checksum: string;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=stored-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stored-file.d.ts","sourceRoot":"","sources":["../../../src/application/files/stored-file.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,uEAAuE;IACvE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,gBAAgB;IAChB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stored-file.js","sourceRoot":"","sources":["../../../src/application/files/stored-file.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface UploadUrlOptions {
|
|
2
|
+
/** Short: at most `MAX_SIGNED_URL_SECONDS`. */
|
|
3
|
+
readonly expiresInSeconds: number;
|
|
4
|
+
/** The media type the client must send, as the `content-type` the signature covers. */
|
|
5
|
+
readonly mediaType: string;
|
|
6
|
+
/**
|
|
7
|
+
* In bytes. The storages the application serves refuse a larger upload; a presigned link of
|
|
8
|
+
* an object store cannot cap it, so `FileStaging.confirm` checks it again in every case.
|
|
9
|
+
*/
|
|
10
|
+
readonly maxBytes: number;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=upload-url-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-url-options.d.ts","sourceRoot":"","sources":["../../../src/application/files/upload-url-options.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,+CAA+C;IAC/C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,uFAAuF;IACvF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-url-options.js","sourceRoot":"","sources":["../../../src/application/files/upload-url-options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Names the files: a key is always generated on the server, never built from what a user sent
|
|
3
|
+
* (a file name, a path), so a request can neither choose where it writes nor guess another key.
|
|
4
|
+
*/
|
|
5
|
+
export declare abstract class FileKeys {
|
|
6
|
+
/** A new key under `area`, a key prefix of the project such as `appointment-documents`. */
|
|
7
|
+
abstract next(area: string): string;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=file-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-keys.d.ts","sourceRoot":"","sources":["../../../src/application/ports/file-keys.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,8BAAsB,QAAQ;IAK5B,2FAA2F;IAC3F,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACrC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Names the files: a key is always generated on the server, never built from what a user sent
|
|
3
|
+
* (a file name, a path), so a request can neither choose where it writes nor guess another key.
|
|
4
|
+
*/
|
|
5
|
+
export class FileKeys {
|
|
6
|
+
static {
|
|
7
|
+
Object.defineProperty(this, 'tokenKey', { value: 'kernel.FileKeys' });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=file-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-keys.js","sourceRoot":"","sources":["../../../src/application/ports/file-keys.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAgB,QAAQ;IAC5B;QACE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC,CAAC;IACxE,CAAC;CAIF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Readable } from 'node:stream';
|
|
2
|
+
import type { ScanVerdict } from '../files/scan-verdict.js';
|
|
3
|
+
import type { StoredFile } from '../files/stored-file.js';
|
|
4
|
+
/**
|
|
5
|
+
* The check a file passes before it is accepted: an antivirus (ClamAV over its socket, a cloud
|
|
6
|
+
* scanning service), a parser that refuses a malformed document, a policy on archives. Called on
|
|
7
|
+
* the staged file, so a refused file is never visible. `open` reads the content again; a scanner
|
|
8
|
+
* that needs none of it does not call it.
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class FileScanner {
|
|
11
|
+
abstract scan(file: StoredFile, open: () => Promise<Readable>): Promise<ScanVerdict>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=file-scanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-scanner.d.ts","sourceRoot":"","sources":["../../../src/application/ports/file-scanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;;GAKG;AACH,8BAAsB,WAAW;IAK/B,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CACtF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The check a file passes before it is accepted: an antivirus (ClamAV over its socket, a cloud
|
|
3
|
+
* scanning service), a parser that refuses a malformed document, a policy on archives. Called on
|
|
4
|
+
* the staged file, so a refused file is never visible. `open` reads the content again; a scanner
|
|
5
|
+
* that needs none of it does not call it.
|
|
6
|
+
*/
|
|
7
|
+
export class FileScanner {
|
|
8
|
+
static {
|
|
9
|
+
Object.defineProperty(this, 'tokenKey', { value: 'kernel.FileScanner' });
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=file-scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-scanner.js","sourceRoot":"","sources":["../../../src/application/ports/file-scanner.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,OAAgB,WAAW;IAC/B;QACE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC,CAAC;IAC3E,CAAC;CAGF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { DownloadUrlOptions } from '../files/download-url-options.js';
|
|
2
|
+
import type { FileContent } from '../files/file-content.js';
|
|
3
|
+
import type { FileMetadata } from '../files/file-metadata.js';
|
|
4
|
+
import type { FileSource } from '../files/file-source.js';
|
|
5
|
+
import type { ListedFile } from '../files/listed-file.js';
|
|
6
|
+
import type { PutOptions } from '../files/put-options.js';
|
|
7
|
+
import type { SignedUpload } from '../files/signed-upload.js';
|
|
8
|
+
import type { SignedUrl } from '../files/signed-url.js';
|
|
9
|
+
import type { StoredFile } from '../files/stored-file.js';
|
|
10
|
+
import type { UploadUrlOptions } from '../files/upload-url-options.js';
|
|
11
|
+
/**
|
|
12
|
+
* Where the content of files lives: an object store, a directory, the memory of a test. Never
|
|
13
|
+
* the database, whose backups, replicas and memory are sized for rows. Content always streams in
|
|
14
|
+
* and out: no method takes or returns a whole file. A key that `isFileKey` refuses is refused
|
|
15
|
+
* with `INVALID_FILE_KEY` before anything is touched.
|
|
16
|
+
*
|
|
17
|
+
* A write is not part of a transaction: see `FileStaging` for the order that keeps the database
|
|
18
|
+
* and the storage consistent.
|
|
19
|
+
*/
|
|
20
|
+
export declare abstract class FileStorage {
|
|
21
|
+
/** Writes the content under the key, replacing what was there; rejects with `FILE_TOO_LARGE` beyond `maxBytes`, leaving nothing. */
|
|
22
|
+
abstract put(key: string, content: FileSource, options: PutOptions): Promise<StoredFile>;
|
|
23
|
+
/** The content as a stream, or `undefined` when nothing is stored under the key. */
|
|
24
|
+
abstract get(key: string): Promise<FileContent | undefined>;
|
|
25
|
+
/** What is known of the file without reading it, or `undefined`: how a caller asks whether it exists. */
|
|
26
|
+
abstract stat(key: string): Promise<FileMetadata | undefined>;
|
|
27
|
+
/** Removes the file; removing a file that is not there is not an error. */
|
|
28
|
+
abstract delete(key: string): Promise<void>;
|
|
29
|
+
/** Rejects with `FILE_NOT_FOUND` when nothing is stored under `from`. */
|
|
30
|
+
abstract copy(from: string, to: string): Promise<void>;
|
|
31
|
+
/** Rejects with `FILE_NOT_FOUND` when nothing is stored under `from`. */
|
|
32
|
+
abstract move(from: string, to: string): Promise<void>;
|
|
33
|
+
/** Every file whose key starts with the prefix, in no promised order. */
|
|
34
|
+
abstract list(prefix: string): AsyncIterable<ListedFile>;
|
|
35
|
+
/** A link that downloads the file until it expires. Signing does not check that the file exists. */
|
|
36
|
+
abstract signedDownloadUrl(key: string, options: DownloadUrlOptions): Promise<SignedUrl>;
|
|
37
|
+
/** A request that uploads one file under the key, straight to the storage, until it expires. */
|
|
38
|
+
abstract signedUploadUrl(key: string, options: UploadUrlOptions): Promise<SignedUpload>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=file-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-storage.d.ts","sourceRoot":"","sources":["../../../src/application/ports/file-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAEvE;;;;;;;;GAQG;AACH,8BAAsB,WAAW;IAK/B,oIAAoI;IACpI,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAEzF,oFAAoF;IACpF,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC;IAE5D,yGAAyG;IACzG,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAAC;IAE9D,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5C,yEAAyE;IACzE,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvD,yEAAyE;IACzE,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvD,yEAAyE;IACzE,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;IAEzD,oGAAoG;IACpG,QAAQ,CAAC,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAEzF,gGAAgG;IAChG,QAAQ,CAAC,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACzF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the content of files lives: an object store, a directory, the memory of a test. Never
|
|
3
|
+
* the database, whose backups, replicas and memory are sized for rows. Content always streams in
|
|
4
|
+
* and out: no method takes or returns a whole file. A key that `isFileKey` refuses is refused
|
|
5
|
+
* with `INVALID_FILE_KEY` before anything is touched.
|
|
6
|
+
*
|
|
7
|
+
* A write is not part of a transaction: see `FileStaging` for the order that keeps the database
|
|
8
|
+
* and the storage consistent.
|
|
9
|
+
*/
|
|
10
|
+
export class FileStorage {
|
|
11
|
+
static {
|
|
12
|
+
Object.defineProperty(this, 'tokenKey', { value: 'kernel.FileStorage' });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=file-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-storage.js","sourceRoot":"","sources":["../../../src/application/ports/file-storage.ts"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,MAAM,OAAgB,WAAW;IAC/B;QACE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC,CAAC;IAC3E,CAAC;CA4BF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FileSource } from '../files/file-source.js';
|
|
2
|
+
import type { SignedDownload } from '../files/signed-download.js';
|
|
3
|
+
import type { StoredFile } from '../files/stored-file.js';
|
|
4
|
+
import { FileStorage } from './file-storage.js';
|
|
5
|
+
/**
|
|
6
|
+
* A storage whose signed links point at the application itself, which must then answer them:
|
|
7
|
+
* the local directory of development and the memory of the tests. `signedFileRoutes` of
|
|
8
|
+
* `@ddd-ts-kit/http` mounts that answer. An object store answers its own links and is not one.
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class ServedFileStorage extends FileStorage {
|
|
11
|
+
/** The file a download link grants, or `undefined` for a link that is forged, expired or for another action. */
|
|
12
|
+
abstract openSigned(token: string): Promise<SignedDownload | undefined>;
|
|
13
|
+
/** Stores what an upload link grants, sent with the media type it was signed for; `undefined` when the link does not grant it. */
|
|
14
|
+
abstract acceptSigned(token: string, content: FileSource, mediaType: string): Promise<StoredFile | undefined>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=served-file-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"served-file-storage.d.ts","sourceRoot":"","sources":["../../../src/application/ports/served-file-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;GAIG;AACH,8BAAsB,iBAAkB,SAAQ,WAAW;IAKzD,gHAAgH;IAChH,QAAQ,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAExE,kIAAkI;IAClI,QAAQ,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;CAC/G"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FileStorage } from './file-storage.js';
|
|
2
|
+
/**
|
|
3
|
+
* A storage whose signed links point at the application itself, which must then answer them:
|
|
4
|
+
* the local directory of development and the memory of the tests. `signedFileRoutes` of
|
|
5
|
+
* `@ddd-ts-kit/http` mounts that answer. An object store answers its own links and is not one.
|
|
6
|
+
*/
|
|
7
|
+
export class ServedFileStorage extends FileStorage {
|
|
8
|
+
static {
|
|
9
|
+
Object.defineProperty(this, 'tokenKey', { value: 'kernel.ServedFileStorage' });
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=served-file-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"served-file-storage.js","sourceRoot":"","sources":["../../../src/application/ports/served-file-storage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;GAIG;AACH,MAAM,OAAgB,iBAAkB,SAAQ,WAAW;IACzD;QACE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,0BAA0B,EAAE,CAAC,CAAC;IACjF,CAAC;CAOF"}
|