@crvouga/mockingbird-service-s3 3.6.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/dist/cli.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  runCli,
4
4
  serveCommand,
5
5
  serveTarget
6
- } from "./chunk-PZ2JLZAI.js";
7
- import "./chunk-PCW23MUG.js";
6
+ } from "./chunk-2B5OVZSH.js";
7
+ import "./chunk-NNRVXV6X.js";
8
8
 
9
9
  // src/cli.ts
10
10
  var code = await runCli(
package/dist/index.d.ts CHANGED
@@ -172,9 +172,15 @@ declare class Collection<T> {
172
172
  }>;
173
173
  }
174
174
 
175
+ /**
176
+ * What names an id base: a non-negative safe integer (or its decimal string) or `"boot"`,
177
+ * which derives the base from the wall clock when the runtime is created.
178
+ */
179
+ type IdBase = number | string;
175
180
  /**
176
181
  * Sequential id source persisted in SQLite. Ids are deterministic for a given
177
182
  * sequence history (`cus_` + 14 opaque chars), so reproductions stay stable.
183
+ * A runtime's `idBase` is mixed in, so a different base reissues none of another's ids.
178
184
  */
179
185
  declare class IdSequence {
180
186
  private readonly sqlite;
@@ -279,6 +285,15 @@ type FaultRule = {
279
285
  requestHeaders?: Record<string, string>;
280
286
  /** Fault only requests carrying these query parameters. `"*"` matches any value. */
281
287
  query?: Record<string, string>;
288
+ /**
289
+ * Fault only requests whose JSON body carries these fields. Each key is a dotted path into
290
+ * the parsed body (`"patient_details.email"`; a number steps into an array, `"items.0.sku"`)
291
+ * and each value is what the field must equal: a string, number, boolean or `null`, compared
292
+ * strictly (`3` is not `"3"`). `"*"` matches any value that is present. A request whose body
293
+ * is missing, is not JSON, or is not a JSON object never matches. Not `body`, which is the
294
+ * response a rule injects.
295
+ */
296
+ requestBody?: Record<string, RequestBodyValue>;
282
297
  /**
283
298
  * Fault only this namespace. Omit (or `"*"`) to fault every namespace — which is what
284
299
  * an in-process caller usually wants, and what a parallel worker usually does not:
@@ -345,6 +360,8 @@ type FaultRule = {
345
360
  /** The preset this rule was expanded from, if any. */
346
361
  fromPreset?: string;
347
362
  };
363
+ /** What a field of the request body must equal in {@link FaultRule.requestBody}. */
364
+ type RequestBodyValue = string | number | boolean | null;
348
365
  /** A fault that fired for one request. */
349
366
  type FaultHit = {
350
367
  id: string;
@@ -382,6 +399,11 @@ type FaultCandidate = {
382
399
  /** Request headers and query, for rules that match on them. */
383
400
  headers?: Headers;
384
401
  query?: URLSearchParams;
402
+ /**
403
+ * The request body parsed as JSON, read only when a rule matches on `requestBody`. Resolve
404
+ * `undefined` for a body that is missing or not JSON. It must leave the request readable.
405
+ */
406
+ readJson?: () => Promise<unknown>;
385
407
  /** The namespace clock, for `from` / `until`. Rules with a window are skipped without it. */
386
408
  now?: number;
387
409
  /** How to spend a delay for this request. Default: the registry's own sleep. */
@@ -904,6 +926,12 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
904
926
  mount(prefix: string): MountedAPI;
905
927
  readonly sqlite: SqliteClient$1;
906
928
  readonly clock: Clock;
929
+ /**
930
+ * Change the id base ({@link RuntimeOptions.idBase}) for ids generated from now on, and
931
+ * return the number it resolved to. Set it before the first request so a boot's ids stay
932
+ * one run.
933
+ */
934
+ setIdBase(base: IdBase): number;
907
935
  readonly faults: FaultRegistry;
908
936
  /** Baseline response time per namespace. */
909
937
  readonly latency: LatencyRegistry;
@@ -1183,7 +1211,7 @@ interface SqliteClient {
1183
1211
  type S3Object = {
1184
1212
  bucket: string;
1185
1213
  key: string;
1186
- bytes: number[];
1214
+ bytes: Uint8Array;
1187
1215
  etag: string;
1188
1216
  lastModified: number;
1189
1217
  contentType?: string;
@@ -1209,7 +1237,7 @@ type MultipartUpload = {
1209
1237
  type MultipartPart = {
1210
1238
  uploadId: string;
1211
1239
  partNumber: number;
1212
- bytes: number[];
1240
+ bytes: Uint8Array;
1213
1241
  etag: string;
1214
1242
  };
1215
1243
  type S3SeedObject = Omit<S3Object, "etag" | "lastModified" | "bytes"> & {
@@ -1217,17 +1245,41 @@ type S3SeedObject = Omit<S3Object, "etag" | "lastModified" | "bytes"> & {
1217
1245
  etag?: string;
1218
1246
  lastModified?: number;
1219
1247
  };
1248
+ /**
1249
+ * Records with a `bytes` body, kept as base64 so a large object is a string in the row instead of
1250
+ * one JSON number per byte. Filters see the record without its body, which is only decoded for
1251
+ * the records that pass.
1252
+ */
1253
+ declare class BlobCollection<T extends {
1254
+ bytes: Uint8Array;
1255
+ }> {
1256
+ private readonly inner;
1257
+ constructor(sqlite: SqliteClient, namespace: string, name: string);
1258
+ private decode;
1259
+ get(id: string): T | undefined;
1260
+ has(id: string): boolean;
1261
+ insert(id: string, value: T): void;
1262
+ delete(id: string): boolean;
1263
+ list(options?: {
1264
+ where?: (value: Omit<T, "bytes">) => boolean;
1265
+ order?: "newest" | "oldest";
1266
+ }): {
1267
+ value: T;
1268
+ seq: number;
1269
+ id: string;
1270
+ }[];
1271
+ }
1220
1272
  declare class S3State {
1221
1273
  readonly buckets: Collection<{
1222
1274
  createdAt: number;
1223
1275
  }>;
1224
- readonly objects: Collection<S3Object>;
1225
- readonly versions: Collection<S3Object>;
1276
+ readonly objects: BlobCollection<S3Object>;
1277
+ readonly versions: BlobCollection<S3Object>;
1226
1278
  readonly configurations: Collection<{
1227
1279
  body: string;
1228
1280
  }>;
1229
1281
  readonly uploads: Collection<MultipartUpload>;
1230
- readonly parts: Collection<MultipartPart>;
1282
+ readonly parts: BlobCollection<MultipartPart>;
1231
1283
  readonly ids: IdSequence;
1232
1284
  constructor(sqlite: SqliteClient, namespace: string);
1233
1285
  objectId(bucket: string, key: string): string;
@@ -1247,6 +1299,11 @@ type S3RuntimeOptions = {
1247
1299
  buckets?: readonly string[];
1248
1300
  objects?: readonly S3SeedObject[];
1249
1301
  credentials?: Readonly<Record<string, string>>;
1302
+ /**
1303
+ * Base hosts for virtual-hosted-style addressing: `Host: <bucket>.<base>` names the bucket and
1304
+ * the path is the key. Default `["localhost"]`; `[]` leaves every request path-style.
1305
+ */
1306
+ virtualHosts?: readonly string[];
1250
1307
  webhooks?: {
1251
1308
  endpoints?: WebhookEndpoint[];
1252
1309
  retryDelaysMs?: readonly number[];
@@ -1259,11 +1316,18 @@ type S3Runtime = ServiceRuntime<S3API> & {
1259
1316
  declare const createRuntime: (options?: S3RuntimeOptions) => S3Runtime;
1260
1317
 
1261
1318
  declare const S3_NAMESPACE = "s3";
1319
+ /** S3 accepts at most 5 GB in a single PUT and in each multipart part. */
1320
+ declare const S3_MAX_UPLOAD_BYTES: number;
1262
1321
  declare const accessKeyCredential: (request: Request) => string | undefined;
1263
1322
  type S3APIOptions = APIOptions & {
1264
1323
  buckets?: readonly string[];
1265
1324
  objects?: readonly S3SeedObject[];
1266
1325
  credentials?: Readonly<Record<string, string>>;
1326
+ /**
1327
+ * Base hosts for virtual-hosted-style addressing: `Host: <bucket>.<base>` names the bucket and
1328
+ * the path is the key. Default `["localhost"]`; `[]` leaves every request path-style.
1329
+ */
1330
+ virtualHosts?: readonly string[];
1267
1331
  onNotification?: (event: S3Notification) => void;
1268
1332
  /** A seeded stream of `[0, 1)` for request ids, so an error body replays from its seed. */
1269
1333
  random?: () => number;
@@ -1291,7 +1355,15 @@ declare class S3API {
1291
1355
  private notify;
1292
1356
  private verifyPresign;
1293
1357
  private objectHeaders;
1294
- fetch(request: Request): Promise<Response>;
1358
+ fetch(input: Request): Promise<Response>;
1359
+ private handle;
1360
+ /** `response-*` query parameters replace the stored headers on a 200 or 206. */
1361
+ private overridden;
1362
+ /**
1363
+ * `x-amz-copy-source-if-*`, evaluated as the CopyObject reference describes: a true if-match
1364
+ * overrides a false if-unmodified-since, and a failed condition is always 412, never 304.
1365
+ */
1366
+ private copyConditions;
1295
1367
  private put;
1296
1368
  private get;
1297
1369
  private list;
@@ -1303,13 +1375,26 @@ declare class S3API {
1303
1375
  private versioning;
1304
1376
  private removeObject;
1305
1377
  private conditions;
1306
- private validateChecksums;
1378
+ /**
1379
+ * The object bytes of a PutObject or UploadPart: an `aws-chunked` stream is decoded (the framing
1380
+ * and trailers are not part of the object), the decoded length and every supplied checksum are
1381
+ * verified, and the checksums to keep come back as the `x-amz-checksum-*` headers they were.
1382
+ */
1383
+ private payload;
1307
1384
  private bucketConfiguration;
1385
+ private corsRules;
1386
+ /**
1387
+ * The browser preflight (`OPTIONS` on a bucket or object URL). S3 refuses one it cannot match
1388
+ * with 403 AccessForbidden "CORSResponse: ..." and no `Access-Control-*` headers.
1389
+ */
1390
+ private preflight;
1391
+ /** A matching rule adds the `Access-Control-*` headers to an actual cross-origin response. */
1392
+ private withCors;
1308
1393
  private objectTagging;
1309
1394
  private listParts;
1310
1395
  private listUploads;
1311
1396
  private listVersions;
1312
1397
  }
1313
1398
 
1314
- export { S3API, S3_NAMESPACE, S3_PRESETS, accessKeyCredential, createRuntime, document, operationIds, supportedOperationIds };
1399
+ export { S3API, S3_MAX_UPLOAD_BYTES, S3_NAMESPACE, S3_PRESETS, accessKeyCredential, createRuntime, document, operationIds, supportedOperationIds };
1315
1400
  export type { S3APIOptions, S3Notification, S3Object, S3Runtime, S3RuntimeOptions, S3SeedObject };
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  S3API,
3
+ S3_MAX_UPLOAD_BYTES,
3
4
  S3_NAMESPACE,
4
5
  S3_PRESETS,
5
6
  accessKeyCredential,
@@ -7,9 +8,10 @@ import {
7
8
  document,
8
9
  operationIds,
9
10
  supportedOperationIds
10
- } from "./chunk-PCW23MUG.js";
11
+ } from "./chunk-NNRVXV6X.js";
11
12
  export {
12
13
  S3API,
14
+ S3_MAX_UPLOAD_BYTES,
13
15
  S3_NAMESPACE,
14
16
  S3_PRESETS,
15
17
  accessKeyCredential,
package/dist/server.d.ts CHANGED
@@ -132,6 +132,12 @@ interface SqliteClient$2 {
132
132
  transaction<T>(fn: () => T): T;
133
133
  }
134
134
 
135
+ /**
136
+ * What names an id base: a non-negative safe integer (or its decimal string) or `"boot"`,
137
+ * which derives the base from the wall clock when the runtime is created.
138
+ */
139
+ type IdBase$1 = number | string;
140
+
135
141
  /**
136
142
  * The single source of time for a service.
137
143
  *
@@ -214,6 +220,15 @@ type FaultRule$1 = {
214
220
  requestHeaders?: Record<string, string>;
215
221
  /** Fault only requests carrying these query parameters. `"*"` matches any value. */
216
222
  query?: Record<string, string>;
223
+ /**
224
+ * Fault only requests whose JSON body carries these fields. Each key is a dotted path into
225
+ * the parsed body (`"patient_details.email"`; a number steps into an array, `"items.0.sku"`)
226
+ * and each value is what the field must equal: a string, number, boolean or `null`, compared
227
+ * strictly (`3` is not `"3"`). `"*"` matches any value that is present. A request whose body
228
+ * is missing, is not JSON, or is not a JSON object never matches. Not `body`, which is the
229
+ * response a rule injects.
230
+ */
231
+ requestBody?: Record<string, RequestBodyValue$1>;
217
232
  /**
218
233
  * Fault only this namespace. Omit (or `"*"`) to fault every namespace — which is what
219
234
  * an in-process caller usually wants, and what a parallel worker usually does not:
@@ -280,6 +295,8 @@ type FaultRule$1 = {
280
295
  /** The preset this rule was expanded from, if any. */
281
296
  fromPreset?: string;
282
297
  };
298
+ /** What a field of the request body must equal in {@link FaultRule.requestBody}. */
299
+ type RequestBodyValue$1 = string | number | boolean | null;
283
300
  /** A fault that fired for one request. */
284
301
  type FaultHit$1 = {
285
302
  id: string;
@@ -304,6 +321,11 @@ type FaultCandidate$1 = {
304
321
  /** Request headers and query, for rules that match on them. */
305
322
  headers?: Headers;
306
323
  query?: URLSearchParams;
324
+ /**
325
+ * The request body parsed as JSON, read only when a rule matches on `requestBody`. Resolve
326
+ * `undefined` for a body that is missing or not JSON. It must leave the request readable.
327
+ */
328
+ readJson?: () => Promise<unknown>;
307
329
  /** The namespace clock, for `from` / `until`. Rules with a window are skipped without it. */
308
330
  now?: number;
309
331
  /** How to spend a delay for this request. Default: the registry's own sleep. */
@@ -826,6 +848,12 @@ type ServiceRuntime$1<T extends ServiceInstance$1> = FetchAPI$1 & {
826
848
  mount(prefix: string): MountedAPI$1;
827
849
  readonly sqlite: SqliteClient$2;
828
850
  readonly clock: Clock$1;
851
+ /**
852
+ * Change the id base ({@link RuntimeOptions.idBase}) for ids generated from now on, and
853
+ * return the number it resolved to. Set it before the first request so a boot's ids stay
854
+ * one run.
855
+ */
856
+ setIdBase(base: IdBase$1): number;
829
857
  readonly faults: FaultRegistry$1;
830
858
  /** Baseline response time per namespace. */
831
859
  readonly latency: LatencyRegistry$1;
@@ -931,6 +959,12 @@ type CommonServeOptions = {
931
959
  /** Synthetic provider fixture objects supplied by a fleet entry. */
932
960
  fixtures?: Record<string, unknown>;
933
961
  baseUrl?: string;
962
+ /**
963
+ * Boot settings from `--settings`, `MOCKINGBIRD_SETTINGS` or a fleet entry's `settings`,
964
+ * already checked by the target's {@link ServeTarget.parseSettings}. Pass them to the
965
+ * service's own `settings` option so they become every namespace's defaults.
966
+ */
967
+ settings?: Record<string, unknown>;
934
968
  };
935
969
  /**
936
970
  * What a service contributes to `serve`: how to build its runtime from CLI flags,
@@ -943,7 +977,16 @@ type ServeTarget = {
943
977
  defaultPort: number;
944
978
  /** Serve flags beyond the common ones. */
945
979
  options?: Record<string, CliOption>;
980
+ /**
981
+ * Check the boot settings a caller supplied (`--settings`, `MOCKINGBIRD_SETTINGS`, a fleet
982
+ * entry's `settings`) against the service's settings schema, returning them normalized
983
+ * or throwing a message naming the bad field. A target without one takes no boot settings,
984
+ * and supplying some is refused before a port is bound.
985
+ */
986
+ parseSettings?(settings: Record<string, unknown>): Record<string, unknown>;
946
987
  create(values: CliValues, common: CommonServeOptions): Promise<ServiceRuntime$1<ServiceInstance$1>> | ServiceRuntime$1<ServiceInstance$1>;
988
+ /** Largest request body the HTTP server accepts. Default 16 MiB. */
989
+ maxBodyBytes?: number;
947
990
  /** Startup lines after the listen address, e.g. the loaded corpus version. */
948
991
  banner?(runtime: ServiceRuntime$1<ServiceInstance$1>): string[];
949
992
  /** After the HTTP server is bound. A service that speaks more than HTTP attaches it here. */
@@ -1124,9 +1167,15 @@ declare class Collection<T> {
1124
1167
  }>;
1125
1168
  }
1126
1169
 
1170
+ /**
1171
+ * What names an id base: a non-negative safe integer (or its decimal string) or `"boot"`,
1172
+ * which derives the base from the wall clock when the runtime is created.
1173
+ */
1174
+ type IdBase = number | string;
1127
1175
  /**
1128
1176
  * Sequential id source persisted in SQLite. Ids are deterministic for a given
1129
1177
  * sequence history (`cus_` + 14 opaque chars), so reproductions stay stable.
1178
+ * A runtime's `idBase` is mixed in, so a different base reissues none of another's ids.
1130
1179
  */
1131
1180
  declare class IdSequence {
1132
1181
  private readonly sqlite;
@@ -1231,6 +1280,15 @@ type FaultRule = {
1231
1280
  requestHeaders?: Record<string, string>;
1232
1281
  /** Fault only requests carrying these query parameters. `"*"` matches any value. */
1233
1282
  query?: Record<string, string>;
1283
+ /**
1284
+ * Fault only requests whose JSON body carries these fields. Each key is a dotted path into
1285
+ * the parsed body (`"patient_details.email"`; a number steps into an array, `"items.0.sku"`)
1286
+ * and each value is what the field must equal: a string, number, boolean or `null`, compared
1287
+ * strictly (`3` is not `"3"`). `"*"` matches any value that is present. A request whose body
1288
+ * is missing, is not JSON, or is not a JSON object never matches. Not `body`, which is the
1289
+ * response a rule injects.
1290
+ */
1291
+ requestBody?: Record<string, RequestBodyValue>;
1234
1292
  /**
1235
1293
  * Fault only this namespace. Omit (or `"*"`) to fault every namespace — which is what
1236
1294
  * an in-process caller usually wants, and what a parallel worker usually does not:
@@ -1297,6 +1355,8 @@ type FaultRule = {
1297
1355
  /** The preset this rule was expanded from, if any. */
1298
1356
  fromPreset?: string;
1299
1357
  };
1358
+ /** What a field of the request body must equal in {@link FaultRule.requestBody}. */
1359
+ type RequestBodyValue = string | number | boolean | null;
1300
1360
  /** A fault that fired for one request. */
1301
1361
  type FaultHit = {
1302
1362
  id: string;
@@ -1321,6 +1381,11 @@ type FaultCandidate = {
1321
1381
  /** Request headers and query, for rules that match on them. */
1322
1382
  headers?: Headers;
1323
1383
  query?: URLSearchParams;
1384
+ /**
1385
+ * The request body parsed as JSON, read only when a rule matches on `requestBody`. Resolve
1386
+ * `undefined` for a body that is missing or not JSON. It must leave the request readable.
1387
+ */
1388
+ readJson?: () => Promise<unknown>;
1324
1389
  /** The namespace clock, for `from` / `until`. Rules with a window are skipped without it. */
1325
1390
  now?: number;
1326
1391
  /** How to spend a delay for this request. Default: the registry's own sleep. */
@@ -1843,6 +1908,12 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
1843
1908
  mount(prefix: string): MountedAPI;
1844
1909
  readonly sqlite: SqliteClient$1;
1845
1910
  readonly clock: Clock;
1911
+ /**
1912
+ * Change the id base ({@link RuntimeOptions.idBase}) for ids generated from now on, and
1913
+ * return the number it resolved to. Set it before the first request so a boot's ids stay
1914
+ * one run.
1915
+ */
1916
+ setIdBase(base: IdBase): number;
1846
1917
  readonly faults: FaultRegistry;
1847
1918
  /** Baseline response time per namespace. */
1848
1919
  readonly latency: LatencyRegistry;
@@ -1953,7 +2024,7 @@ interface SqliteClient {
1953
2024
  type S3Object = {
1954
2025
  bucket: string;
1955
2026
  key: string;
1956
- bytes: number[];
2027
+ bytes: Uint8Array;
1957
2028
  etag: string;
1958
2029
  lastModified: number;
1959
2030
  contentType?: string;
@@ -1979,7 +2050,7 @@ type MultipartUpload = {
1979
2050
  type MultipartPart = {
1980
2051
  uploadId: string;
1981
2052
  partNumber: number;
1982
- bytes: number[];
2053
+ bytes: Uint8Array;
1983
2054
  etag: string;
1984
2055
  };
1985
2056
  type S3SeedObject = Omit<S3Object, "etag" | "lastModified" | "bytes"> & {
@@ -1987,17 +2058,41 @@ type S3SeedObject = Omit<S3Object, "etag" | "lastModified" | "bytes"> & {
1987
2058
  etag?: string;
1988
2059
  lastModified?: number;
1989
2060
  };
2061
+ /**
2062
+ * Records with a `bytes` body, kept as base64 so a large object is a string in the row instead of
2063
+ * one JSON number per byte. Filters see the record without its body, which is only decoded for
2064
+ * the records that pass.
2065
+ */
2066
+ declare class BlobCollection<T extends {
2067
+ bytes: Uint8Array;
2068
+ }> {
2069
+ private readonly inner;
2070
+ constructor(sqlite: SqliteClient, namespace: string, name: string);
2071
+ private decode;
2072
+ get(id: string): T | undefined;
2073
+ has(id: string): boolean;
2074
+ insert(id: string, value: T): void;
2075
+ delete(id: string): boolean;
2076
+ list(options?: {
2077
+ where?: (value: Omit<T, "bytes">) => boolean;
2078
+ order?: "newest" | "oldest";
2079
+ }): {
2080
+ value: T;
2081
+ seq: number;
2082
+ id: string;
2083
+ }[];
2084
+ }
1990
2085
  declare class S3State {
1991
2086
  readonly buckets: Collection<{
1992
2087
  createdAt: number;
1993
2088
  }>;
1994
- readonly objects: Collection<S3Object>;
1995
- readonly versions: Collection<S3Object>;
2089
+ readonly objects: BlobCollection<S3Object>;
2090
+ readonly versions: BlobCollection<S3Object>;
1996
2091
  readonly configurations: Collection<{
1997
2092
  body: string;
1998
2093
  }>;
1999
2094
  readonly uploads: Collection<MultipartUpload>;
2000
- readonly parts: Collection<MultipartPart>;
2095
+ readonly parts: BlobCollection<MultipartPart>;
2001
2096
  readonly ids: IdSequence;
2002
2097
  constructor(sqlite: SqliteClient, namespace: string);
2003
2098
  objectId(bucket: string, key: string): string;
@@ -2008,6 +2103,11 @@ type S3APIOptions = APIOptions & {
2008
2103
  buckets?: readonly string[];
2009
2104
  objects?: readonly S3SeedObject[];
2010
2105
  credentials?: Readonly<Record<string, string>>;
2106
+ /**
2107
+ * Base hosts for virtual-hosted-style addressing: `Host: <bucket>.<base>` names the bucket and
2108
+ * the path is the key. Default `["localhost"]`; `[]` leaves every request path-style.
2109
+ */
2110
+ virtualHosts?: readonly string[];
2011
2111
  onNotification?: (event: S3Notification) => void;
2012
2112
  /** A seeded stream of `[0, 1)` for request ids, so an error body replays from its seed. */
2013
2113
  random?: () => number;
@@ -2035,7 +2135,15 @@ declare class S3API {
2035
2135
  private notify;
2036
2136
  private verifyPresign;
2037
2137
  private objectHeaders;
2038
- fetch(request: Request): Promise<Response>;
2138
+ fetch(input: Request): Promise<Response>;
2139
+ private handle;
2140
+ /** `response-*` query parameters replace the stored headers on a 200 or 206. */
2141
+ private overridden;
2142
+ /**
2143
+ * `x-amz-copy-source-if-*`, evaluated as the CopyObject reference describes: a true if-match
2144
+ * overrides a false if-unmodified-since, and a failed condition is always 412, never 304.
2145
+ */
2146
+ private copyConditions;
2039
2147
  private put;
2040
2148
  private get;
2041
2149
  private list;
@@ -2047,8 +2155,21 @@ declare class S3API {
2047
2155
  private versioning;
2048
2156
  private removeObject;
2049
2157
  private conditions;
2050
- private validateChecksums;
2158
+ /**
2159
+ * The object bytes of a PutObject or UploadPart: an `aws-chunked` stream is decoded (the framing
2160
+ * and trailers are not part of the object), the decoded length and every supplied checksum are
2161
+ * verified, and the checksums to keep come back as the `x-amz-checksum-*` headers they were.
2162
+ */
2163
+ private payload;
2051
2164
  private bucketConfiguration;
2165
+ private corsRules;
2166
+ /**
2167
+ * The browser preflight (`OPTIONS` on a bucket or object URL). S3 refuses one it cannot match
2168
+ * with 403 AccessForbidden "CORSResponse: ..." and no `Access-Control-*` headers.
2169
+ */
2170
+ private preflight;
2171
+ /** A matching rule adds the `Access-Control-*` headers to an actual cross-origin response. */
2172
+ private withCors;
2052
2173
  private objectTagging;
2053
2174
  private listParts;
2054
2175
  private listUploads;
@@ -2067,6 +2188,11 @@ type S3RuntimeOptions = {
2067
2188
  buckets?: readonly string[];
2068
2189
  objects?: readonly S3SeedObject[];
2069
2190
  credentials?: Readonly<Record<string, string>>;
2191
+ /**
2192
+ * Base hosts for virtual-hosted-style addressing: `Host: <bucket>.<base>` names the bucket and
2193
+ * the path is the key. Default `["localhost"]`; `[]` leaves every request path-style.
2194
+ */
2195
+ virtualHosts?: readonly string[];
2070
2196
  webhooks?: {
2071
2197
  endpoints?: WebhookEndpoint[];
2072
2198
  retryDelaysMs?: readonly number[];
@@ -2081,6 +2207,8 @@ declare const DEFAULT_PORT = 8812;
2081
2207
  type S3ServerOptions = S3RuntimeOptions & {
2082
2208
  port?: number;
2083
2209
  host?: string;
2210
+ /** Largest request body accepted. Default 5 GiB, the most S3 takes in one PUT or part. */
2211
+ maxBodyBytes?: number;
2084
2212
  };
2085
2213
  declare const createServer: (options?: S3ServerOptions) => Promise<Listening & {
2086
2214
  runtime: S3Runtime;
package/dist/server.js CHANGED
@@ -2,8 +2,8 @@ import {
2
2
  DEFAULT_PORT,
3
3
  createServer,
4
4
  serveTarget
5
- } from "./chunk-PZ2JLZAI.js";
6
- import "./chunk-PCW23MUG.js";
5
+ } from "./chunk-2B5OVZSH.js";
6
+ import "./chunk-NNRVXV6X.js";
7
7
  export {
8
8
  DEFAULT_PORT,
9
9
  createServer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crvouga/mockingbird-service-s3",
3
- "version": "3.6.0",
3
+ "version": "3.8.0",
4
4
  "description": "Stateful Amazon S3 emulator with binary objects, listing, copies, multipart uploads, presigned URLs, and canonical XML errors.",
5
5
  "license": "MIT",
6
6
  "type": "module",