rez_core 5.0.138 → 5.0.140

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "5.0.138",
3
+ "version": "5.0.140",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -13,9 +13,9 @@ export class BullConfigService implements SharedBullConfigurationFactory {
13
13
  createSharedConfiguration(): BullModuleOptions {
14
14
  return {
15
15
  redis: {
16
- host: this.configService.get<string>('REDIS_HOST'),
17
- port: this.configService.get<number>('REDIS_PORT'),
18
- password: this.configService.get<string>('REDIS_PASSWORD'),
16
+ host: this.configService.get<string>('REDIS_HOST', '43.205.35.45'),
17
+ port: this.configService.get<number>('REDIS_PORT', 6379),
18
+ password: this.configService.get<string>('REDIS_PASSWORD','Rezolut123'),
19
19
  db: this.configService.get<number>('REDIS_DB', 0),
20
20
  // Enable offline queue to handle Redis disconnections
21
21
  enableOfflineQueue: true,
@@ -157,6 +157,7 @@ export class MediaDataService extends EntityServiceImpl {
157
157
  Bucket: this.bucketName,
158
158
  Key: mediaData.media_url,
159
159
  Expires: Number(expiresIn) || 60 * 5,
160
+ ResponseContentDisposition: 'inline',
160
161
  });
161
162
  return {
162
163
  signedUrl,
@@ -171,6 +172,52 @@ export class MediaDataService extends EntityServiceImpl {
171
172
  }
172
173
 
173
174
  // media-data.service.ts
175
+ // async getMediaInlineUrl(id: number, loggedInUser, expiresIn?: number) {
176
+ // try {
177
+ // const entityData = await this.getEntityData(
178
+ // ENTITYTYPE_MEDIA,
179
+ // id,
180
+ // loggedInUser,
181
+ // );
182
+ // const mediaData = entityData as MediaData;
183
+ // let fileSize: number | undefined;
184
+ // if (this.bucketName) {
185
+ // const head = await this.s3
186
+ // .headObject({
187
+ // Bucket: this.bucketName,
188
+ // Key: mediaData.media_url,
189
+ // })
190
+ // .promise();
191
+ // fileSize = head.ContentLength;
192
+ // }
193
+
194
+ // if (!mediaData) {
195
+ // throw new Error('Media not found');
196
+ // }
197
+
198
+ // const signedUrl = await this.s3.getSignedUrlPromise('getObject', {
199
+ // Bucket: this.bucketName,
200
+ // Key: mediaData.media_url,
201
+ // Expires: Number(expiresIn) || 60 * 5,
202
+ // ResponseContentDisposition: 'inline',
203
+ // ResponseContentType: this.getContentType(
204
+ // mediaData.file_name.split('.').pop() || '',
205
+ // ),
206
+ // });
207
+
208
+ // return {
209
+ // signedUrl,
210
+ // fileName: mediaData.file_name,
211
+ // id: mediaData.id,
212
+ // size: fileSize,
213
+ // uploadedDate: mediaData.created_date,
214
+ // };
215
+ // } catch (error) {
216
+ // console.error('Error generating inline URL:', error);
217
+ // throw new Error('Failed to generate inline URL');
218
+ // }
219
+ // }
220
+
174
221
  async getMediaInlineUrl(id: number, loggedInUser, expiresIn?: number) {
175
222
  try {
176
223
  const entityData = await this.getEntityData(
@@ -180,6 +227,13 @@ export class MediaDataService extends EntityServiceImpl {
180
227
  );
181
228
  const mediaData = entityData as MediaData;
182
229
  let fileSize: number | undefined;
230
+
231
+ if (!mediaData) {
232
+ throw new Error('Media not found');
233
+ }
234
+
235
+ const ext = mediaData.file_name.split('.').pop()?.toLowerCase() || '';
236
+
183
237
  if (this.bucketName) {
184
238
  const head = await this.s3
185
239
  .headObject({
@@ -190,22 +244,23 @@ export class MediaDataService extends EntityServiceImpl {
190
244
  fileSize = head.ContentLength;
191
245
  }
192
246
 
193
- if (!mediaData) {
194
- throw new Error('Media not found');
195
- }
196
-
197
247
  const signedUrl = await this.s3.getSignedUrlPromise('getObject', {
198
248
  Bucket: this.bucketName,
199
249
  Key: mediaData.media_url,
200
250
  Expires: Number(expiresIn) || 60 * 5,
201
251
  ResponseContentDisposition: 'inline',
202
- ResponseContentType: this.getContentType(
203
- mediaData.file_name.split('.').pop() || '',
204
- ),
252
+ ResponseContentType: this.getContentType(ext),
205
253
  });
206
254
 
255
+ let previewUrl = signedUrl;
256
+ if (ext === 'doc' || ext === 'docx') {
257
+ previewUrl =
258
+ `https://view.officeapps.live.com/op/embed.aspx?src=` +
259
+ encodeURIComponent(signedUrl);
260
+ }
261
+
207
262
  return {
208
- signedUrl,
263
+ signedUrl: previewUrl,
209
264
  fileName: mediaData.file_name,
210
265
  id: mediaData.id,
211
266
  size: fileSize,
@@ -17,9 +17,6 @@ DEFAULT_OTP: '123456'
17
17
  PROFILE: 'UAT'
18
18
  DEFAULT_ADMIN: 'ADMIN'
19
19
  TOKEN_EXPIRY: 1
20
- REDIS_HOST: '43.205.35.45'
21
- REDIS_PORT: 6379
22
- REDIS_PASSWORD: 'Rezolut123'
23
20
  AWS:
24
21
  S3:
25
22
  AWS_ACCESS_KEY_ID: 'AKIAYYKIBDDSQF3KILGE'