drapcode-utility 2.6.6-preview → 2.6.6

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.
@@ -132,6 +132,7 @@ const drapcodeEncryptDecrypt = async (data, encrypt) => {
132
132
  };
133
133
  exports.drapcodeEncryptDecrypt = drapcodeEncryptDecrypt;
134
134
  const cryptFile = async (filePath, encryption, decrypt) => {
135
+ console.log("encryption cryptFile:>> ", encryption);
135
136
  const data = await (0, file_1.processFileEncryptionDecryption)(filePath, encryption, decrypt);
136
137
  return data;
137
138
  };
@@ -33,6 +33,7 @@ const createS3Client = (awsConfig) => {
33
33
  exports.createS3Client = createS3Client;
34
34
  const fileUploadToS3 = async (files, s3Client, s3Config, publicS3Client, publicS3Config, isGenerateIcons, encryption, options = {}, encrypted = false) => {
35
35
  if (Array.isArray(files)) {
36
+ console.log("Multiple file");
36
37
  const fileOptions = [];
37
38
  const s3Key = s3Config.key;
38
39
  for (const file of files) {
@@ -48,17 +49,21 @@ const fileUploadToS3 = async (files, s3Client, s3Config, publicS3Client, publicS
48
49
  return fileOptions;
49
50
  }
50
51
  else {
52
+ console.log("Single file");
51
53
  const fileSlug = slugifyFileName(files.originalname);
52
54
  if (s3Config.append) {
53
55
  s3Config.key = `${s3Config.key}/${(0, uuid_1.v4)()}/${fileSlug}`;
54
56
  }
57
+ console.log("encryption :>> ", encryption);
55
58
  return await processFileUploadToS3(files, s3Client, s3Config, publicS3Client, publicS3Config, isGenerateIcons, encryption, options, encrypted);
56
59
  }
57
60
  };
58
61
  exports.fileUploadToS3 = fileUploadToS3;
59
62
  const processFileUploadToS3 = async (file, s3Client, s3Config, publicS3Client, publicS3Config, isGenerateIcons, encryption, options = {}, encrypt = false) => {
60
63
  try {
64
+ console.log("encrypt :>> ", encrypt);
61
65
  const contentType = mime_types_1.default.lookup(file.originalname) || "";
66
+ console.log("s3Config :>> ", s3Config);
62
67
  const { acl, key, bucket } = s3Config;
63
68
  let params = null;
64
69
  let encryptedFilePath = null;
@@ -83,6 +88,8 @@ const processFileUploadToS3 = async (file, s3Client, s3Config, publicS3Client, p
83
88
  ...options,
84
89
  };
85
90
  }
91
+ console.log("encryptedFilePath :>> ", encryptedFilePath);
92
+ console.log("params :>> ", params);
86
93
  const parallelUploads3 = new lib_storage_1.Upload({ client: s3Client, params });
87
94
  const data = await parallelUploads3.done();
88
95
  const { smallIcon, mediumIcon, largeIcon } = await handleIconUpload(file, contentType, publicS3Client, publicS3Config, isGenerateIcons, key, options);
@@ -102,7 +102,7 @@ export declare const evaluateExpression: (expression: string, data: any, user: a
102
102
  export declare const evaluateCurrency: (formatType: string, subject: number | string | any, currency: string, position: string, maxFraction: number, user?: any, tenant?: any) => string;
103
103
  export declare const evaluateJSLogic: (expression: string, data: any, user: any, envConstants: any) => any;
104
104
  export declare const formatDate: (formatType: string, datentime: any, timezone: string, unixType: any, offset?: boolean) => string;
105
- export declare const dateDifference: (formatType: string, datentime1: any, datentime2: any, timezone: string, dateFormat: string) => string;
105
+ export declare const dateDifference: (formatType: string, datentime1: any, datentime2: any, timezone: string) => string;
106
106
  export declare const mergeObjects: (arrayOfObjects: any, data?: any, user?: any, tenant?: any, userSetting?: any, subTenant?: any, sessionValue?: any, envConstants?: any, sessionFormValue?: any, dataTransferObject?: any, localStorageValue?: any, cookiesValue?: any) => any;
107
107
  export declare const getFindQuery: (item: any, customKey?: string) => {
108
108
  [x: string]: any;
@@ -333,6 +333,7 @@ const replaceDataValueIntoExpression = (expression, data, user, tenant, userSett
333
333
  const contentList = expression
334
334
  .match(/{{(.*?)}}/g)
335
335
  ?.map((b) => b.replace(/{{(.*?)}}/g, "$1"));
336
+ console.log("1 replaceDataValueIntoExpression");
336
337
  contentList?.forEach((prop) => {
337
338
  const needle = `{{${prop}}}`;
338
339
  prop = voca_1.default.trim(prop);
@@ -1113,15 +1114,15 @@ const formatDate = function (formatType, datentime, timezone, unixType, offset =
1113
1114
  return datentime ? formatDateNTime.format(formatType) : "";
1114
1115
  };
1115
1116
  exports.formatDate = formatDate;
1116
- const dateDifference = (formatType, datentime1, datentime2, timezone, dateFormat) => {
1117
+ const dateDifference = (formatType, datentime1, datentime2, timezone) => {
1117
1118
  let result = "";
1118
1119
  const dateExist = !datentime1 || !datentime2;
1119
1120
  const firstDate = datentime1 === "CURRENT_DATE_TIME"
1120
1121
  ? (0, moment_1.default)().utcOffset(timezone)
1121
- : (0, moment_1.default)(datentime1, dateFormat).utcOffset(timezone);
1122
+ : (0, moment_1.default)(datentime1).utcOffset(timezone);
1122
1123
  const secondDate = datentime2 === "CURRENT_DATE_TIME"
1123
1124
  ? (0, moment_1.default)().utcOffset(timezone)
1124
- : (0, moment_1.default)(datentime2, dateFormat).utcOffset(timezone);
1125
+ : (0, moment_1.default)(datentime2).utcOffset(timezone);
1125
1126
  const patterns = formatType.split(",");
1126
1127
  patterns.forEach((format, i) => {
1127
1128
  const diff = firstDate.diff(secondDate, format);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "drapcode-utility",
3
- "version": "2.6.6-preview",
4
- "description": "",
3
+ "version": "2.6.6",
4
+ "description": "DrapCode Utility",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
7
7
  "files": [
@@ -42,9 +42,9 @@
42
42
  "axios": "^1.1.2",
43
43
  "date-fns": "^4.1.0",
44
44
  "dompurify": "^3.1.7",
45
- "drapcode-constant": "^1.8.0",
46
- "drapcode-logger": "^1.3.5",
47
- "drapcode-redis": "^1.3.5",
45
+ "drapcode-constant": "^2.0.8",
46
+ "drapcode-logger": "^1.3.6",
47
+ "drapcode-redis": "^1.5.5",
48
48
  "exiftool-vendored": "^28.2.1",
49
49
  "express": "^4.17.1",
50
50
  "gm": "^1.25.0",