triangle-utils 1.4.98 → 1.4.99

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.
@@ -52,9 +52,11 @@ export declare class UtilsS3 {
52
52
  compile?: boolean;
53
53
  }): Promise<string[]>;
54
54
  create(s3_id: string, content: string | Buffer | Readable, options?: {
55
- content_type?: string;
55
+ content_type_id?: string;
56
56
  }): Promise<import("@aws-sdk/client-s3").PutObjectCommandOutput | undefined>;
57
57
  delete(s3_id: string): Promise<void>;
58
58
  get_download_url(s3_id: string): Promise<string | undefined>;
59
- get_upload_url(s3_id: string): Promise<string | undefined>;
59
+ get_upload_url(s3_id: string, options?: {
60
+ content_type_id?: string;
61
+ }): Promise<string | undefined>;
60
62
  }
@@ -131,7 +131,7 @@ export class UtilsS3 {
131
131
  }
132
132
  }
133
133
  async create(s3_id, content, options = {}) {
134
- const content_type = options.content_type !== undefined ? options.content_type : undefined;
134
+ const content_type_id = options.content_type_id !== undefined ? options.content_type_id : undefined;
135
135
  const headers = await this.get_headers(s3_id);
136
136
  if (headers !== undefined) {
137
137
  return undefined;
@@ -143,7 +143,7 @@ export class UtilsS3 {
143
143
  return await this.s3.putObject({
144
144
  ...s3_input,
145
145
  Body: content,
146
- ContentType: content_type
146
+ ContentType: content_type_id
147
147
  });
148
148
  }
149
149
  async delete(s3_id) {
@@ -166,12 +166,16 @@ export class UtilsS3 {
166
166
  const url = await getSignedUrl(this.s3, command);
167
167
  return url;
168
168
  }
169
- async get_upload_url(s3_id) {
169
+ async get_upload_url(s3_id, options = {}) {
170
+ const content_type_id = options.content_type_id !== undefined ? options.content_type_id : undefined;
170
171
  const s3_input = get_s3_input(s3_id);
171
172
  if (s3_input === undefined) {
172
173
  return undefined;
173
174
  }
174
- const command = new PutObjectCommand(s3_input);
175
+ const command = new PutObjectCommand({
176
+ ...s3_input,
177
+ ContentType: content_type_id
178
+ });
175
179
  const url = await getSignedUrl(this.s3, command);
176
180
  return url;
177
181
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-utils",
3
- "version": "1.4.98",
3
+ "version": "1.4.99",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
package/src/UtilsS3.ts CHANGED
@@ -142,9 +142,9 @@ export class UtilsS3 {
142
142
  }
143
143
 
144
144
  async create(s3_id : string, content : string | Buffer | Readable, options : {
145
- content_type? : string
145
+ content_type_id? : string
146
146
  } = {}) {
147
- const content_type = options.content_type !== undefined ? options.content_type : undefined
147
+ const content_type_id = options.content_type_id !== undefined ? options.content_type_id : undefined
148
148
 
149
149
  const headers = await this.get_headers(s3_id)
150
150
  if (headers !== undefined) {
@@ -157,7 +157,7 @@ export class UtilsS3 {
157
157
  return await this.s3.putObject({
158
158
  ...s3_input,
159
159
  Body : content,
160
- ContentType : content_type
160
+ ContentType : content_type_id
161
161
  })
162
162
  }
163
163
 
@@ -183,12 +183,18 @@ export class UtilsS3 {
183
183
  return url
184
184
  }
185
185
 
186
- async get_upload_url(s3_id : string) : Promise<string | undefined> {
186
+ async get_upload_url(s3_id : string, options : {
187
+ content_type_id? : string
188
+ } = {}) : Promise<string | undefined> {
189
+ const content_type_id = options.content_type_id !== undefined ? options.content_type_id : undefined
187
190
  const s3_input = get_s3_input(s3_id)
188
191
  if (s3_input === undefined) {
189
192
  return undefined
190
193
  }
191
- const command = new PutObjectCommand(s3_input)
194
+ const command = new PutObjectCommand({
195
+ ...s3_input,
196
+ ContentType : content_type_id
197
+ })
192
198
  const url = await getSignedUrl(this.s3, command)
193
199
  return url
194
200
  }