triangle-utils 1.4.115 → 1.4.116

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.
@@ -1,7 +1,14 @@
1
+ import { S3 } from "@aws-sdk/client-s3";
1
2
  import { Readable } from "stream";
3
+ interface S3Input {
4
+ Bucket: string;
5
+ Key: string;
6
+ }
7
+ export declare function get_s3_input(s3_id: string): S3Input | undefined;
2
8
  export declare class UtilsS3 {
3
9
  private readonly s3;
4
10
  constructor(region: string);
11
+ get_client(): Promise<S3>;
5
12
  get_headers(s3_id: string): Promise<{
6
13
  DeleteMarker?: boolean | undefined;
7
14
  AcceptRanges?: string | undefined;
@@ -68,3 +75,4 @@ export declare class UtilsS3 {
68
75
  content_type_id?: string;
69
76
  }): Promise<string | undefined>;
70
77
  }
78
+ export {};
@@ -2,7 +2,7 @@ import { S3, NoSuchKey, GetObjectCommand, PutObjectCommand } from "@aws-sdk/clie
2
2
  import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
3
3
  import { Upload } from "@aws-sdk/lib-storage";
4
4
  import { Readable } from "stream";
5
- function get_s3_input(s3_id) {
5
+ export function get_s3_input(s3_id) {
6
6
  const [bucket, path] = (s3_id.match(/^s3\:\/\/([^\/]+)\/([^$]+)$/) || []).slice(1, 3);
7
7
  if (bucket === undefined || path === undefined) {
8
8
  return undefined;
@@ -14,6 +14,9 @@ export class UtilsS3 {
14
14
  constructor(region) {
15
15
  this.s3 = new S3({ region: region });
16
16
  }
17
+ async get_client() {
18
+ return this.s3;
19
+ }
17
20
  async get_headers(s3_id) {
18
21
  const s3_input = get_s3_input(s3_id);
19
22
  if (s3_input === undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-utils",
3
- "version": "1.4.115",
3
+ "version": "1.4.116",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
package/src/UtilsS3.ts CHANGED
@@ -8,7 +8,7 @@ interface S3Input {
8
8
  Key : string
9
9
  }
10
10
 
11
- function get_s3_input(s3_id : string) : S3Input | undefined {
11
+ export function get_s3_input(s3_id : string) : S3Input | undefined {
12
12
  const [bucket, path] = (s3_id.match(/^s3\:\/\/([^\/]+)\/([^$]+)$/) || []).slice(1, 3)
13
13
  if (bucket === undefined || path === undefined) {
14
14
  return undefined
@@ -24,6 +24,10 @@ export class UtilsS3 {
24
24
  this.s3 = new S3({ region : region })
25
25
  }
26
26
 
27
+ async get_client() {
28
+ return this.s3
29
+ }
30
+
27
31
  async get_headers(s3_id : string) {
28
32
  const s3_input = get_s3_input(s3_id)
29
33
  if (s3_input === undefined) {