@machinemetrics/mm-erp-sdk 0.1.9-beta.5 → 0.1.9-beta.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.
- package/dist/{connector-factory-Dg6bzS-I.js → connector-factory-BPm2GVVF.js} +2 -14
- package/dist/connector-factory-BPm2GVVF.js.map +1 -0
- package/dist/mm-erp-sdk.js +3 -2
- package/dist/mm-erp-sdk.js.map +1 -1
- package/dist/services/data-sync-service/jobs/from-erp.js +1 -1
- package/dist/services/data-sync-service/jobs/retry-failed-labor-tickets.js +1 -1
- package/dist/services/data-sync-service/jobs/to-erp.js +1 -1
- package/dist/utils/connector-factory.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/utils/connector-factory.ts +1 -14
- package/src/utils/http-client.ts +2 -1
- package/dist/connector-factory-Dg6bzS-I.js.map +0 -1
|
@@ -10,24 +10,12 @@ const createConnectorFromPath = async (connectorPath) => {
|
|
|
10
10
|
filename,
|
|
11
11
|
finalImport: pathToFileURL(connectorPath).href
|
|
12
12
|
});
|
|
13
|
-
logger.info(">>> BEFORE IMPORT: About to import connector module");
|
|
14
13
|
const connectorModule = await import(pathToFileURL(connectorPath).href);
|
|
15
|
-
logger.info(">>> AFTER IMPORT: Connector module imported successfully", {
|
|
16
|
-
moduleKeys: Object.keys(connectorModule),
|
|
17
|
-
hasDefault: !!connectorModule.default
|
|
18
|
-
});
|
|
19
14
|
const ConnectorClass = connectorModule.default || connectorModule[Object.keys(connectorModule)[0]];
|
|
20
|
-
logger.info(">>> CONNECTOR CLASS FOUND:", {
|
|
21
|
-
className: ConnectorClass?.name,
|
|
22
|
-
isFunction: typeof ConnectorClass === "function"
|
|
23
|
-
});
|
|
24
15
|
if (!ConnectorClass) {
|
|
25
16
|
throw new Error(`No connector class found in module: ${connectorPath}`);
|
|
26
17
|
}
|
|
27
|
-
|
|
28
|
-
const instance = new ConnectorClass();
|
|
29
|
-
logger.info(">>> AFTER NEW: Connector instantiated successfully");
|
|
30
|
-
return instance;
|
|
18
|
+
return new ConnectorClass();
|
|
31
19
|
} catch (error) {
|
|
32
20
|
logger.error(
|
|
33
21
|
`Failed to create connector instance from path: ${connectorPath}`,
|
|
@@ -39,4 +27,4 @@ const createConnectorFromPath = async (connectorPath) => {
|
|
|
39
27
|
export {
|
|
40
28
|
createConnectorFromPath as c
|
|
41
29
|
};
|
|
42
|
-
//# sourceMappingURL=connector-factory-
|
|
30
|
+
//# sourceMappingURL=connector-factory-BPm2GVVF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector-factory-BPm2GVVF.js","sources":["../src/utils/connector-factory.ts"],"sourcesContent":["import { IERPConnector } from \"../types/erp-connector\";\nimport logger from \"../services/reporting-service/logger\";\nimport { pathToFileURL } from \"url\";\n\n/**\n * Helper function to dynamically import and create connector instance from a file path\n * @param connectorPath - The file path to the connector module\n * @returns A new instance of the IERPConnector\n */\nexport const createConnectorFromPath = async (\n connectorPath: string\n): Promise<IERPConnector> => {\n try {\n // Some detailed debug logging to help with troubleshooting multi-platform connector paths\n const pathParts = connectorPath.split('/');\n const filename = pathParts[pathParts.length - 1];\n\n logger.debug(\"createConnectorFromPath:\", {\n connectorPath,\n pathParts,\n filename,\n finalImport: pathToFileURL(connectorPath).href,\n });\n\n const connectorModule = await import(pathToFileURL(connectorPath).href);\n\n // Get the default export or named export\n const ConnectorClass =\n connectorModule.default ||\n connectorModule[Object.keys(connectorModule)[0]];\n\n if (!ConnectorClass) {\n throw new Error(`No connector class found in module: ${connectorPath}`);\n }\n\n // Create new instance of the connector\n return new ConnectorClass();\n } catch (error) {\n logger.error(\n `Failed to create connector instance from path: ${connectorPath}`,\n { error }\n );\n throw error;\n }\n};"],"names":[],"mappings":";;AASO,MAAM,0BAA0B,OACrC,kBAC2B;AAC3B,MAAI;AAEF,UAAM,YAAY,cAAc,MAAM,GAAG;AACzC,UAAM,WAAW,UAAU,UAAU,SAAS,CAAC;AAE/C,WAAO,MAAM,4BAA4B;AAAA,MACvC;AAAA,MACA;AAAA,MACA;AAAA,MACA,aAAa,cAAc,aAAa,EAAE;AAAA,IAAA,CAC3C;AAED,UAAM,kBAAkB,MAAM,OAAO,cAAc,aAAa,EAAE;AAGlE,UAAM,iBACJ,gBAAgB,WAChB,gBAAgB,OAAO,KAAK,eAAe,EAAE,CAAC,CAAC;AAEjD,QAAI,CAAC,gBAAgB;AACnB,YAAM,IAAI,MAAM,uCAAuC,aAAa,EAAE;AAAA,IACxE;AAGA,WAAO,IAAI,eAAA;AAAA,EACb,SAAS,OAAO;AACd,WAAO;AAAA,MACL,kDAAkD,aAAa;AAAA,MAC/D,EAAE,MAAA;AAAA,IAAM;AAEV,UAAM;AAAA,EACR;AACF;"}
|
package/dist/mm-erp-sdk.js
CHANGED
|
@@ -8,7 +8,7 @@ import knex from "knex";
|
|
|
8
8
|
import { c as config } from "./knexfile-Bng2Ru9c.js";
|
|
9
9
|
import fs from "fs";
|
|
10
10
|
import path from "path";
|
|
11
|
-
import { c as createConnectorFromPath } from "./connector-factory-
|
|
11
|
+
import { c as createConnectorFromPath } from "./connector-factory-BPm2GVVF.js";
|
|
12
12
|
import Bree from "bree";
|
|
13
13
|
import Graceful from "@ladjs/graceful";
|
|
14
14
|
import { fileURLToPath } from "url";
|
|
@@ -127,9 +127,10 @@ class AxiosClient {
|
|
|
127
127
|
* It can be convenient to set `baseURL` for an instance of axios to pass relative URLs to methods of that instance.
|
|
128
128
|
*/
|
|
129
129
|
constructor(baseUrl, retryAttempts) {
|
|
130
|
+
const timeout = parseInt(process.env.MM_API_TIMEOUT || "30000");
|
|
130
131
|
this.client = axios.create({
|
|
131
132
|
baseURL: baseUrl,
|
|
132
|
-
timeout
|
|
133
|
+
timeout,
|
|
133
134
|
headers: {
|
|
134
135
|
"Content-Type": "application/json"
|
|
135
136
|
}
|