lean-s3 0.9.0 → 0.9.3

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.
Files changed (2) hide show
  1. package/dist/index.mjs +10 -2
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -320,7 +320,7 @@ const kSignedRequest = Symbol("kSignedRequest");
320
320
  const kGetEffectiveParams = Symbol("kGetEffectiveParams");
321
321
  const xmlParser = new XMLParser({
322
322
  ignoreAttributes: true,
323
- isArray: (_, jPath) => jPath === "ListMultipartUploadsResult.Upload" || jPath === "ListBucketResult.Contents" || jPath === "ListPartsResult.Part" || jPath === "DeleteResult.Deleted" || jPath === "DeleteResult.Error"
323
+ isArray: (_, jPath) => jPath === "ListMultipartUploadsResult.Upload" || jPath === "ListBucketResult.Contents" || jPath === "ListPartsResult.Part" || jPath === "DeleteResult.Deleted" || jPath === "DeleteResult.Error" || jPath === "CORSConfiguration.CORSRule" || jPath === "CORSConfiguration.CORSRule.AllowedMethod" || jPath === "CORSConfiguration.CORSRule.AllowedOrigin" || jPath === "CORSConfiguration.CORSRule.AllowedHeader" || jPath === "CORSConfiguration.CORSRule.ExposeHeader"
324
324
  });
325
325
  const xmlBuilder = new XMLBuilder({
326
326
  attributeNamePrefix: "$",
@@ -780,6 +780,7 @@ var S3Client = class {
780
780
  const body = xmlBuilder.build({ CORSConfiguration: { CORSRule: rules.map((r) => ({
781
781
  AllowedOrigin: r.allowedOrigins,
782
782
  AllowedMethod: r.allowedMethods,
783
+ AllowedHeader: r.allowedHeaders,
783
784
  ExposeHeader: r.exposeHeaders,
784
785
  ID: r.id ?? void 0,
785
786
  MaxAgeSeconds: r.maxAgeSeconds ?? void 0
@@ -801,7 +802,14 @@ var S3Client = class {
801
802
  response.body.dump();
802
803
  throw fromStatusCode(response.statusCode, "");
803
804
  }
804
- throw new Error("Not implemented");
805
+ return { rules: ((ensureParsedXml(await response.body.text()).CORSConfiguration ?? {}).CORSRule ?? []).filter(Boolean).map((r) => ({
806
+ allowedMethods: r.AllowedMethod ?? [],
807
+ allowedOrigins: r.AllowedOrigin ?? [],
808
+ allowedHeaders: r.AllowedHeader ? r.AllowedHeader : void 0,
809
+ exposeHeaders: r.ExposeHeader ? r.ExposeHeader : void 0,
810
+ id: r.ID ?? void 0,
811
+ maxAgeSeconds: typeof r.MaxAgeSeconds !== "undefined" && r.MaxAgeSeconds !== null ? Number(r.MaxAgeSeconds) : void 0
812
+ })) };
805
813
  }
806
814
  /**
807
815
  * @remarks Uses [`DeleteBucketCors`](https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketCors.html).
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "lean-s3",
3
3
  "author": "Niklas Mollenhauer",
4
4
  "license": "MIT",
5
- "version": "0.9.0",
5
+ "version": "0.9.3",
6
6
  "description": "A server-side S3 API for the regular user.",
7
7
  "keywords": [
8
8
  "s3",
@@ -47,16 +47,16 @@
47
47
  "undici": "^7.16.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@biomejs/biome": "2.3.6",
50
+ "@biomejs/biome": "2.3.7",
51
51
  "@testcontainers/localstack": "^11.8.1",
52
52
  "@testcontainers/minio": "^11.8.1",
53
53
  "@testcontainers/s3mock": "^11.8.1",
54
54
  "@types/node": "^24.10.1",
55
- "@typescript/native-preview": "^7.0.0-dev.20251118.1",
55
+ "@typescript/native-preview": "^7.0.0-dev.20251125.1",
56
56
  "expect": "^30.2.0",
57
57
  "lefthook": "^2.0.4",
58
58
  "testcontainers": "^11.8.1",
59
- "tsdown": "^0.16.5",
59
+ "tsdown": "^0.16.7",
60
60
  "tsx": "^4.20.6",
61
61
  "typedoc": "^0.28.14"
62
62
  },