@empiricalrun/r2-uploader 0.3.3 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @empiricalrun/r2-uploader
2
2
 
3
+ ## 0.3.4
4
+
5
+ ### Patch Changes
6
+
7
+ - ff77220: chore: return empty list when fetching a file that does not exist
8
+
3
9
  ## 0.3.3
4
10
 
5
11
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,eAAO,MAAM,UAAU,WAAkB,aAAa;;;;gBAsBrD,CAAC"}
1
+ {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,eAAO,MAAM,UAAU,WAAkB,aAAa;;;;gBA2BrD,CAAC"}
package/dist/fetch.js CHANGED
@@ -17,12 +17,18 @@ const fetchFiles = async (config) => {
17
17
  };
18
18
  const cmd = new client_s3_1.ListObjectsV2Command(params);
19
19
  const data = await S3.send(cmd);
20
- return data.Contents?.map((c) => {
21
- return {
22
- key: c.Key,
23
- lastModified: c.LastModified,
24
- size: c.Size,
25
- };
26
- });
20
+ const { KeyCount, Contents } = data;
21
+ if (KeyCount === 0) {
22
+ return [];
23
+ }
24
+ else {
25
+ return Contents?.map((c) => {
26
+ return {
27
+ key: c.Key,
28
+ lastModified: c.LastModified,
29
+ size: c.Size,
30
+ };
31
+ });
32
+ }
27
33
  };
28
34
  exports.fetchFiles = fetchFiles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/r2-uploader",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"