@machinemetrics/mm-erp-sdk 0.1.4 → 0.1.5
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-WKwu1mMo.js → config-qat9zgOl.js} +2 -2
- package/dist/{config-WKwu1mMo.js.map → config-qat9zgOl.js.map} +1 -1
- package/dist/{connector-factory-DHmMYsRs.js → connector-factory-C2czCs9v.js} +2 -2
- package/dist/{connector-factory-DHmMYsRs.js.map → connector-factory-C2czCs9v.js.map} +1 -1
- package/dist/{hashed-cache-manager-CtDhFqj6.js → hashed-cache-manager-CzyFSt2B.js} +4 -4
- package/dist/{hashed-cache-manager-CtDhFqj6.js.map → hashed-cache-manager-CzyFSt2B.js.map} +1 -1
- package/dist/{index-aci_wdcn.js → index-B9wo8pld.js} +2 -2
- package/dist/{index-aci_wdcn.js.map → index-B9wo8pld.js.map} +1 -1
- package/dist/{logger-hqtl8hFM.js → logger-Db8CkwR6.js} +924 -966
- package/dist/logger-Db8CkwR6.js.map +1 -0
- 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/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/utils/index.ts +1 -1
- package/src/utils/mm-labor-ticket-helpers.ts +2 -2
- package/src/utils/timezone.ts +28 -0
- package/dist/logger-hqtl8hFM.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "../../../config-
|
|
2
|
-
import { H as HashedCacheManager } from "../../../hashed-cache-manager-
|
|
3
|
-
import { S as SQLiteCoordinator } from "../../../index-
|
|
4
|
-
import { l as logger } from "../../../logger-
|
|
1
|
+
import "../../../config-qat9zgOl.js";
|
|
2
|
+
import { H as HashedCacheManager } from "../../../hashed-cache-manager-CzyFSt2B.js";
|
|
3
|
+
import { S as SQLiteCoordinator } from "../../../index-B9wo8pld.js";
|
|
4
|
+
import { l as logger } from "../../../logger-Db8CkwR6.js";
|
|
5
5
|
logger.level = process.env.LOG_LEVEL || "info";
|
|
6
6
|
const main = async () => {
|
|
7
7
|
const cacheManager = new HashedCacheManager();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "../../../config-
|
|
2
|
-
import { l as logger } from "../../../logger-
|
|
3
|
-
import { S as SQLiteCoordinator } from "../../../index-
|
|
4
|
-
import { c as createConnectorFromPath } from "../../../connector-factory-
|
|
1
|
+
import "../../../config-qat9zgOl.js";
|
|
2
|
+
import { l as logger } from "../../../logger-Db8CkwR6.js";
|
|
3
|
+
import { S as SQLiteCoordinator } from "../../../index-B9wo8pld.js";
|
|
4
|
+
import { c as createConnectorFromPath } from "../../../connector-factory-C2czCs9v.js";
|
|
5
5
|
logger.level = process.env.LOG_LEVEL || "info";
|
|
6
6
|
const main = async () => {
|
|
7
7
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../../../config-
|
|
2
|
-
import { l as logger } from "../../../logger-
|
|
3
|
-
import { c as createConnectorFromPath } from "../../../connector-factory-
|
|
1
|
+
import "../../../config-qat9zgOl.js";
|
|
2
|
+
import { l as logger } from "../../../logger-Db8CkwR6.js";
|
|
3
|
+
import { c as createConnectorFromPath } from "../../../connector-factory-C2czCs9v.js";
|
|
4
4
|
logger.level = process.env.LOG_LEVEL || "info";
|
|
5
5
|
const main = async () => {
|
|
6
6
|
try {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import knex from "knex";
|
|
2
|
-
import { l as logger } from "../../../logger-
|
|
2
|
+
import { l as logger } from "../../../logger-Db8CkwR6.js";
|
|
3
3
|
import { c as config } from "../../../knexfile-1qKKIORB.js";
|
|
4
4
|
logger.level = process.env.LOG_LEVEL || "info";
|
|
5
5
|
const db = knex(config.local);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../../../config-
|
|
2
|
-
import { l as logger } from "../../../logger-
|
|
3
|
-
import { c as createConnectorFromPath } from "../../../connector-factory-
|
|
1
|
+
import "../../../config-qat9zgOl.js";
|
|
2
|
+
import { l as logger } from "../../../logger-Db8CkwR6.js";
|
|
3
|
+
import { c as createConnectorFromPath } from "../../../connector-factory-C2czCs9v.js";
|
|
4
4
|
logger.level = process.env.LOG_LEVEL || "info";
|
|
5
5
|
const main = async () => {
|
|
6
6
|
try {
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export { addNewFieldFromExternalSource, addNewFieldFromLookupField, } from "./da
|
|
|
11
11
|
* Timezone and time-related utilities
|
|
12
12
|
*/
|
|
13
13
|
export { getTimezoneOffsetAndPersist } from "./time-utils";
|
|
14
|
-
export { formatDateWithTZOffset, convertToLocalTime } from "./timezone";
|
|
14
|
+
export { formatDateWithTZOffset, convertToLocalTime, toISOWithOffset } from "./timezone";
|
|
15
15
|
export { applyTimezoneOffsetsToFields } from "./time-utils";
|
|
16
16
|
export * from "./time-utils";
|
|
17
17
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EACL,6BAA6B,EA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EAAE,MAAM,qCAAqC,CAAC;AAG9E,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,qCAAqC,CAAC;AAE7C;;GAEG;AACH,cAAc,oDAAoD,CAAC;AACnE,cAAc,oDAAoD,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEjF;;GAEG;AACH,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACzH,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D;;GAEG;AACH,cAAc,2BAA2B,CAAC;AAE1C;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAExE;;GAEG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/utils/timezone.d.ts
CHANGED
|
@@ -18,4 +18,11 @@ export declare const convertToLocalTime: (zuluTime: string | Date | null | undef
|
|
|
18
18
|
* @returns The formatted date string in format: YYYY-MM-DDTHH:mm:ss+/-HH:MM
|
|
19
19
|
*/
|
|
20
20
|
export declare const formatDateWithTZOffset: (date: string | null | undefined, timezoneOffset: number) => string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Formats a Date object as an ISO string with the specified timezone offset
|
|
23
|
+
* @param date The Date object to format (should be a Date that has been shifted by convertToLocalTime)
|
|
24
|
+
* @param timezoneOffset The timezone offset in hours
|
|
25
|
+
* @returns ISO string with offset in format: YYYY-MM-DDTHH:mm:ss.SSS±HH:MM
|
|
26
|
+
*/
|
|
27
|
+
export declare const toISOWithOffset: (date: Date, timezoneOffset: number) => string;
|
|
21
28
|
//# sourceMappingURL=timezone.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timezone.d.ts","sourceRoot":"","sources":["../../src/utils/timezone.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAa,OAAO,CAAC,MAAM,CA6CxD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAC7B,UAAU,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,EAC1C,gBAAgB,MAAM,KACrB,IAAI,GAAG,SAIT,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GACjC,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/B,gBAAgB,MAAM,KACrB,MAAM,GAAG,SAgBX,CAAC"}
|
|
1
|
+
{"version":3,"file":"timezone.d.ts","sourceRoot":"","sources":["../../src/utils/timezone.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAa,OAAO,CAAC,MAAM,CA6CxD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAC7B,UAAU,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,EAC1C,gBAAgB,MAAM,KACrB,IAAI,GAAG,SAIT,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GACjC,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/B,gBAAgB,MAAM,KACrB,MAAM,GAAG,SAgBX,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,IAAI,EAAE,gBAAgB,MAAM,KAAG,MAoBpE,CAAC"}
|
package/package.json
CHANGED
package/src/utils/index.ts
CHANGED
|
@@ -15,7 +15,7 @@ export {
|
|
|
15
15
|
* Timezone and time-related utilities
|
|
16
16
|
*/
|
|
17
17
|
export { getTimezoneOffsetAndPersist } from "./time-utils";
|
|
18
|
-
export { formatDateWithTZOffset, convertToLocalTime } from "./timezone";
|
|
18
|
+
export { formatDateWithTZOffset, convertToLocalTime, toISOWithOffset } from "./timezone";
|
|
19
19
|
export { applyTimezoneOffsetsToFields } from "./time-utils";
|
|
20
20
|
export * from "./time-utils";
|
|
21
21
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { convertToLocalTime } from "./timezone";
|
|
1
|
+
import { convertToLocalTime, toISOWithOffset } from "./timezone";
|
|
2
2
|
import { MMReceiveLaborTicket } from "../services/mm-api-service/types/receive-types";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -22,7 +22,7 @@ export function convertLaborTicketToLocalTimezone(
|
|
|
22
22
|
|
|
23
23
|
timeFields.forEach((field) => {
|
|
24
24
|
const localTime = convertToLocalTime(laborTicket[field], timezoneOffset);
|
|
25
|
-
laborTicket[field] = localTime
|
|
25
|
+
laborTicket[field] = localTime ? toISOWithOffset(localTime, timezoneOffset) : null;
|
|
26
26
|
});
|
|
27
27
|
return laborTicket;
|
|
28
28
|
}
|
package/src/utils/timezone.ts
CHANGED
|
@@ -94,3 +94,31 @@ export const formatDateWithTZOffset = (
|
|
|
94
94
|
// Append the timezone offset
|
|
95
95
|
return `${isoDate}${sign}${hours}:${minutes}`;
|
|
96
96
|
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Formats a Date object as an ISO string with the specified timezone offset
|
|
100
|
+
* @param date The Date object to format (should be a Date that has been shifted by convertToLocalTime)
|
|
101
|
+
* @param timezoneOffset The timezone offset in hours
|
|
102
|
+
* @returns ISO string with offset in format: YYYY-MM-DDTHH:mm:ss.SSS±HH:MM
|
|
103
|
+
*/
|
|
104
|
+
export const toISOWithOffset = (date: Date, timezoneOffset: number): string => {
|
|
105
|
+
const sign = timezoneOffset >= 0 ? "+" : "-";
|
|
106
|
+
const abs = Math.abs(timezoneOffset);
|
|
107
|
+
const hours = Math.floor(abs);
|
|
108
|
+
const minutes = Math.round((abs - hours) * 60);
|
|
109
|
+
const pad2 = (n: number) => n.toString().padStart(2, "0");
|
|
110
|
+
const pad3 = (n: number) => n.toString().padStart(3, "0");
|
|
111
|
+
|
|
112
|
+
// Use UTC getters since convertToLocalTime shifts the Date's internal timestamp
|
|
113
|
+
// The UTC components of the shifted Date represent the local wall time
|
|
114
|
+
const yyyy = date.getUTCFullYear();
|
|
115
|
+
const MM = pad2(date.getUTCMonth() + 1);
|
|
116
|
+
const dd = pad2(date.getUTCDate());
|
|
117
|
+
const HH = pad2(date.getUTCHours());
|
|
118
|
+
const mm = pad2(date.getUTCMinutes());
|
|
119
|
+
const ss = pad2(date.getUTCSeconds());
|
|
120
|
+
const SSS = pad3(date.getUTCMilliseconds());
|
|
121
|
+
const off = `${sign}${pad2(hours)}:${pad2(minutes)}`;
|
|
122
|
+
|
|
123
|
+
return `${yyyy}-${MM}-${dd}T${HH}:${mm}:${ss}.${SSS}${off}`;
|
|
124
|
+
};
|