@gitsense/gsc-utils 0.2.23 → 0.2.24
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/dist/gsc-utils.cjs.js +25 -17
- package/dist/gsc-utils.esm.js +25 -17
- package/package.json +1 -1
- package/src/GitSenseChatUtils.js +13 -5
package/dist/gsc-utils.cjs.js
CHANGED
|
@@ -12071,7 +12071,7 @@ var LLMUtils$1 = {
|
|
|
12071
12071
|
* @param {string} dateString - Date string in format "YYYY-MM-DD(T| )HH:mm:ss.SSS"
|
|
12072
12072
|
* @returns {string} Date string with 'Z' timezone indicator if not present
|
|
12073
12073
|
*/
|
|
12074
|
-
function normalizeDateTime(dateString) {
|
|
12074
|
+
function normalizeDateTime$1(dateString) {
|
|
12075
12075
|
return dateString.includes('Z') ? dateString : dateString + 'Z';
|
|
12076
12076
|
}
|
|
12077
12077
|
|
|
@@ -12080,9 +12080,9 @@ function normalizeDateTime(dateString) {
|
|
|
12080
12080
|
* @param {string} dateString - Date string to compare against current time
|
|
12081
12081
|
* @returns {number} Difference in seconds
|
|
12082
12082
|
*/
|
|
12083
|
-
function getTimeDifference(dateString) {
|
|
12083
|
+
function getTimeDifference$1(dateString) {
|
|
12084
12084
|
const now = new Date();
|
|
12085
|
-
const date = new Date(normalizeDateTime(dateString));
|
|
12085
|
+
const date = new Date(normalizeDateTime$1(dateString));
|
|
12086
12086
|
return Math.floor((now - date) / 1000);
|
|
12087
12087
|
}
|
|
12088
12088
|
|
|
@@ -12091,7 +12091,7 @@ function getTimeDifference(dateString) {
|
|
|
12091
12091
|
* @param {number} diff - Time difference in seconds
|
|
12092
12092
|
* @returns {string} Formatted string (e.g., "5s ago", "2m ago", "3h ago", "2d ago")
|
|
12093
12093
|
*/
|
|
12094
|
-
function formatTimeDifference(diff) {
|
|
12094
|
+
function formatTimeDifference$1(diff) {
|
|
12095
12095
|
if (diff < 60) {
|
|
12096
12096
|
return `${diff}s ago`;
|
|
12097
12097
|
} else if (diff < 3600) {
|
|
@@ -12117,8 +12117,8 @@ function formatAge$1(dateString) {
|
|
|
12117
12117
|
}
|
|
12118
12118
|
|
|
12119
12119
|
try {
|
|
12120
|
-
const diff = getTimeDifference(dateString);
|
|
12121
|
-
return formatTimeDifference(diff);
|
|
12120
|
+
const diff = getTimeDifference$1(dateString);
|
|
12121
|
+
return formatTimeDifference$1(diff);
|
|
12122
12122
|
} catch (error) {
|
|
12123
12123
|
console.error('Error formatting date:', error);
|
|
12124
12124
|
return 'Invalid date';
|
|
@@ -12136,7 +12136,7 @@ function isValidDateString$1(dateString) {
|
|
|
12136
12136
|
const pattern = /^\d{4}-\d{2}-\d{2}(T| )\d{2}:\d{2}:\d{2}\.\d{3}Z?$/;
|
|
12137
12137
|
if (!pattern.test(dateString)) return false;
|
|
12138
12138
|
|
|
12139
|
-
const date = new Date(normalizeDateTime(dateString));
|
|
12139
|
+
const date = new Date(normalizeDateTime$1(dateString));
|
|
12140
12140
|
return date instanceof Date && !isNaN(date);
|
|
12141
12141
|
}
|
|
12142
12142
|
|
|
@@ -12151,8 +12151,8 @@ function compareDates$1(dateA, dateB) {
|
|
|
12151
12151
|
throw new Error(`Invalid date string format. A: ${dateA} B: ${dateB})`);
|
|
12152
12152
|
}
|
|
12153
12153
|
|
|
12154
|
-
const timeA = new Date(normalizeDateTime(dateA)).getTime();
|
|
12155
|
-
const timeB = new Date(normalizeDateTime(dateB)).getTime();
|
|
12154
|
+
const timeA = new Date(normalizeDateTime$1(dateA)).getTime();
|
|
12155
|
+
const timeB = new Date(normalizeDateTime$1(dateB)).getTime();
|
|
12156
12156
|
|
|
12157
12157
|
if (timeA < timeB) return -1;
|
|
12158
12158
|
if (timeA > timeB) return 1;
|
|
@@ -12163,9 +12163,9 @@ var DateUtils$1 = {
|
|
|
12163
12163
|
formatAge: formatAge$1,
|
|
12164
12164
|
isValidDateString: isValidDateString$1,
|
|
12165
12165
|
compareDates: compareDates$1,
|
|
12166
|
-
normalizeDateTime,
|
|
12167
|
-
getTimeDifference,
|
|
12168
|
-
formatTimeDifference
|
|
12166
|
+
normalizeDateTime: normalizeDateTime$1,
|
|
12167
|
+
getTimeDifference: getTimeDifference$1,
|
|
12168
|
+
formatTimeDifference: formatTimeDifference$1
|
|
12169
12169
|
};
|
|
12170
12170
|
|
|
12171
12171
|
/**
|
|
@@ -12445,6 +12445,15 @@ const FormatterUtils = FormatterUtils$1;
|
|
|
12445
12445
|
const ConfigUtils = ConfigUtils$1;
|
|
12446
12446
|
const EnvUtils = EnvUtils$1;
|
|
12447
12447
|
|
|
12448
|
+
const {
|
|
12449
|
+
formatAge,
|
|
12450
|
+
isValidDateString,
|
|
12451
|
+
compareDates,
|
|
12452
|
+
normalizeDateTime,
|
|
12453
|
+
getTimeDifference,
|
|
12454
|
+
formatTimeDifference
|
|
12455
|
+
} = DateUtils;
|
|
12456
|
+
|
|
12448
12457
|
const {
|
|
12449
12458
|
estimateTokens
|
|
12450
12459
|
} = LLMUtils;
|
|
@@ -12770,9 +12779,6 @@ var GitSenseChatUtils_1 = {
|
|
|
12770
12779
|
FormatterUtils,
|
|
12771
12780
|
|
|
12772
12781
|
// Date Utility Functions
|
|
12773
|
-
formatAge: DateUtils.formatAge,
|
|
12774
|
-
compareDates: DateUtils.compareDates,
|
|
12775
|
-
isValidDateString: DateUtils.isValidDateString,
|
|
12776
12782
|
|
|
12777
12783
|
// Main class
|
|
12778
12784
|
GitSenseChatUtils,
|
|
@@ -12868,13 +12874,15 @@ var GitSenseChatUtils_1 = {
|
|
|
12868
12874
|
|
|
12869
12875
|
// Date Utils
|
|
12870
12876
|
formatAge,
|
|
12871
|
-
compareDates,
|
|
12872
12877
|
isValidDateString,
|
|
12878
|
+
compareDates,
|
|
12879
|
+
normalizeDateTime,
|
|
12880
|
+
getTimeDifference,
|
|
12881
|
+
formatTimeDifference,
|
|
12873
12882
|
|
|
12874
12883
|
// Formatter Utils
|
|
12875
12884
|
formatBytes,
|
|
12876
12885
|
formatTokens,
|
|
12877
|
-
formatOverviewTable,
|
|
12878
12886
|
|
|
12879
12887
|
// GS Tool Block
|
|
12880
12888
|
isToolBlock,
|
package/dist/gsc-utils.esm.js
CHANGED
|
@@ -12069,7 +12069,7 @@ var LLMUtils$1 = {
|
|
|
12069
12069
|
* @param {string} dateString - Date string in format "YYYY-MM-DD(T| )HH:mm:ss.SSS"
|
|
12070
12070
|
* @returns {string} Date string with 'Z' timezone indicator if not present
|
|
12071
12071
|
*/
|
|
12072
|
-
function normalizeDateTime(dateString) {
|
|
12072
|
+
function normalizeDateTime$1(dateString) {
|
|
12073
12073
|
return dateString.includes('Z') ? dateString : dateString + 'Z';
|
|
12074
12074
|
}
|
|
12075
12075
|
|
|
@@ -12078,9 +12078,9 @@ function normalizeDateTime(dateString) {
|
|
|
12078
12078
|
* @param {string} dateString - Date string to compare against current time
|
|
12079
12079
|
* @returns {number} Difference in seconds
|
|
12080
12080
|
*/
|
|
12081
|
-
function getTimeDifference(dateString) {
|
|
12081
|
+
function getTimeDifference$1(dateString) {
|
|
12082
12082
|
const now = new Date();
|
|
12083
|
-
const date = new Date(normalizeDateTime(dateString));
|
|
12083
|
+
const date = new Date(normalizeDateTime$1(dateString));
|
|
12084
12084
|
return Math.floor((now - date) / 1000);
|
|
12085
12085
|
}
|
|
12086
12086
|
|
|
@@ -12089,7 +12089,7 @@ function getTimeDifference(dateString) {
|
|
|
12089
12089
|
* @param {number} diff - Time difference in seconds
|
|
12090
12090
|
* @returns {string} Formatted string (e.g., "5s ago", "2m ago", "3h ago", "2d ago")
|
|
12091
12091
|
*/
|
|
12092
|
-
function formatTimeDifference(diff) {
|
|
12092
|
+
function formatTimeDifference$1(diff) {
|
|
12093
12093
|
if (diff < 60) {
|
|
12094
12094
|
return `${diff}s ago`;
|
|
12095
12095
|
} else if (diff < 3600) {
|
|
@@ -12115,8 +12115,8 @@ function formatAge$1(dateString) {
|
|
|
12115
12115
|
}
|
|
12116
12116
|
|
|
12117
12117
|
try {
|
|
12118
|
-
const diff = getTimeDifference(dateString);
|
|
12119
|
-
return formatTimeDifference(diff);
|
|
12118
|
+
const diff = getTimeDifference$1(dateString);
|
|
12119
|
+
return formatTimeDifference$1(diff);
|
|
12120
12120
|
} catch (error) {
|
|
12121
12121
|
console.error('Error formatting date:', error);
|
|
12122
12122
|
return 'Invalid date';
|
|
@@ -12134,7 +12134,7 @@ function isValidDateString$1(dateString) {
|
|
|
12134
12134
|
const pattern = /^\d{4}-\d{2}-\d{2}(T| )\d{2}:\d{2}:\d{2}\.\d{3}Z?$/;
|
|
12135
12135
|
if (!pattern.test(dateString)) return false;
|
|
12136
12136
|
|
|
12137
|
-
const date = new Date(normalizeDateTime(dateString));
|
|
12137
|
+
const date = new Date(normalizeDateTime$1(dateString));
|
|
12138
12138
|
return date instanceof Date && !isNaN(date);
|
|
12139
12139
|
}
|
|
12140
12140
|
|
|
@@ -12149,8 +12149,8 @@ function compareDates$1(dateA, dateB) {
|
|
|
12149
12149
|
throw new Error(`Invalid date string format. A: ${dateA} B: ${dateB})`);
|
|
12150
12150
|
}
|
|
12151
12151
|
|
|
12152
|
-
const timeA = new Date(normalizeDateTime(dateA)).getTime();
|
|
12153
|
-
const timeB = new Date(normalizeDateTime(dateB)).getTime();
|
|
12152
|
+
const timeA = new Date(normalizeDateTime$1(dateA)).getTime();
|
|
12153
|
+
const timeB = new Date(normalizeDateTime$1(dateB)).getTime();
|
|
12154
12154
|
|
|
12155
12155
|
if (timeA < timeB) return -1;
|
|
12156
12156
|
if (timeA > timeB) return 1;
|
|
@@ -12161,9 +12161,9 @@ var DateUtils$1 = {
|
|
|
12161
12161
|
formatAge: formatAge$1,
|
|
12162
12162
|
isValidDateString: isValidDateString$1,
|
|
12163
12163
|
compareDates: compareDates$1,
|
|
12164
|
-
normalizeDateTime,
|
|
12165
|
-
getTimeDifference,
|
|
12166
|
-
formatTimeDifference
|
|
12164
|
+
normalizeDateTime: normalizeDateTime$1,
|
|
12165
|
+
getTimeDifference: getTimeDifference$1,
|
|
12166
|
+
formatTimeDifference: formatTimeDifference$1
|
|
12167
12167
|
};
|
|
12168
12168
|
|
|
12169
12169
|
/**
|
|
@@ -12443,6 +12443,15 @@ const FormatterUtils = FormatterUtils$1;
|
|
|
12443
12443
|
const ConfigUtils = ConfigUtils$1;
|
|
12444
12444
|
const EnvUtils = EnvUtils$1;
|
|
12445
12445
|
|
|
12446
|
+
const {
|
|
12447
|
+
formatAge,
|
|
12448
|
+
isValidDateString,
|
|
12449
|
+
compareDates,
|
|
12450
|
+
normalizeDateTime,
|
|
12451
|
+
getTimeDifference,
|
|
12452
|
+
formatTimeDifference
|
|
12453
|
+
} = DateUtils;
|
|
12454
|
+
|
|
12446
12455
|
const {
|
|
12447
12456
|
estimateTokens
|
|
12448
12457
|
} = LLMUtils;
|
|
@@ -12768,9 +12777,6 @@ var GitSenseChatUtils_1 = {
|
|
|
12768
12777
|
FormatterUtils,
|
|
12769
12778
|
|
|
12770
12779
|
// Date Utility Functions
|
|
12771
|
-
formatAge: DateUtils.formatAge,
|
|
12772
|
-
compareDates: DateUtils.compareDates,
|
|
12773
|
-
isValidDateString: DateUtils.isValidDateString,
|
|
12774
12780
|
|
|
12775
12781
|
// Main class
|
|
12776
12782
|
GitSenseChatUtils,
|
|
@@ -12866,13 +12872,15 @@ var GitSenseChatUtils_1 = {
|
|
|
12866
12872
|
|
|
12867
12873
|
// Date Utils
|
|
12868
12874
|
formatAge,
|
|
12869
|
-
compareDates,
|
|
12870
12875
|
isValidDateString,
|
|
12876
|
+
compareDates,
|
|
12877
|
+
normalizeDateTime,
|
|
12878
|
+
getTimeDifference,
|
|
12879
|
+
formatTimeDifference,
|
|
12871
12880
|
|
|
12872
12881
|
// Formatter Utils
|
|
12873
12882
|
formatBytes,
|
|
12874
12883
|
formatTokens,
|
|
12875
|
-
formatOverviewTable,
|
|
12876
12884
|
|
|
12877
12885
|
// GS Tool Block
|
|
12878
12886
|
isToolBlock,
|
package/package.json
CHANGED
package/src/GitSenseChatUtils.js
CHANGED
|
@@ -25,6 +25,15 @@ const FormatterUtils = require('./FormatterUtils');
|
|
|
25
25
|
const ConfigUtils = require('./ConfigUtils');
|
|
26
26
|
const EnvUtils = require('./EnvUtils');
|
|
27
27
|
|
|
28
|
+
const {
|
|
29
|
+
formatAge,
|
|
30
|
+
isValidDateString,
|
|
31
|
+
compareDates,
|
|
32
|
+
normalizeDateTime,
|
|
33
|
+
getTimeDifference,
|
|
34
|
+
formatTimeDifference
|
|
35
|
+
} = DateUtils;
|
|
36
|
+
|
|
28
37
|
const {
|
|
29
38
|
estimateTokens
|
|
30
39
|
} = LLMUtils;
|
|
@@ -350,9 +359,6 @@ module.exports = {
|
|
|
350
359
|
FormatterUtils,
|
|
351
360
|
|
|
352
361
|
// Date Utility Functions
|
|
353
|
-
formatAge: DateUtils.formatAge,
|
|
354
|
-
compareDates: DateUtils.compareDates,
|
|
355
|
-
isValidDateString: DateUtils.isValidDateString,
|
|
356
362
|
|
|
357
363
|
// Main class
|
|
358
364
|
GitSenseChatUtils,
|
|
@@ -448,13 +454,15 @@ module.exports = {
|
|
|
448
454
|
|
|
449
455
|
// Date Utils
|
|
450
456
|
formatAge,
|
|
451
|
-
compareDates,
|
|
452
457
|
isValidDateString,
|
|
458
|
+
compareDates,
|
|
459
|
+
normalizeDateTime,
|
|
460
|
+
getTimeDifference,
|
|
461
|
+
formatTimeDifference,
|
|
453
462
|
|
|
454
463
|
// Formatter Utils
|
|
455
464
|
formatBytes,
|
|
456
465
|
formatTokens,
|
|
457
|
-
formatOverviewTable,
|
|
458
466
|
|
|
459
467
|
// GS Tool Block
|
|
460
468
|
isToolBlock,
|