@crvouga/mockingbird-service-s3 3.7.0 → 3.8.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/CHANGELOG.md +8 -1
- package/README.md +13 -1
- package/dist/{chunk-THIFXCQ2.js → chunk-2B5OVZSH.js} +53 -11
- package/dist/chunk-2B5OVZSH.js.map +7 -0
- package/dist/{chunk-XFKAVTM2.js → chunk-NNRVXV6X.js} +532 -106
- package/dist/{chunk-XFKAVTM2.js.map → chunk-NNRVXV6X.js.map} +4 -4
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +65 -8
- package/dist/index.js +3 -1
- package/dist/server.d.ts +66 -7
- package/dist/server.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-THIFXCQ2.js.map +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-s3
|
|
2
2
|
|
|
3
|
-
## 3.
|
|
3
|
+
## 3.8.0 (2026-10-21)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- raise the serve and fleet body limit to the S3 maximum ([86b9e2b](https://github.com/crvouga/mockingbird/commit/86b9e2b80bcaaaef57f52edbac50b27da0b42f33))
|
|
8
|
+
- response overrides, copy conditionals, chunked uploads and related S3 parity ([8f21aa7](https://github.com/crvouga/mockingbird/commit/8f21aa717837a0fd5de3ed833c8e3b03a84b4e5a))
|
|
9
|
+
|
|
10
|
+
## 3.7.0 (2026-10-18)
|
|
4
11
|
|
|
5
12
|
### Features
|
|
6
13
|
|
package/README.md
CHANGED
|
@@ -42,6 +42,17 @@ await server.close()
|
|
|
42
42
|
|
|
43
43
|
Set an application's S3 endpoint environment variable to the server URL and its region to `us-east-1`. Supported REST operations are CreateBucket, HeadBucket, PutObject, GetObject, HeadObject, DeleteObject, DeleteObjects, CopyObject, ListObjectsV2, and multipart create/upload/complete/abort. SDK `GetObject` bodies retain its streaming helpers.
|
|
44
44
|
|
|
45
|
+
### Request semantics
|
|
46
|
+
|
|
47
|
+
Each behavior follows the linked Amazon S3 reference.
|
|
48
|
+
|
|
49
|
+
- **Response header overrides** ([GetObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html)): `response-cache-control`, `response-content-disposition`, `response-content-encoding`, `response-content-language`, `response-content-type` and `response-expires` replace the stored header on a 200 or 206 GetObject and on HeadObject. Like S3, they are refused with `400 InvalidRequest` on anonymous requests.
|
|
50
|
+
- **Copy-source preconditions** ([CopyObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html)): `x-amz-copy-source-if-match`, `-if-none-match`, `-if-modified-since` and `-if-unmodified-since` are evaluated against the source object. An unmet precondition answers `412 PreconditionFailed` and copies nothing; a true `if-match` overrides a false `if-unmodified-since`, and a matching `if-none-match` is `412` whatever `if-modified-since` says, as documented. When `if-none-match` is present, `if-modified-since` is not consulted (best guess, not oracle-verified: the reference does not state it).
|
|
51
|
+
- **Streaming uploads** ([SigV4 streaming](https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-streaming.html), [with trailers](https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-streaming-trailers.html)): `Content-Encoding: aws-chunked` bodies (signed and `STREAMING-UNSIGNED-PAYLOAD-TRAILER`) are decoded before storing, on PutObject and UploadPart. The stored length is `x-amz-decoded-content-length`; a trailer or header `x-amz-checksum-*` that does not match, or a wrong decoded length, is rejected with `400` (`BadDigest` / `IncompleteBody`) and stores nothing. Chunk signatures are not verified.
|
|
52
|
+
- **Body size** ([upload limits](https://docs.aws.amazon.com/AmazonS3/latest/userguide/upload-objects.html)): `createServer` accepts bodies up to 5 GiB, the S3 maximum for one PUT or part, and answers larger ones with S3's `EntityTooLarge`. `createServer({ maxBodyBytes })` lowers the limit. `mockingbird-s3 serve` and fleet entries use the same 5 GiB limit (the target sets `maxBodyBytes`; other services keep the adapter's 16 MiB default).
|
|
53
|
+
- **Virtual-hosted-style addressing** ([VirtualHosting](https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html)): `Host: <bucket>.<base host>` names the bucket and the path is the key, so an SDK client without `forcePathStyle` works against `AWS_ENDPOINT_URL_S3=http://localhost:<port>`. The base hosts default to `localhost` (so `docs.localhost`); set `virtualHosts` (`--virtual-host a,b`, empty for path-style only) to change them. Path-style requests and IP or other hosts are unchanged, an unknown bucket is `NoSuchBucket`, no request ever creates a bucket as a side effect, presigned URLs are verified against the virtual host, and the admin prefix keeps its path on any host.
|
|
54
|
+
- **Bucket CORS** ([CORS](https://docs.aws.amazon.com/AmazonS3/latest/userguide/cors.html), [PutBucketCors](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketCors.html), [OPTIONS object](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTOPTIONSobject.html)): the stored `CORSConfiguration` is enforced. An unauthenticated `OPTIONS` preflight (any `X-Amz-*` query is ignored) is answered by the first rule matching origin, method and requested headers with `Access-Control-Allow-Origin/-Methods/-Headers/-Max-Age/-Expose-Headers` and `Vary`; otherwise it is `403 AccessForbidden` ("CORSResponse: This CORS request is not allowed.", or "CORS is not enabled for this bucket." with no rules or after `DeleteBucketCors`) with no `Access-Control-*` headers. Actual requests with an allowed `Origin` and method get `Access-Control-Allow-Origin`, `Access-Control-Expose-Headers` and `Vary: Origin`, errors included. `PutBucketCors` rejects empty rule sets, unsupported methods and multiple wildcards. Best guess, not oracle-verified: the exact set and ordering of preflight headers beyond what the docs list (the `AccessForbidden` error code matches what S3 and s3rver return for a disabled bucket); no live AWS bucket was exercised.
|
|
55
|
+
|
|
45
56
|
### Admin and deterministic controls
|
|
46
57
|
|
|
47
58
|
- `GET/POST /__admin/objects` inspects metadata or seeds an object; `GET /__admin/objects/:bucket/:key` downloads its bytes.
|
|
@@ -54,7 +65,7 @@ The shared runtime also provides health, reset, journal, metrics, timeline, and
|
|
|
54
65
|
|
|
55
66
|
### Deliberately not modelled
|
|
56
67
|
|
|
57
|
-
Operations outside the surface listed above, object versioning, ACL/IAM policy evaluation, storage classes, checksums beyond ETags, production quotas, AWS dashboards and billing,
|
|
68
|
+
Operations outside the surface listed above, object versioning, ACL/IAM policy evaluation, storage classes, checksums beyond ETags, production quotas, AWS dashboards and billing, and real SQS delivery are not modelled. SQS consumers can use the same captured notification payload through a configured HTTP sink.
|
|
58
69
|
|
|
59
70
|
## API
|
|
60
71
|
|
|
@@ -62,6 +73,7 @@ Operations outside the surface listed above, object versioning, ACL/IAM policy e
|
|
|
62
73
|
- `S3Notification`, `S3Object`, `S3SeedObject`: notification, state, and fixture types.
|
|
63
74
|
- `createRuntime`, `S3Runtime`, `S3RuntimeOptions`: full Mockingbird runtime and webhook hub.
|
|
64
75
|
- `S3_NAMESPACE`, `S3_PRESETS`, `accessKeyCredential`: constants and fault controls.
|
|
76
|
+
- `S3_MAX_UPLOAD_BYTES`: the default request body limit (5 GiB) for `createServer`.
|
|
65
77
|
- `document`, `operationIds`, `supportedOperationIds`: generated OpenAPI metadata.
|
|
66
78
|
- `createServer`, `S3ServerOptions`, `DEFAULT_PORT`, `serveTarget` from `./server`: Node HTTP adapter and CLI integration.
|
|
67
79
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
S3_MAX_UPLOAD_BYTES,
|
|
2
3
|
createClock,
|
|
3
4
|
createRuntime,
|
|
4
5
|
normalizeBootControls,
|
|
@@ -9,7 +10,7 @@ import {
|
|
|
9
10
|
parseFaultHeader,
|
|
10
11
|
resolveAdminPrefix,
|
|
11
12
|
restoreClock
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-NNRVXV6X.js";
|
|
13
14
|
|
|
14
15
|
// ../../adapters/node/dist/cli.js
|
|
15
16
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
@@ -3057,7 +3058,7 @@ async function preflightFleet(config, options) {
|
|
|
3057
3058
|
break;
|
|
3058
3059
|
}
|
|
3059
3060
|
}
|
|
3060
|
-
targets.set(name, { ...target, packageVersion: packageVersion ?? "3.
|
|
3061
|
+
targets.set(name, { ...target, packageVersion: packageVersion ?? "3.8.0" });
|
|
3061
3062
|
} catch (error) {
|
|
3062
3063
|
throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
3063
3064
|
}
|
|
@@ -3283,7 +3284,11 @@ var serve = async (api, options = {}) => {
|
|
|
3283
3284
|
// ../../adapters/node/dist/listen.js
|
|
3284
3285
|
var listen = async (api, options = {}) => {
|
|
3285
3286
|
const host = options.host ?? "127.0.0.1";
|
|
3286
|
-
const server = await serve(api, {
|
|
3287
|
+
const server = await serve(api, {
|
|
3288
|
+
port: options.port ?? 0,
|
|
3289
|
+
host,
|
|
3290
|
+
...options.maxBodyBytes !== void 0 ? { maxBodyBytes: options.maxBodyBytes } : {}
|
|
3291
|
+
});
|
|
3287
3292
|
const address = server.address();
|
|
3288
3293
|
const port = typeof address === "object" && address !== null ? address.port : options.port ?? 0;
|
|
3289
3294
|
const shown = host.includes(":") ? `[${host}]` : host;
|
|
@@ -3482,7 +3487,8 @@ var httpChild = async (target, entry, options, admission, generation, privateAcc
|
|
|
3482
3487
|
try {
|
|
3483
3488
|
server = await listen(api, {
|
|
3484
3489
|
port: entry.port ?? target.defaultPort,
|
|
3485
|
-
host: entry.host ?? "127.0.0.1"
|
|
3490
|
+
host: entry.host ?? "127.0.0.1",
|
|
3491
|
+
...target.maxBodyBytes !== void 0 ? { maxBodyBytes: target.maxBodyBytes } : {}
|
|
3486
3492
|
});
|
|
3487
3493
|
target.listening?.(server);
|
|
3488
3494
|
} catch (error) {
|
|
@@ -4873,7 +4879,11 @@ var start = async (target, values, config) => {
|
|
|
4873
4879
|
});
|
|
4874
4880
|
if (config.idBase !== void 0)
|
|
4875
4881
|
runtime.setIdBase?.(config.idBase);
|
|
4876
|
-
const listening = await listen(runtime, {
|
|
4882
|
+
const listening = await listen(runtime, {
|
|
4883
|
+
port: config.port,
|
|
4884
|
+
host: config.host,
|
|
4885
|
+
...target.maxBodyBytes !== void 0 ? { maxBodyBytes: target.maxBodyBytes } : {}
|
|
4886
|
+
});
|
|
4877
4887
|
target.listening?.(listening);
|
|
4878
4888
|
console.log(`${target.name} emulator listening on ${listening.url}`);
|
|
4879
4889
|
console.log(`${target.name} health: GET ${listening.url}${adminPrefix}/health`);
|
|
@@ -4976,22 +4986,54 @@ var serveCommand = (target) => ({
|
|
|
4976
4986
|
// src/server.ts
|
|
4977
4987
|
var DEFAULT_PORT = 8812;
|
|
4978
4988
|
var createServer2 = async (options = {}) => {
|
|
4979
|
-
const { port, host, ...rest } = options;
|
|
4989
|
+
const { port, host, maxBodyBytes, ...rest } = options;
|
|
4980
4990
|
const runtime = createRuntime(rest);
|
|
4981
|
-
|
|
4991
|
+
const bind = host ?? "127.0.0.1";
|
|
4992
|
+
const server = await serve(runtime, {
|
|
4993
|
+
port: port ?? 0,
|
|
4994
|
+
host: bind,
|
|
4995
|
+
maxBodyBytes: maxBodyBytes ?? S3_MAX_UPLOAD_BYTES
|
|
4996
|
+
});
|
|
4997
|
+
const address = server.address();
|
|
4998
|
+
const bound = typeof address === "object" && address !== null ? address.port : port ?? 0;
|
|
4999
|
+
return {
|
|
5000
|
+
url: `http://${bind.includes(":") ? `[${bind}]` : bind}:${bound}`,
|
|
5001
|
+
port: bound,
|
|
5002
|
+
host: bind,
|
|
5003
|
+
server,
|
|
5004
|
+
runtime,
|
|
5005
|
+
close: () => new Promise((resolve4, reject) => {
|
|
5006
|
+
server.close((error) => {
|
|
5007
|
+
if (error && error.code !== "ERR_SERVER_NOT_RUNNING") reject(error);
|
|
5008
|
+
else resolve4();
|
|
5009
|
+
});
|
|
5010
|
+
server.closeAllConnections?.();
|
|
5011
|
+
})
|
|
5012
|
+
};
|
|
4982
5013
|
};
|
|
4983
5014
|
var serveTarget = {
|
|
4984
5015
|
name: "s3",
|
|
4985
5016
|
defaultPort: DEFAULT_PORT,
|
|
4986
|
-
|
|
5017
|
+
maxBodyBytes: S3_MAX_UPLOAD_BYTES,
|
|
5018
|
+
options: {
|
|
5019
|
+
"virtual-host": {
|
|
5020
|
+
type: "string",
|
|
5021
|
+
value: "<hosts>",
|
|
5022
|
+
description: "Comma-separated base hosts for virtual-hosted-style requests: Host <bucket>.<host> names the bucket (default localhost; empty for path-style only)"
|
|
5023
|
+
}
|
|
5024
|
+
},
|
|
5025
|
+
create: (values, common) => createRuntime({
|
|
4987
5026
|
...common.adminPrefix !== void 0 ? { adminPrefix: common.adminPrefix } : {},
|
|
4988
5027
|
...common.adminKey !== void 0 ? { adminKey: common.adminKey } : {},
|
|
4989
5028
|
...common.adminControls !== void 0 ? { adminControls: common.adminControls } : {},
|
|
4990
5029
|
...common.seed !== void 0 ? { seed: common.seed } : {},
|
|
4991
|
-
...common.onLog ? { onLog: common.onLog } : {}
|
|
5030
|
+
...common.onLog ? { onLog: common.onLog } : {},
|
|
5031
|
+
...typeof values["virtual-host"] === "string" ? {
|
|
5032
|
+
virtualHosts: values["virtual-host"].split(",").map((host) => host.trim()).filter(Boolean)
|
|
5033
|
+
} : {}
|
|
4992
5034
|
}),
|
|
4993
5035
|
banner: () => [
|
|
4994
|
-
"AWS SDK endpoint: set forcePathStyle=true
|
|
5036
|
+
"AWS SDK endpoint: set endpoint to this URL; forcePathStyle=true, or a client that addresses <bucket>.localhost",
|
|
4995
5037
|
"admin: POST /__admin/objects; GET /__admin/objects"
|
|
4996
5038
|
]
|
|
4997
5039
|
};
|
|
@@ -5003,4 +5045,4 @@ export {
|
|
|
5003
5045
|
createServer2 as createServer,
|
|
5004
5046
|
serveTarget
|
|
5005
5047
|
};
|
|
5006
|
-
//# sourceMappingURL=chunk-
|
|
5048
|
+
//# sourceMappingURL=chunk-2B5OVZSH.js.map
|