@kensio/yulin 1.10.2 → 1.10.4
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/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-config.d.ts +8 -17
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-config.d.ts.map +1 -1
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-config.js +24 -102
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-config.js.map +1 -1
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-cors-config.d.ts +13 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-cors-config.d.ts.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-cors-config.js +76 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-cors-config.js.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-custom-headers.d.ts +17 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-custom-headers.d.ts.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-custom-headers.js +45 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-custom-headers.js.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-field-reader.d.ts +37 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-field-reader.d.ts.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-field-reader.js +75 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-field-reader.js.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-security-headers.d.ts +11 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-security-headers.d.ts.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-security-headers.js +30 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-security-headers.js.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-security-values.d.ts +19 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-security-values.d.ts.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-security-values.js +72 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-security-values.js.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-server-timing.d.ts +13 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-server-timing.d.ts.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-server-timing.js +24 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-server-timing.js.map +1 -0
- package/dist/service/cloudfront/command/create-distribution/create-distribution.handler.d.ts +2 -0
- package/dist/service/cloudfront/command/create-distribution/create-distribution.handler.d.ts.map +1 -1
- package/dist/service/cloudfront/command/create-distribution/create-distribution.handler.js.map +1 -1
- package/dist/service/cloudfront/command/update-distribution/update-distribution.handler.d.ts +2 -0
- package/dist/service/cloudfront/command/update-distribution/update-distribution.handler.d.ts.map +1 -1
- package/dist/service/cloudfront/command/update-distribution/update-distribution.handler.js.map +1 -1
- package/dist/service/cloudfront/controller/response-headers/sim-cf-response-headers-applicator.d.ts +1 -1
- package/dist/service/cloudfront/controller/response-headers/sim-cf-response-headers-applicator.d.ts.map +1 -1
- package/dist/service/cloudfront/controller/response-headers/sim-cf-response-headers-applicator.js +2 -2
- package/dist/service/cloudfront/controller/response-headers/sim-cf-response-headers-applicator.js.map +1 -1
- package/dist/service/cloudfront/controller/sim-cloudfront-controller.d.ts +1 -0
- package/dist/service/cloudfront/controller/sim-cloudfront-controller.d.ts.map +1 -1
- package/dist/service/cloudfront/controller/sim-cloudfront-controller.js +8 -1
- package/dist/service/cloudfront/controller/sim-cloudfront-controller.js.map +1 -1
- package/dist/service/cloudfront/controller/sim-cloudfront-error-response.d.ts +22 -0
- package/dist/service/cloudfront/controller/sim-cloudfront-error-response.d.ts.map +1 -0
- package/dist/service/cloudfront/controller/sim-cloudfront-error-response.js +31 -0
- package/dist/service/cloudfront/controller/sim-cloudfront-error-response.js.map +1 -0
- package/dist/service/cloudfront/controller/sim-cloudfront-request-pipeline.d.ts.map +1 -1
- package/dist/service/cloudfront/controller/sim-cloudfront-request-pipeline.js +1 -1
- package/dist/service/cloudfront/controller/sim-cloudfront-request-pipeline.js.map +1 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.d.ts +9 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.d.ts.map +1 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.js +34 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.js.map +1 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-response-headers-policy.d.ts +29 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-response-headers-policy.d.ts.map +1 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-response-headers-policy.js +51 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-response-headers-policy.js.map +1 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-distribution-configurator.factory.d.ts +2 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-distribution-configurator.factory.d.ts.map +1 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cf-distribution-configurator.factory.js +3 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cf-distribution-configurator.factory.js.map +1 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-behavior-configurator.d.ts +3 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-behavior-configurator.d.ts.map +1 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-behavior-configurator.js +7 -32
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-behavior-configurator.js.map +1 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.d.ts +14 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.d.ts.map +1 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.js +16 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.js.map +1 -1
- package/dist/service/cloudfront/distribution/sim-cf-distribution-reconfigurer.d.ts +7 -3
- package/dist/service/cloudfront/distribution/sim-cf-distribution-reconfigurer.d.ts.map +1 -1
- package/dist/service/cloudfront/distribution/sim-cf-distribution-reconfigurer.js +6 -3
- package/dist/service/cloudfront/distribution/sim-cf-distribution-reconfigurer.js.map +1 -1
- package/dist/service/cloudfront/error/sim-cloudfront.error.d.ts +11 -0
- package/dist/service/cloudfront/error/sim-cloudfront.error.d.ts.map +1 -1
- package/dist/service/cloudfront/error/sim-cloudfront.error.js +13 -0
- package/dist/service/cloudfront/error/sim-cloudfront.error.js.map +1 -1
- package/dist/service/cloudfront/origin/s3/sim-cf-s3-origin-responses.d.ts.map +1 -1
- package/dist/service/cloudfront/origin/s3/sim-cf-s3-origin-responses.js +7 -1
- package/dist/service/cloudfront/origin/s3/sim-cf-s3-origin-responses.js.map +1 -1
- package/dist/service/cloudfront/response-headers-policy/sim-cf-cors-origin-pattern.d.ts +27 -0
- package/dist/service/cloudfront/response-headers-policy/sim-cf-cors-origin-pattern.d.ts.map +1 -0
- package/dist/service/cloudfront/response-headers-policy/sim-cf-cors-origin-pattern.js +70 -0
- package/dist/service/cloudfront/response-headers-policy/sim-cf-cors-origin-pattern.js.map +1 -0
- package/dist/service/cloudfront/response-headers-policy/sim-cf-response-headers-policy-cors.d.ts +44 -0
- package/dist/service/cloudfront/response-headers-policy/sim-cf-response-headers-policy-cors.d.ts.map +1 -0
- package/dist/service/cloudfront/response-headers-policy/sim-cf-response-headers-policy-cors.js +111 -0
- package/dist/service/cloudfront/response-headers-policy/sim-cf-response-headers-policy-cors.js.map +1 -0
- package/dist/service/cloudfront/response-headers-policy/sim-cf-response-headers-policy.d.ts +10 -2
- package/dist/service/cloudfront/response-headers-policy/sim-cf-response-headers-policy.d.ts.map +1 -1
- package/dist/service/cloudfront/response-headers-policy/sim-cf-response-headers-policy.js +14 -2
- package/dist/service/cloudfront/response-headers-policy/sim-cf-response-headers-policy.js.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront-commands.d.ts +3 -0
- package/dist/service/cloudfront/sim-cloudfront-commands.d.ts.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront-commands.js +3 -0
- package/dist/service/cloudfront/sim-cloudfront-commands.js.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront.d.ts.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront.js +1 -0
- package/dist/service/cloudfront/sim-cloudfront.js.map +1 -1
- package/dist/service/rekognition/label/sim-rekognition-label-declaration.d.ts +1 -1
- package/dist/service/rekognition/moderation/sim-rekognition-moderation-taxonomy.d.ts +2 -2
- package/dist/service/rekognition/moderation/sim-rekognition-moderation-taxonomy.js +3 -3
- package/dist/service/rekognition/moderation/sim-rekognition-moderation-taxonomy.js.map +1 -1
- package/dist/service/rekognition/sim-rekognition.d.ts +4 -4
- package/dist/service/rekognition/sim-rekognition.js +4 -4
- package/dist/service/s3/bucket/sim-s3-bucket-access.d.ts +16 -0
- package/dist/service/s3/bucket/sim-s3-bucket-access.d.ts.map +1 -1
- package/dist/service/s3/bucket/sim-s3-bucket-access.js +22 -1
- package/dist/service/s3/bucket/sim-s3-bucket-access.js.map +1 -1
- package/dist/service/s3/command/get-object/get-object-loader.d.ts +2 -1
- package/dist/service/s3/command/get-object/get-object-loader.d.ts.map +1 -1
- package/dist/service/s3/command/get-object/get-object-loader.js +5 -1
- package/dist/service/s3/command/get-object/get-object-loader.js.map +1 -1
- package/dist/service/s3/command/get-object/get-object.command.d.ts +5 -0
- package/dist/service/s3/command/get-object/get-object.command.d.ts.map +1 -1
- package/dist/service/s3/command/list-objects/list-objects-page-builder.d.ts +3 -3
- package/dist/service/s3/command/list-objects/list-objects-page-builder.d.ts.map +1 -1
- package/dist/service/s3/command/list-objects/list-objects-page-builder.js +13 -17
- package/dist/service/s3/command/list-objects/list-objects-page-builder.js.map +1 -1
- package/dist/service/s3/command/list-objects/list-objects.command.d.ts +3 -8
- package/dist/service/s3/command/list-objects/list-objects.command.d.ts.map +1 -1
- package/dist/service/s3/command/list-objects/list-objects.handler.d.ts +3 -0
- package/dist/service/s3/command/list-objects/list-objects.handler.d.ts.map +1 -1
- package/dist/service/s3/command/list-objects/list-objects.handler.js +6 -2
- package/dist/service/s3/command/list-objects/list-objects.handler.js.map +1 -1
- package/dist/service/s3/command/list-objects-v2/list-objects-v2-continuation-token.d.ts +20 -0
- package/dist/service/s3/command/list-objects-v2/list-objects-v2-continuation-token.d.ts.map +1 -0
- package/dist/service/s3/command/list-objects-v2/list-objects-v2-continuation-token.js +29 -0
- package/dist/service/s3/command/list-objects-v2/list-objects-v2-continuation-token.js.map +1 -0
- package/dist/service/s3/command/list-objects-v2/list-objects-v2-page-builder.d.ts +31 -0
- package/dist/service/s3/command/list-objects-v2/list-objects-v2-page-builder.d.ts.map +1 -0
- package/dist/service/s3/command/list-objects-v2/list-objects-v2-page-builder.js +48 -0
- package/dist/service/s3/command/list-objects-v2/list-objects-v2-page-builder.js.map +1 -0
- package/dist/service/s3/command/list-objects-v2/list-objects-v2.command.d.ts +41 -0
- package/dist/service/s3/command/list-objects-v2/list-objects-v2.command.d.ts.map +1 -0
- package/dist/service/s3/command/list-objects-v2/list-objects-v2.command.js +2 -0
- package/dist/service/s3/command/list-objects-v2/list-objects-v2.command.js.map +1 -0
- package/dist/service/s3/command/list-objects-v2/list-objects-v2.handler.d.ts +41 -0
- package/dist/service/s3/command/list-objects-v2/list-objects-v2.handler.d.ts.map +1 -0
- package/dist/service/s3/command/list-objects-v2/list-objects-v2.handler.js +64 -0
- package/dist/service/s3/command/list-objects-v2/list-objects-v2.handler.js.map +1 -0
- package/dist/service/s3/command/object/sim-s3-object-commands.d.ts +8 -0
- package/dist/service/s3/command/object/sim-s3-object-commands.d.ts.map +1 -1
- package/dist/service/s3/command/object/sim-s3-object-commands.js +13 -0
- package/dist/service/s3/command/object/sim-s3-object-commands.js.map +1 -1
- package/dist/service/s3/command/put-object/put-object-builder.d.ts +10 -0
- package/dist/service/s3/command/put-object/put-object-builder.d.ts.map +1 -1
- package/dist/service/s3/command/put-object/put-object-builder.js +8 -0
- package/dist/service/s3/command/put-object/put-object-builder.js.map +1 -1
- package/dist/service/s3/command/put-object/put-object.command.d.ts +4 -0
- package/dist/service/s3/command/put-object/put-object.command.d.ts.map +1 -1
- package/dist/service/s3/command/put-object/put-object.handler.d.ts.map +1 -1
- package/dist/service/s3/command/put-object/put-object.handler.js +4 -1
- package/dist/service/s3/command/put-object/put-object.handler.js.map +1 -1
- package/dist/service/s3/command/sim-s3-bucket-command-state.d.ts +4 -1
- package/dist/service/s3/command/sim-s3-bucket-command-state.d.ts.map +1 -1
- package/dist/service/s3/command/sim-s3-command.types.d.ts +2 -1
- package/dist/service/s3/command/sim-s3-command.types.d.ts.map +1 -1
- package/dist/service/s3/notification/event/sim-s3-object-event-builder.d.ts.map +1 -1
- package/dist/service/s3/notification/event/sim-s3-object-event-builder.js +1 -2
- package/dist/service/s3/notification/event/sim-s3-object-event-builder.js.map +1 -1
- package/dist/service/s3/object/s3-object-etag.d.ts +20 -0
- package/dist/service/s3/object/s3-object-etag.d.ts.map +1 -0
- package/dist/service/s3/object/s3-object-etag.js +25 -0
- package/dist/service/s3/object/s3-object-etag.js.map +1 -0
- package/dist/service/s3/object/s3-object-listing-limits.d.ts +26 -0
- package/dist/service/s3/object/s3-object-listing-limits.d.ts.map +1 -0
- package/dist/service/s3/object/s3-object-listing-limits.js +46 -0
- package/dist/service/s3/object/s3-object-listing-limits.js.map +1 -0
- package/dist/service/s3/object/s3-object-listing.d.ts +51 -0
- package/dist/service/s3/object/s3-object-listing.d.ts.map +1 -0
- package/dist/service/s3/object/s3-object-listing.js +64 -0
- package/dist/service/s3/object/s3-object-listing.js.map +1 -0
- package/dist/service/s3/object/s3-object-response-headers.d.ts +23 -6
- package/dist/service/s3/object/s3-object-response-headers.d.ts.map +1 -1
- package/dist/service/s3/object/s3-object-response-headers.js +18 -8
- package/dist/service/s3/object/s3-object-response-headers.js.map +1 -1
- package/dist/service/s3/object/s3-object-summary.d.ts +33 -0
- package/dist/service/s3/object/s3-object-summary.d.ts.map +1 -0
- package/dist/service/s3/object/s3-object-summary.js +40 -0
- package/dist/service/s3/object/s3-object-summary.js.map +1 -0
- package/dist/service/s3/object/s3-object.d.ts +25 -0
- package/dist/service/s3/object/s3-object.d.ts.map +1 -1
- package/dist/service/s3/object/s3-object.js +31 -1
- package/dist/service/s3/object/s3-object.js.map +1 -1
- package/dist/service/s3/sdk/sim-s3-sdk-command-router.d.ts.map +1 -1
- package/dist/service/s3/sdk/sim-s3-sdk-command-router.js +4 -0
- package/dist/service/s3/sdk/sim-s3-sdk-command-router.js.map +1 -1
- package/dist/service/s3/serve/sim-s3-rest-object-reader.d.ts.map +1 -1
- package/dist/service/s3/serve/sim-s3-rest-object-reader.js +6 -1
- package/dist/service/s3/serve/sim-s3-rest-object-reader.js.map +1 -1
- package/dist/service/s3/serve/website/sim-s3-website-object-loader.d.ts.map +1 -1
- package/dist/service/s3/serve/website/sim-s3-website-object-loader.js +6 -1
- package/dist/service/s3/serve/website/sim-s3-website-object-loader.js.map +1 -1
- package/dist/service/s3/serve/website/sim-s3-website-object.d.ts +13 -4
- package/dist/service/s3/serve/website/sim-s3-website-object.d.ts.map +1 -1
- package/dist/service/s3/serve/website/sim-s3-website-object.js +15 -6
- package/dist/service/s3/serve/website/sim-s3-website-object.js.map +1 -1
- package/dist/service/s3/sim-s3-commands.d.ts +6 -0
- package/dist/service/s3/sim-s3-commands.d.ts.map +1 -1
- package/dist/service/s3/sim-s3-commands.js +2 -0
- package/dist/service/s3/sim-s3-commands.js.map +1 -1
- package/dist/service/s3/sim-s3.d.ts +24 -34
- package/dist/service/s3/sim-s3.d.ts.map +1 -1
- package/dist/service/s3/sim-s3.js +32 -40
- package/dist/service/s3/sim-s3.js.map +1 -1
- package/dist/service/s3/storage/filesystem/filesystem-path-exists.d.ts +8 -0
- package/dist/service/s3/storage/filesystem/filesystem-path-exists.d.ts.map +1 -1
- package/dist/service/s3/storage/filesystem/filesystem-path-exists.js +11 -1
- package/dist/service/s3/storage/filesystem/filesystem-path-exists.js.map +1 -1
- package/dist/service/s3/storage/filesystem/s3-filesystem-object-file.d.ts +19 -0
- package/dist/service/s3/storage/filesystem/s3-filesystem-object-file.d.ts.map +1 -0
- package/dist/service/s3/storage/filesystem/s3-filesystem-object-file.js +55 -0
- package/dist/service/s3/storage/filesystem/s3-filesystem-object-file.js.map +1 -0
- package/dist/service/s3/storage/filesystem/s3-filesystem-object-keys.d.ts +14 -4
- package/dist/service/s3/storage/filesystem/s3-filesystem-object-keys.d.ts.map +1 -1
- package/dist/service/s3/storage/filesystem/s3-filesystem-object-keys.js +27 -5
- package/dist/service/s3/storage/filesystem/s3-filesystem-object-keys.js.map +1 -1
- package/dist/service/s3/storage/filesystem/s3-filesystem-storage.d.ts +1 -2
- package/dist/service/s3/storage/filesystem/s3-filesystem-storage.d.ts.map +1 -1
- package/dist/service/s3/storage/filesystem/s3-filesystem-storage.js +10 -36
- package/dist/service/s3/storage/filesystem/s3-filesystem-storage.js.map +1 -1
- package/dist/service/sns/signature/sim-sns-certificate.d.ts +9 -3
- package/dist/service/sns/signature/sim-sns-certificate.d.ts.map +1 -1
- package/dist/service/sns/signature/sim-sns-certificate.js +13 -8
- package/dist/service/sns/signature/sim-sns-certificate.js.map +1 -1
- package/dist/service/sns/signature/sim-sns-der.d.ts +16 -0
- package/dist/service/sns/signature/sim-sns-der.d.ts.map +1 -1
- package/dist/service/sns/signature/sim-sns-der.js +23 -0
- package/dist/service/sns/signature/sim-sns-der.js.map +1 -1
- package/package.json +1 -1
- package/dist/service/s3/notification/event/sim-s3-object-etag.d.ts +0 -8
- package/dist/service/s3/notification/event/sim-s3-object-etag.d.ts.map +0 -1
- package/dist/service/s3/notification/event/sim-s3-object-etag.js +0 -11
- package/dist/service/s3/notification/event/sim-s3-object-etag.js.map +0 -1
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { stat } from "node:fs/promises";
|
|
2
|
+
/**
|
|
3
|
+
* Whether a filesystem error is the one meaning nothing is at that path.
|
|
4
|
+
*
|
|
5
|
+
* Reading a file that is not there is not a failure to anything mapping a
|
|
6
|
+
* directory onto a Bucket: it is an Object the Bucket does not hold. Every
|
|
7
|
+
* other error still is one, so only this code is answered rather than raised.
|
|
8
|
+
*/
|
|
9
|
+
export function isMissingFilesystemPathError(error) {
|
|
10
|
+
return error instanceof Error && "code" in error && error.code === "ENOENT";
|
|
11
|
+
}
|
|
2
12
|
/**
|
|
3
13
|
* Check whether a filesystem path exists.
|
|
4
14
|
*/
|
|
@@ -9,7 +19,7 @@ export async function filesystemPathExists(path) {
|
|
|
9
19
|
return true;
|
|
10
20
|
}
|
|
11
21
|
catch (error) {
|
|
12
|
-
if (error
|
|
22
|
+
if (isMissingFilesystemPathError(error)) {
|
|
13
23
|
return false;
|
|
14
24
|
}
|
|
15
25
|
/* v8 ignore next */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem-path-exists.js","sourceRoot":"","sources":["../../../../../src/service/s3/storage/filesystem/filesystem-path-exists.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAAY;IACrD,IAAI,CAAC;QACH,mEAAmE;QACnE,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,
|
|
1
|
+
{"version":3,"file":"filesystem-path-exists.js","sourceRoot":"","sources":["../../../../../src/service/s3/storage/filesystem/filesystem-path-exists.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAAc;IACzD,OAAO,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC9E,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAAY;IACrD,IAAI,CAAC;QACH,mEAAmE;QACnE,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,4BAA4B,CAAC,KAAK,CAAC,EAAE,CAAC;YACxC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,oBAAoB;QACpB,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SimS3ObjectMetadata } from "../../object/s3-object.js";
|
|
2
|
+
import { SimS3Object } from "../../object/s3-object.js";
|
|
3
|
+
interface FilesystemS3ObjectFile {
|
|
4
|
+
readonly key: string;
|
|
5
|
+
readonly filePath: string;
|
|
6
|
+
readonly metadata: SimS3ObjectMetadata;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Read a file as the Object a Bucket holds at a key, or nothing when the file
|
|
10
|
+
* is not there.
|
|
11
|
+
*
|
|
12
|
+
* The file's own modification time becomes the Object's, since it is the one
|
|
13
|
+
* thing about a mounted file that is not a guess: a directory is written to
|
|
14
|
+
* behind S3's back, so when S3 was told about the Object says nothing useful.
|
|
15
|
+
* Everything else a file cannot say for itself arrives here already decided.
|
|
16
|
+
*/
|
|
17
|
+
export declare function filesystemS3ObjectFile(file: FilesystemS3ObjectFile): Promise<SimS3Object | undefined>;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=s3-filesystem-object-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s3-filesystem-object-file.d.ts","sourceRoot":"","sources":["../../../../../src/service/s3/storage/filesystem/s3-filesystem-object-file.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;CACxC;AAED;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CA0BlC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { open } from "node:fs/promises";
|
|
2
|
+
import { SimS3Object } from "../../object/s3-object.js";
|
|
3
|
+
import { isMissingFilesystemPathError } from "./filesystem-path-exists.js";
|
|
4
|
+
/**
|
|
5
|
+
* Read a file as the Object a Bucket holds at a key, or nothing when the file
|
|
6
|
+
* is not there.
|
|
7
|
+
*
|
|
8
|
+
* The file's own modification time becomes the Object's, since it is the one
|
|
9
|
+
* thing about a mounted file that is not a guess: a directory is written to
|
|
10
|
+
* behind S3's back, so when S3 was told about the Object says nothing useful.
|
|
11
|
+
* Everything else a file cannot say for itself arrives here already decided.
|
|
12
|
+
*/
|
|
13
|
+
export async function filesystemS3ObjectFile(file) {
|
|
14
|
+
// One open handle for both, because the bytes and the time they were written
|
|
15
|
+
// have to describe the same file. A mounted directory is rebuilt while it is
|
|
16
|
+
// being served, so reading the path twice can pair one file's content with
|
|
17
|
+
// its replacement's timestamp.
|
|
18
|
+
const handle = await openFileToRead(file.filePath);
|
|
19
|
+
if (handle === undefined) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
const [body, fileStats] = await Promise.all([
|
|
24
|
+
handle.readFile(),
|
|
25
|
+
handle.stat(),
|
|
26
|
+
]);
|
|
27
|
+
return new SimS3Object({
|
|
28
|
+
key: file.key,
|
|
29
|
+
body,
|
|
30
|
+
metadata: file.metadata,
|
|
31
|
+
lastModified: fileStats.mtime,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
await handle.close();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Open a file, or answer with nothing when there is no such file, since a key
|
|
40
|
+
* a Bucket does not hold is not a failure to read.
|
|
41
|
+
*/
|
|
42
|
+
async function openFileToRead(filePath) {
|
|
43
|
+
try {
|
|
44
|
+
// oxlint-disable-next-line security/detect-non-literal-fs-filename
|
|
45
|
+
return await open(filePath);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
if (isMissingFilesystemPathError(error)) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
/* v8 ignore next */
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=s3-filesystem-object-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s3-filesystem-object-file.js","sourceRoot":"","sources":["../../../../../src/service/s3/storage/filesystem/s3-filesystem-object-file.ts"],"names":[],"mappings":"AACA,OAAO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Properties {
|
|
|
4
4
|
readonly safety: FilesystemS3StorageSafety;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Maps between the Object keys of a Bucket and the files of a directory.
|
|
8
8
|
*
|
|
9
9
|
* A directory tree is a listing here, so the walk lives on its own rather than
|
|
10
10
|
* in the storage class: files become keys relative to the directory root, with
|
|
11
|
-
* platform separators normalised to the `/` an S3 key uses
|
|
11
|
+
* platform separators normalised to the `/` an S3 key uses, and a key becomes
|
|
12
|
+
* the file path under the root it names.
|
|
12
13
|
*/
|
|
13
14
|
export declare class FilesystemS3ObjectKeys {
|
|
14
15
|
private readonly directoryPath;
|
|
15
16
|
private readonly safety;
|
|
16
17
|
constructor(properties: FilesystemS3ObjectKeysProperties);
|
|
17
18
|
/**
|
|
18
|
-
* List
|
|
19
|
+
* List the Object keys under the storage directory, under a prefix when one
|
|
20
|
+
* is given.
|
|
19
21
|
*
|
|
20
22
|
* A directory that is not there holds nothing, which is what an empty Bucket
|
|
21
23
|
* looks like.
|
|
22
24
|
*/
|
|
23
|
-
list(): Promise<string[]>;
|
|
25
|
+
list(prefix?: string): Promise<string[]>;
|
|
26
|
+
/**
|
|
27
|
+
* The file an Object key names, once the key is known to be safe to follow.
|
|
28
|
+
*
|
|
29
|
+
* The guard after resolving is defensive rather than the check that matters:
|
|
30
|
+
* key validation has already rejected anything that could climb out, and this
|
|
31
|
+
* is the assertion that it did.
|
|
32
|
+
*/
|
|
33
|
+
filePathFor(key: string): string;
|
|
24
34
|
private listInDirectory;
|
|
25
35
|
}
|
|
26
36
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-filesystem-object-keys.d.ts","sourceRoot":"","sources":["../../../../../src/service/s3/storage/filesystem/s3-filesystem-object-keys.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAG3E,UAAU,gCAAgC;IACxC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC;CAC5C;AAED
|
|
1
|
+
{"version":3,"file":"s3-filesystem-object-keys.d.ts","sourceRoot":"","sources":["../../../../../src/service/s3/storage/filesystem/s3-filesystem-object-keys.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAG3E,UAAU,gCAAgC;IACxC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC;CAC5C;AAED;;;;;;;GAOG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4B;IAEnD,YAAY,UAAU,EAAE,gCAAgC,EAGvD;IAED;;;;;;OAMG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAU7C;IAED;;;;;;OAMG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAgB/B;YAEa,eAAe;CA8B9B"}
|
|
@@ -2,11 +2,12 @@ import { readdir } from "node:fs/promises";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { filesystemPathExists } from "./filesystem-path-exists.js";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Maps between the Object keys of a Bucket and the files of a directory.
|
|
6
6
|
*
|
|
7
7
|
* A directory tree is a listing here, so the walk lives on its own rather than
|
|
8
8
|
* in the storage class: files become keys relative to the directory root, with
|
|
9
|
-
* platform separators normalised to the `/` an S3 key uses
|
|
9
|
+
* platform separators normalised to the `/` an S3 key uses, and a key becomes
|
|
10
|
+
* the file path under the root it names.
|
|
10
11
|
*/
|
|
11
12
|
export class FilesystemS3ObjectKeys {
|
|
12
13
|
directoryPath;
|
|
@@ -16,16 +17,37 @@ export class FilesystemS3ObjectKeys {
|
|
|
16
17
|
this.safety = properties.safety;
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
|
-
* List
|
|
20
|
+
* List the Object keys under the storage directory, under a prefix when one
|
|
21
|
+
* is given.
|
|
20
22
|
*
|
|
21
23
|
* A directory that is not there holds nothing, which is what an empty Bucket
|
|
22
24
|
* looks like.
|
|
23
25
|
*/
|
|
24
|
-
async list() {
|
|
26
|
+
async list(prefix) {
|
|
25
27
|
if (!(await filesystemPathExists(this.directoryPath))) {
|
|
26
28
|
return [];
|
|
27
29
|
}
|
|
28
|
-
|
|
30
|
+
const keys = await this.listInDirectory(this.directoryPath);
|
|
31
|
+
return prefix === undefined
|
|
32
|
+
? keys
|
|
33
|
+
: keys.filter((key) => key.startsWith(prefix));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The file an Object key names, once the key is known to be safe to follow.
|
|
37
|
+
*
|
|
38
|
+
* The guard after resolving is defensive rather than the check that matters:
|
|
39
|
+
* key validation has already rejected anything that could climb out, and this
|
|
40
|
+
* is the assertion that it did.
|
|
41
|
+
*/
|
|
42
|
+
filePathFor(key) {
|
|
43
|
+
this.safety.assertSafeObjectKey(key);
|
|
44
|
+
const filePath = path.resolve(this.directoryPath, key);
|
|
45
|
+
/* v8 ignore if -- defensive guard after object key validation */
|
|
46
|
+
if (filePath !== this.directoryPath &&
|
|
47
|
+
!filePath.startsWith(`${this.directoryPath}${path.sep}`)) {
|
|
48
|
+
throw new Error(`Invalid S3 Object key outside storage directory: ${key}`);
|
|
49
|
+
}
|
|
50
|
+
return filePath;
|
|
29
51
|
}
|
|
30
52
|
async listInDirectory(directoryPath) {
|
|
31
53
|
// oxlint-disable-next-line security/detect-non-literal-fs-filename
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-filesystem-object-keys.js","sourceRoot":"","sources":["../../../../../src/service/s3/storage/filesystem/s3-filesystem-object-keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAOnE
|
|
1
|
+
{"version":3,"file":"s3-filesystem-object-keys.js","sourceRoot":"","sources":["../../../../../src/service/s3/storage/filesystem/s3-filesystem-object-keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAOnE;;;;;;;GAOG;AACH,MAAM,OAAO,sBAAsB;IAChB,aAAa,CAAS;IACtB,MAAM,CAA4B;IAEnD,YAAY,UAA4C;QACtD,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;QAC9C,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAClC,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,IAAI,CAAC,MAAe;QACxB,IAAI,CAAC,CAAC,MAAM,oBAAoB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC;YACtD,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAE5D,OAAO,MAAM,KAAK,SAAS;YACzB,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC;IAED;;;;;;OAMG;IACH,WAAW,CAAC,GAAW;QACrB,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;QAErC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,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AC,iBAAiB,CAAC,CAAC;QAExD,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;IACzC,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SimS3BucketStorage } from "../s3-bucket-storage.js";
|
|
2
|
-
import { SimS3Object } from "../../object/s3-object.js";
|
|
2
|
+
import type { SimS3Object } from "../../object/s3-object.js";
|
|
3
3
|
import { SimS3DeclaredSystemMetadata } from "../../object/s3-declared-system-metadata.js";
|
|
4
4
|
interface FilesystemS3BucketStorageProperties {
|
|
5
5
|
readonly directoryPath: string;
|
|
@@ -48,7 +48,6 @@ export declare class FilesystemS3BucketStorage implements SimS3BucketStorage {
|
|
|
48
48
|
* filesystem-backed Buckets are read and written but never emptied.
|
|
49
49
|
*/
|
|
50
50
|
deleteObject(key: string): Promise<boolean>;
|
|
51
|
-
private filePathForObjectKey;
|
|
52
51
|
}
|
|
53
52
|
export {};
|
|
54
53
|
//# sourceMappingURL=s3-filesystem-storage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-filesystem-storage.d.ts","sourceRoot":"","sources":["../../../../../src/service/s3/storage/filesystem/s3-filesystem-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"s3-filesystem-storage.d.ts","sourceRoot":"","sources":["../../../../../src/service/s3/storage/filesystem/s3-filesystem-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAQ7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,6CAA6C,CAAC;AAG1F,UAAU,mCAAmC;IAC3C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,qBAAqB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnD,QAAQ,CAAC,wBAAwB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAEtD;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,2BAA2B,CAAC;CACvD;AAED;;;;;;;GAOG;AACH,qBAAa,yBAA0B,YAAW,kBAAkB;IAClE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4B;IACnD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAyB;IACpD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA8B;IAE7D,YAAY,UAAU,EAAE,mCAAmC,EAa1D;IAED;;OAEG;IACG,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAc7D;IAED;;OAEG;IACG,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAWzD;IAED;;OAEG;IACG,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAOlD;IAED;;;;;;;;OAQG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQ1C;CACF"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { SimS3Object } from "../../object/s3-object.js";
|
|
2
1
|
import path from "node:path";
|
|
3
|
-
import { mkdir,
|
|
2
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
4
3
|
import { FilesystemS3StorageSafety } from "./s3-filesystem-safety.js";
|
|
5
4
|
import { metadataForFilesystemS3ObjectKey } from "./s3-filesystem-object-metadata.js";
|
|
6
5
|
import { FilesystemS3ObjectKeys } from "./s3-filesystem-object-keys.js";
|
|
7
6
|
import { assertDefined } from "../../../../util/type-guard/defined.js";
|
|
8
7
|
import { SimS3NotImplemented } from "../../error/sim-s3.error.js";
|
|
9
8
|
import { SimS3DeclaredSystemMetadata } from "../../object/s3-declared-system-metadata.js";
|
|
9
|
+
import { filesystemS3ObjectFile } from "./s3-filesystem-object-file.js";
|
|
10
10
|
/**
|
|
11
11
|
* Maps simulated S3 Objects to files under a directory.
|
|
12
12
|
* This is useful for local development, such as serving a static website
|
|
@@ -42,34 +42,18 @@ export class FilesystemS3BucketStorage {
|
|
|
42
42
|
this.safety.assertSafeObjectKeyPath(key);
|
|
43
43
|
return undefined;
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
key,
|
|
51
|
-
body,
|
|
52
|
-
metadata: metadataForFilesystemS3ObjectKey(key, this.systemMetadata.headersForObjectKey(key)),
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
if (error instanceof Error &&
|
|
57
|
-
"code" in error &&
|
|
58
|
-
error.code === "ENOENT") {
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
/* v8 ignore next */
|
|
62
|
-
throw error;
|
|
63
|
-
}
|
|
45
|
+
return await filesystemS3ObjectFile({
|
|
46
|
+
key,
|
|
47
|
+
filePath: this.objectKeys.filePathFor(key),
|
|
48
|
+
metadata: metadataForFilesystemS3ObjectKey(key, this.systemMetadata.headersForObjectKey(key)),
|
|
49
|
+
});
|
|
64
50
|
}
|
|
65
51
|
/**
|
|
66
52
|
* List simulated Objects based on files in the directory.
|
|
67
53
|
*/
|
|
68
54
|
async listObjects(prefix) {
|
|
69
|
-
const objectKeys = await this.objectKeys.list();
|
|
70
|
-
return await Promise.all(objectKeys
|
|
71
|
-
.filter((key) => prefix === undefined || key.startsWith(prefix))
|
|
72
|
-
.map(async (key) => {
|
|
55
|
+
const objectKeys = await this.objectKeys.list(prefix);
|
|
56
|
+
return await Promise.all(objectKeys.map(async (key) => {
|
|
73
57
|
const object = await this.getObject(key);
|
|
74
58
|
assertDefined(object, "Sim S3 filesystem storage listed object");
|
|
75
59
|
return object;
|
|
@@ -79,7 +63,7 @@ export class FilesystemS3BucketStorage {
|
|
|
79
63
|
* Store a simulated Object as a file in the directory.
|
|
80
64
|
*/
|
|
81
65
|
async putObject(object) {
|
|
82
|
-
const filePath = this.
|
|
66
|
+
const filePath = this.objectKeys.filePathFor(object.key);
|
|
83
67
|
// oxlint-disable-next-line security/detect-non-literal-fs-filename
|
|
84
68
|
await mkdir(path.dirname(filePath), { recursive: true });
|
|
85
69
|
// oxlint-disable-next-line security/detect-non-literal-fs-filename
|
|
@@ -99,15 +83,5 @@ export class FilesystemS3BucketStorage {
|
|
|
99
83
|
`at ${this.directoryPath}, because it would remove a real file. ` +
|
|
100
84
|
`Use the default in-memory Bucket storage to simulate deletion.`));
|
|
101
85
|
}
|
|
102
|
-
filePathForObjectKey(key) {
|
|
103
|
-
this.safety.assertSafeObjectKey(key);
|
|
104
|
-
const filePath = path.resolve(this.directoryPath, key);
|
|
105
|
-
/* v8 ignore if -- defensive guard after object key validation */
|
|
106
|
-
if (filePath !== this.directoryPath &&
|
|
107
|
-
!filePath.startsWith(`${this.directoryPath}${path.sep}`)) {
|
|
108
|
-
throw new Error(`Invalid S3 Object key outside storage directory: ${key}`);
|
|
109
|
-
}
|
|
110
|
-
return filePath;
|
|
111
|
-
}
|
|
112
86
|
}
|
|
113
87
|
//# sourceMappingURL=s3-filesystem-storage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-filesystem-storage.js","sourceRoot":"","sources":["../../../../../src/service/s3/storage/filesystem/s3-filesystem-storage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"s3-filesystem-storage.js","sourceRoot":"","sources":["../../../../../src/service/s3/storage/filesystem/s3-filesystem-storage.ts"],"names":[],"mappings":"AAEA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EA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,MAAM,IAAI,CAAC,aAAa,yCAAyC;YACjE,gEAAgE,CACnE,CACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -21,9 +21,15 @@ export declare function simSnsSelfSignedCertificatePem(input: SimSnsCertificateI
|
|
|
21
21
|
* to allocate, and a serial derived from the key is unique in the only way that
|
|
22
22
|
* matters: two simulated scopes with different keys have different serials.
|
|
23
23
|
*
|
|
24
|
-
* The
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* The bytes are the number itself, unsigned, and `derInteger` writes them the
|
|
25
|
+
* way DER writes an unsigned number, so how the sign of a written number is
|
|
26
|
+
* kept is the encoding's business rather than this function's.
|
|
27
|
+
*
|
|
28
|
+
* Which number it is stays this function's business, and X.509 says a serial
|
|
29
|
+
* number is positive. Zero is the one value a digest could name that is not,
|
|
30
|
+
* so it is answered with one instead. No real digest is all zeroes, and a
|
|
31
|
+
* certificate that is not a certificate is not worth the byte saved by leaving
|
|
32
|
+
* that to chance.
|
|
27
33
|
*/
|
|
28
34
|
export declare function simSnsSerialNumber(digest: Buffer): Buffer;
|
|
29
35
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-sns-certificate.d.ts","sourceRoot":"","sources":["../../../../src/service/sns/signature/sim-sns-certificate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AA6D7C,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAuED;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,sBAAsB,GAC5B,MAAM,CAaR;AAED
|
|
1
|
+
{"version":3,"file":"sim-sns-certificate.d.ts","sourceRoot":"","sources":["../../../../src/service/sns/signature/sim-sns-certificate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AA6D7C,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAuED;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,sBAAsB,GAC5B,MAAM,CAaR;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAIzD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createSign } from "node:crypto";
|
|
2
|
-
import { derBitStringTag, derBytes, derExplicitZeroTag,
|
|
2
|
+
import { derBitStringTag, derBytes, derExplicitZeroTag, derInteger, derNullTag, derObjectIdentifierTag, derPrintableStringTag, derSequenceTag, derSetTag, derText, derUtcTimeTag, derValue, } from "./sim-sns-der.js";
|
|
3
3
|
/**
|
|
4
4
|
* The body bytes of the sha1WithRSAEncryption object identifier,
|
|
5
5
|
* 1.2.840.113549.1.1.5.
|
|
@@ -17,7 +17,7 @@ const commonName = [0x55, 0x04, 0x03];
|
|
|
17
17
|
/**
|
|
18
18
|
* The version number of an X.509 v3 certificate, which counts from zero.
|
|
19
19
|
*/
|
|
20
|
-
const version3 = 2;
|
|
20
|
+
const version3 = Buffer.from([2]);
|
|
21
21
|
/**
|
|
22
22
|
* When the certificate becomes valid, and when it stops being valid.
|
|
23
23
|
*
|
|
@@ -73,7 +73,7 @@ function distinguishedName(name) {
|
|
|
73
73
|
*/
|
|
74
74
|
function certificateBody(input) {
|
|
75
75
|
const name = distinguishedName(input.subjectName);
|
|
76
|
-
return derValue(derSequenceTag, derValue(derExplicitZeroTag,
|
|
76
|
+
return derValue(derSequenceTag, derValue(derExplicitZeroTag, derInteger(version3)), derInteger(input.serialNumber), signatureAlgorithm(), name, derValue(derSequenceTag, utcTime(notBefore), utcTime(notAfter)),
|
|
77
77
|
// Self-signed, so the issuer and the subject are the same Name.
|
|
78
78
|
name, input.publicKey.export({ type: "spki", format: "der" }));
|
|
79
79
|
}
|
|
@@ -98,13 +98,18 @@ export function simSnsSelfSignedCertificatePem(input) {
|
|
|
98
98
|
* to allocate, and a serial derived from the key is unique in the only way that
|
|
99
99
|
* matters: two simulated scopes with different keys have different serials.
|
|
100
100
|
*
|
|
101
|
-
* The
|
|
102
|
-
*
|
|
103
|
-
*
|
|
101
|
+
* The bytes are the number itself, unsigned, and `derInteger` writes them the
|
|
102
|
+
* way DER writes an unsigned number, so how the sign of a written number is
|
|
103
|
+
* kept is the encoding's business rather than this function's.
|
|
104
|
+
*
|
|
105
|
+
* Which number it is stays this function's business, and X.509 says a serial
|
|
106
|
+
* number is positive. Zero is the one value a digest could name that is not,
|
|
107
|
+
* so it is answered with one instead. No real digest is all zeroes, and a
|
|
108
|
+
* certificate that is not a certificate is not worth the byte saved by leaving
|
|
109
|
+
* that to chance.
|
|
104
110
|
*/
|
|
105
111
|
export function simSnsSerialNumber(digest) {
|
|
106
112
|
const serial = Buffer.from(digest.subarray(0, serialNumberBytes));
|
|
107
|
-
serial.
|
|
108
|
-
return serial;
|
|
113
|
+
return serial.some((byte) => byte !== 0) ? serial : Buffer.from([1]);
|
|
109
114
|
}
|
|
110
115
|
//# sourceMappingURL=sim-sns-certificate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-sns-certificate.js","sourceRoot":"","sources":["../../../../src/service/sns/signature/sim-sns-certificate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"sim-sns-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C,CAAC;IAC/D,gEAAgE;IAChE,IAAI,EACJ,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CACxD,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,8BAA8B,CAC5C,KAA6B;IAE7B,MAAM,IAAI,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC7E,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpC,OAAO,KAAK,CACV,QAAQ,CACN,cAAc,EACd,IAAI,EACJ,kBAAkB,EAAE,EACpB,QAAQ,CAAC,eAAe,EAAE,UAAU,EAAE,SAAS,CAAC,CACjD,CACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAElE,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -37,4 +37,20 @@ export declare function derText(tag: number, value: string): Buffer;
|
|
|
37
37
|
* A DER value holding bytes given one at a time.
|
|
38
38
|
*/
|
|
39
39
|
export declare function derBytes(tag: number, ...bytes: number[]): Buffer;
|
|
40
|
+
/**
|
|
41
|
+
* A DER integer holding a number given as unsigned bytes, most significant
|
|
42
|
+
* first.
|
|
43
|
+
*
|
|
44
|
+
* A DER integer is signed, and it is written in the fewest bytes that say what
|
|
45
|
+
* it is, so the bytes a number arrives as are not always the bytes it is
|
|
46
|
+
* written as. A leading zero is dropped, unless the byte after it has its top
|
|
47
|
+
* bit set: there the zero is the only thing keeping the number positive, and
|
|
48
|
+
* dropping it would say the number is negative instead.
|
|
49
|
+
*
|
|
50
|
+
* Getting either wrong does not produce a number read a little differently. A
|
|
51
|
+
* reader rejects the value rather than reading it leniently: OpenSSL answers a
|
|
52
|
+
* zero byte that was not needed with `illegal padding` and then refuses to
|
|
53
|
+
* parse the certificate carrying it at all.
|
|
54
|
+
*/
|
|
55
|
+
export declare function derInteger(magnitude: Buffer): Buffer;
|
|
40
56
|
//# sourceMappingURL=sim-sns-der.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-sns-der.d.ts","sourceRoot":"","sources":["../../../../src/service/sns/signature/sim-sns-der.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,cAAc,KAAO,CAAC;AAEnC,eAAO,MAAM,SAAS,KAAO,CAAC;AAE9B,eAAO,MAAM,aAAa,IAAO,CAAC;AAElC,eAAO,MAAM,eAAe,IAAO,CAAC;AAEpC,eAAO,MAAM,UAAU,IAAO,CAAC;AAE/B,eAAO,MAAM,sBAAsB,IAAO,CAAC;AAE3C,eAAO,MAAM,qBAAqB,KAAO,CAAC;AAE1C,eAAO,MAAM,aAAa,KAAO,CAAC;AAElC;;;GAGG;AACH,eAAO,MAAM,kBAAkB,MAAO,CAAC;AAwBvC;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAInE;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAEhE"}
|
|
1
|
+
{"version":3,"file":"sim-sns-der.d.ts","sourceRoot":"","sources":["../../../../src/service/sns/signature/sim-sns-der.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,cAAc,KAAO,CAAC;AAEnC,eAAO,MAAM,SAAS,KAAO,CAAC;AAE9B,eAAO,MAAM,aAAa,IAAO,CAAC;AAElC,eAAO,MAAM,eAAe,IAAO,CAAC;AAEpC,eAAO,MAAM,UAAU,IAAO,CAAC;AAE/B,eAAO,MAAM,sBAAsB,IAAO,CAAC;AAE3C,eAAO,MAAM,qBAAqB,KAAO,CAAC;AAE1C,eAAO,MAAM,aAAa,KAAO,CAAC;AAElC;;;GAGG;AACH,eAAO,MAAM,kBAAkB,MAAO,CAAC;AAwBvC;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAInE;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAEhE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CASpD"}
|
|
@@ -61,4 +61,27 @@ export function derText(tag, value) {
|
|
|
61
61
|
export function derBytes(tag, ...bytes) {
|
|
62
62
|
return derValue(tag, Buffer.from(bytes));
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* A DER integer holding a number given as unsigned bytes, most significant
|
|
66
|
+
* first.
|
|
67
|
+
*
|
|
68
|
+
* A DER integer is signed, and it is written in the fewest bytes that say what
|
|
69
|
+
* it is, so the bytes a number arrives as are not always the bytes it is
|
|
70
|
+
* written as. A leading zero is dropped, unless the byte after it has its top
|
|
71
|
+
* bit set: there the zero is the only thing keeping the number positive, and
|
|
72
|
+
* dropping it would say the number is negative instead.
|
|
73
|
+
*
|
|
74
|
+
* Getting either wrong does not produce a number read a little differently. A
|
|
75
|
+
* reader rejects the value rather than reading it leniently: OpenSSL answers a
|
|
76
|
+
* zero byte that was not needed with `illegal padding` and then refuses to
|
|
77
|
+
* parse the certificate carrying it at all.
|
|
78
|
+
*/
|
|
79
|
+
export function derInteger(magnitude) {
|
|
80
|
+
const significant = magnitude.findIndex((byte) => byte !== 0);
|
|
81
|
+
const body = significant === -1 ? Buffer.from([0]) : magnitude.subarray(significant);
|
|
82
|
+
const readsAsNegative = (body.readUInt8(0) & 0x80) !== 0;
|
|
83
|
+
return readsAsNegative
|
|
84
|
+
? derValue(derIntegerTag, Buffer.from([0]), body)
|
|
85
|
+
: derValue(derIntegerTag, body);
|
|
86
|
+
}
|
|
64
87
|
//# sourceMappingURL=sim-sns-der.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-sns-der.js","sourceRoot":"","sources":["../../../../src/service/sns/signature/sim-sns-der.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AAEnC,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC;AAE9B,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;AAElC,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;AAEpC,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC;AAE/B,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAE3C,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAE1C,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;AAElC;;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QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AACpC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The ETag real S3 gives an Object uploaded in one part.
|
|
3
|
-
*
|
|
4
|
-
* It is the MD5 of the bytes, in hex. An Object uploaded in several parts gets
|
|
5
|
-
* a different form, which simulated S3 has no multipart upload to produce.
|
|
6
|
-
*/
|
|
7
|
-
export declare function simS3ObjectETag(body: Buffer): string;
|
|
8
|
-
//# sourceMappingURL=sim-s3-object-etag.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sim-s3-object-etag.d.ts","sourceRoot":"","sources":["../../../../../src/service/s3/notification/event/sim-s3-object-etag.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
|
-
/**
|
|
3
|
-
* The ETag real S3 gives an Object uploaded in one part.
|
|
4
|
-
*
|
|
5
|
-
* It is the MD5 of the bytes, in hex. An Object uploaded in several parts gets
|
|
6
|
-
* a different form, which simulated S3 has no multipart upload to produce.
|
|
7
|
-
*/
|
|
8
|
-
export function simS3ObjectETag(body) {
|
|
9
|
-
return createHash("md5").update(body).digest("hex");
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=sim-s3-object-etag.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sim-s3-object-etag.js","sourceRoot":"","sources":["../../../../../src/service/s3/notification/event/sim-s3-object-etag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACtD,CAAC"}
|