@empiricalrun/r2-uploader 0.3.9 → 0.3.10

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.10
4
+
5
+ ### Patch Changes
6
+
7
+ - 9f33a7a: chore: fetch r2 files with suffix, add created_at to summary
8
+
3
9
  ## 0.3.9
4
10
 
5
11
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,eAAO,MAAM,UAAU,GAAU,QAAQ,aAAa;;;;;;;;;;IA8CrD,CAAC"}
1
+ {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,eAAO,MAAM,UAAU,GAAU,QAAQ,aAAa;;;;;;;;;;IAmDrD,CAAC"}
package/dist/fetch.js CHANGED
@@ -15,6 +15,7 @@ const fetchFiles = async (config) => {
15
15
  const params = {
16
16
  Bucket: config.bucket,
17
17
  Prefix: config.prefix,
18
+ MaxKeys: 20_000,
18
19
  };
19
20
  const cmd = new client_s3_1.ListObjectsV2Command(params);
20
21
  const data = await S3.send(cmd);
@@ -22,8 +23,11 @@ const fetchFiles = async (config) => {
22
23
  if (KeyCount === 0) {
23
24
  return [];
24
25
  }
26
+ const filteredContents = config.suffix
27
+ ? Contents?.filter((c) => c.Key.endsWith(config.suffix)) || []
28
+ : Contents || [];
25
29
  if (config.withSignedUrl) {
26
- return Promise.all((Contents || []).map(async (c) => {
30
+ return Promise.all(filteredContents.map(async (c) => {
27
31
  const key = c.Key;
28
32
  const getObjectCmd = new client_s3_1.GetObjectCommand({
29
33
  Bucket: config.bucket,
@@ -39,7 +43,7 @@ const fetchFiles = async (config) => {
39
43
  }));
40
44
  }
41
45
  else {
42
- return (Contents || []).map((c) => {
46
+ return filteredContents.map((c) => {
43
47
  return {
44
48
  key: c.Key,
45
49
  lastModified: c.LastModified,
package/dist/types.d.ts CHANGED
@@ -23,6 +23,7 @@ export interface R2UploadBufferConfig extends R2BaseConfig {
23
23
  export interface R2FetchConfig extends R2BaseConfig {
24
24
  prefix: string;
25
25
  withSignedUrl?: boolean;
26
+ suffix?: string;
26
27
  }
27
28
  export interface R2DeleteConfig extends R2BaseConfig {
28
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,UAAU,YAAY;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACpE;AAED,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAClE;AAED,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,cAAe,SAAQ,YAAY;CAAG;AAEvD,MAAM,WAAW,OAAO;IACtB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,UAAU,YAAY;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACpE;AAED,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAClE;AAED,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAe,SAAQ,YAAY;CAAG;AAEvD,MAAM,WAAW,OAAO;IACtB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../src/upload/buffer.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEzD,eAAO,MAAM,iBAAiB,GAAU,QAAQ,oBAAoB,qBA6FnE,CAAC"}
1
+ {"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../src/upload/buffer.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEzD,eAAO,MAAM,iBAAiB,GAAU,QAAQ,oBAAoB,qBA+FnE,CAAC"}
@@ -71,6 +71,7 @@ const uploadFileBuffers = async (config) => {
71
71
  if (err) {
72
72
  const error = err;
73
73
  logger_1.logger.warn("Upload retry attempt:", i, ":", file.fileName);
74
+ // TODO: r2-uploader Response status: undefined
74
75
  logger_1.logger.warn("Response status:", error.$response?.statusCode);
75
76
  }
76
77
  },
@@ -79,6 +80,7 @@ const uploadFileBuffers = async (config) => {
79
80
  catch (err) {
80
81
  const error = err;
81
82
  logger_1.logger.error(`R2 Error - ${file.fileName} \nError: ${error}`);
83
+ // TODO: r2-uploader Upload response undefined with status undefined
82
84
  logger_1.logger.error("Upload response", error.$response, "with status", error.$metadata.httpStatusCode);
83
85
  }
84
86
  return;
@@ -0,0 +1,16 @@
1
+ import libraryConfig from "../eslint-config/library.mjs";
2
+ import tsParser from "@typescript-eslint/parser";
3
+
4
+ export default [
5
+ ...libraryConfig,
6
+ {
7
+ files: ["src/**/*.ts", "src/**/*.tsx"],
8
+ languageOptions: {
9
+ parser: tsParser,
10
+ parserOptions: {
11
+ project: "./tsconfig.lint.json",
12
+ tsconfigRootDir: import.meta.dirname,
13
+ },
14
+ },
15
+ },
16
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/r2-uploader",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"