@getsupervisor/agents-studio-sdk 1.41.2-patch.12 → 1.41.2-patch.14
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/index.cjs +14 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1778,16 +1778,28 @@ function appendCondition(query, factory) {
|
|
|
1778
1778
|
}
|
|
1779
1779
|
return new Query(factory);
|
|
1780
1780
|
}
|
|
1781
|
+
var DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
|
|
1782
|
+
function toISOString(value) {
|
|
1783
|
+
const input = DATE_ONLY.test(value) ? `${value}T00:00:00` : value;
|
|
1784
|
+
const date = new Date(input);
|
|
1785
|
+
if (Number.isNaN(date.getTime())) {
|
|
1786
|
+
return value;
|
|
1787
|
+
}
|
|
1788
|
+
return date.toISOString();
|
|
1789
|
+
}
|
|
1781
1790
|
function buildUsageFilter(resource, from, to) {
|
|
1782
1791
|
let query;
|
|
1783
1792
|
if (resource) {
|
|
1784
1793
|
query = appendCondition(query, (qb) => qb.eq("resource", resource));
|
|
1785
1794
|
}
|
|
1786
1795
|
if (from) {
|
|
1787
|
-
query = appendCondition(
|
|
1796
|
+
query = appendCondition(
|
|
1797
|
+
query,
|
|
1798
|
+
(qb) => qb.mte("createdAt", toISOString(from))
|
|
1799
|
+
);
|
|
1788
1800
|
}
|
|
1789
1801
|
if (to) {
|
|
1790
|
-
query = appendCondition(query, (qb) => qb.lt("createdAt", to));
|
|
1802
|
+
query = appendCondition(query, (qb) => qb.lt("createdAt", toISOString(to)));
|
|
1791
1803
|
}
|
|
1792
1804
|
return query;
|
|
1793
1805
|
}
|