@machinemetrics/mm-erp-sdk 0.1.8-beta.2 → 0.1.8-beta.4
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/{config-152LkbTv.js → config-qat9zgOl.js} +2 -2
- package/dist/{config-152LkbTv.js.map → config-qat9zgOl.js.map} +1 -1
- package/dist/{connector-factory-wivcyMhC.js → connector-factory-C2czCs9v.js} +2 -2
- package/dist/{connector-factory-wivcyMhC.js.map → connector-factory-C2czCs9v.js.map} +1 -1
- package/dist/{hashed-cache-manager-BnviJzB7.js → hashed-cache-manager-CzyFSt2B.js} +4 -4
- package/dist/{hashed-cache-manager-BnviJzB7.js.map → hashed-cache-manager-CzyFSt2B.js.map} +1 -1
- package/dist/{index-DNqHWa8F.js → index-B9wo8pld.js} +2 -2
- package/dist/{index-DNqHWa8F.js.map → index-B9wo8pld.js.map} +1 -1
- package/dist/{logger-HAWySEbs.js → logger-Db8CkwR6.js} +11 -83
- package/dist/{logger-HAWySEbs.js.map → logger-Db8CkwR6.js.map} +1 -1
- package/dist/mm-erp-sdk.js +24 -7
- package/dist/mm-erp-sdk.js.map +1 -1
- package/dist/services/data-sync-service/jobs/clean-up-expired-cache.js +4 -4
- package/dist/services/data-sync-service/jobs/from-erp.js +4 -4
- package/dist/services/data-sync-service/jobs/retry-failed-labor-tickets.js +3 -3
- package/dist/services/data-sync-service/jobs/run-migrations.js +1 -1
- package/dist/services/data-sync-service/jobs/to-erp.js +3 -3
- package/dist/services/reporting-service/logger.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/timezone.d.ts +7 -0
- package/dist/utils/timezone.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/services/reporting-service/logger.ts +11 -94
- package/src/utils/index.ts +1 -1
- package/src/utils/mm-labor-ticket-helpers.ts +2 -2
- package/src/utils/timezone.ts +28 -0
package/dist/mm-erp-sdk.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { C as CoreConfiguration, H as HashedCacheManager } from "./hashed-cache-manager-
|
|
2
|
-
import { E, g, a } from "./hashed-cache-manager-
|
|
3
|
-
import { l as logger } from "./logger-
|
|
4
|
-
import { g as getCachedMMToken, s as setCachedMMToken, a as setTimezoneOffsetInCache, b as getCachedTimezoneOffset, S as SQLiteCoordinator } from "./index-
|
|
5
|
-
import { c, d } from "./index-
|
|
1
|
+
import { C as CoreConfiguration, H as HashedCacheManager } from "./hashed-cache-manager-CzyFSt2B.js";
|
|
2
|
+
import { E, g, a } from "./hashed-cache-manager-CzyFSt2B.js";
|
|
3
|
+
import { l as logger } from "./logger-Db8CkwR6.js";
|
|
4
|
+
import { g as getCachedMMToken, s as setCachedMMToken, a as setTimezoneOffsetInCache, b as getCachedTimezoneOffset, S as SQLiteCoordinator } from "./index-B9wo8pld.js";
|
|
5
|
+
import { c, d } from "./index-B9wo8pld.js";
|
|
6
6
|
import axios, { AxiosError } from "axios";
|
|
7
7
|
import knex from "knex";
|
|
8
8
|
import { c as config } from "./knexfile-1qKKIORB.js";
|
|
9
9
|
import fs from "fs";
|
|
10
10
|
import path from "path";
|
|
11
|
-
import "./connector-factory-
|
|
11
|
+
import "./connector-factory-C2czCs9v.js";
|
|
12
12
|
import Bree from "bree";
|
|
13
13
|
import Graceful from "@ladjs/graceful";
|
|
14
14
|
import { fileURLToPath } from "url";
|
|
@@ -1461,6 +1461,23 @@ const formatDateWithTZOffset = (date, timezoneOffset) => {
|
|
|
1461
1461
|
const minutes = Math.floor(absOffset % 1 * 60).toString().padStart(2, "0");
|
|
1462
1462
|
return `${isoDate}${sign}${hours}:${minutes}`;
|
|
1463
1463
|
};
|
|
1464
|
+
const toISOWithOffset = (date, timezoneOffset) => {
|
|
1465
|
+
const sign = timezoneOffset >= 0 ? "+" : "-";
|
|
1466
|
+
const abs = Math.abs(timezoneOffset);
|
|
1467
|
+
const hours = Math.floor(abs);
|
|
1468
|
+
const minutes = Math.round((abs - hours) * 60);
|
|
1469
|
+
const pad2 = (n) => n.toString().padStart(2, "0");
|
|
1470
|
+
const pad3 = (n) => n.toString().padStart(3, "0");
|
|
1471
|
+
const yyyy = date.getUTCFullYear();
|
|
1472
|
+
const MM = pad2(date.getUTCMonth() + 1);
|
|
1473
|
+
const dd = pad2(date.getUTCDate());
|
|
1474
|
+
const HH = pad2(date.getUTCHours());
|
|
1475
|
+
const mm = pad2(date.getUTCMinutes());
|
|
1476
|
+
const ss = pad2(date.getUTCSeconds());
|
|
1477
|
+
const SSS = pad3(date.getUTCMilliseconds());
|
|
1478
|
+
const off = `${sign}${pad2(hours)}:${pad2(minutes)}`;
|
|
1479
|
+
return `${yyyy}-${MM}-${dd}T${HH}:${mm}:${ss}.${SSS}${off}`;
|
|
1480
|
+
};
|
|
1464
1481
|
function calculateTimeDifferenceInHours(startTime, endTime, timezoneOffset) {
|
|
1465
1482
|
if (!startTime || !endTime) return 0;
|
|
1466
1483
|
const localStartTime = convertToLocalTime(startTime, timezoneOffset);
|
|
@@ -1643,7 +1660,7 @@ function convertLaborTicketToLocalTimezone(laborTicket, timezoneOffset) {
|
|
|
1643
1660
|
];
|
|
1644
1661
|
timeFields.forEach((field) => {
|
|
1645
1662
|
const localTime = convertToLocalTime(laborTicket[field], timezoneOffset);
|
|
1646
|
-
laborTicket[field] = localTime
|
|
1663
|
+
laborTicket[field] = localTime ? toISOWithOffset(localTime, timezoneOffset) : null;
|
|
1647
1664
|
});
|
|
1648
1665
|
return laborTicket;
|
|
1649
1666
|
}
|