@machinemetrics/mm-erp-sdk 0.1.4-beta.5 → 0.1.4-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.
@@ -1,4 +1,5 @@
1
1
  import { l as logger } from "./logger-hqtl8hFM.js";
2
+ import { pathToFileURL } from "url";
2
3
  const createConnectorFromPath = async (connectorPath) => {
3
4
  try {
4
5
  logger.debug(`createConnectorFromPath: Received connector path: ${connectorPath}`);
@@ -8,8 +9,8 @@ const createConnectorFromPath = async (connectorPath) => {
8
9
  logger.debug(`createConnectorFromPath: Path parts: ${JSON.stringify(pathParts)}`);
9
10
  const filename = pathParts[pathParts.length - 1];
10
11
  logger.debug(`createConnectorFromPath: Filename: ${filename}`);
11
- logger.debug(`createConnectorFromPath: Attempting to import: ${connectorPath}`);
12
- const connectorModule = await import(connectorPath);
12
+ logger.debug(`createConnectorFromPath: Attempting to import: ${pathToFileURL(connectorPath).href}`);
13
+ const connectorModule = await import(pathToFileURL(connectorPath).href);
13
14
  const ConnectorClass = connectorModule.default || connectorModule[Object.keys(connectorModule)[0]];
14
15
  if (!ConnectorClass) {
15
16
  throw new Error(`No connector class found in module: ${connectorPath}`);
@@ -26,4 +27,4 @@ const createConnectorFromPath = async (connectorPath) => {
26
27
  export {
27
28
  createConnectorFromPath as c
28
29
  };
29
- //# sourceMappingURL=connector-factory-OMijBGQX.js.map
30
+ //# sourceMappingURL=connector-factory-13bvmpQB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connector-factory-13bvmpQB.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 // Add detailed debug logging\n logger.debug(`createConnectorFromPath: Received connector path: ${connectorPath}`);\n logger.debug(`createConnectorFromPath: Path type: ${typeof connectorPath}`);\n logger.debug(`createConnectorFromPath: Path length: ${connectorPath.length}`);\n \n // Log the path components\n const pathParts = connectorPath.split('/');\n logger.debug(`createConnectorFromPath: Path parts: ${JSON.stringify(pathParts)}`);\n \n // Log the filename specifically\n const filename = pathParts[pathParts.length - 1];\n logger.debug(`createConnectorFromPath: Filename: ${filename}`);\n \n // Dynamic import the connector module\n logger.debug(`createConnectorFromPath: Attempting to import: ${pathToFileURL(connectorPath).href}`);\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,WAAO,MAAM,qDAAqD,aAAa,EAAE;AACjF,WAAO,MAAM,uCAAuC,OAAO,aAAa,EAAE;AAC1E,WAAO,MAAM,yCAAyC,cAAc,MAAM,EAAE;AAG5E,UAAM,YAAY,cAAc,MAAM,GAAG;AACzC,WAAO,MAAM,wCAAwC,KAAK,UAAU,SAAS,CAAC,EAAE;AAGhF,UAAM,WAAW,UAAU,UAAU,SAAS,CAAC;AAC/C,WAAO,MAAM,sCAAsC,QAAQ,EAAE;AAG7D,WAAO,MAAM,kDAAkD,cAAc,aAAa,EAAE,IAAI,EAAE;AAClG,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;"}
@@ -8,7 +8,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-OMijBGQX.js";
11
+ import "./connector-factory-13bvmpQB.js";
12
12
  import Bree from "bree";
13
13
  import Graceful from "@ladjs/graceful";
14
14
  import { fileURLToPath } from "url";
@@ -1,7 +1,7 @@
1
1
  import "../../../config-WKwu1mMo.js";
2
2
  import { l as logger } from "../../../logger-hqtl8hFM.js";
3
3
  import { S as SQLiteCoordinator } from "../../../index-aci_wdcn.js";
4
- import { c as createConnectorFromPath } from "../../../connector-factory-OMijBGQX.js";
4
+ import { c as createConnectorFromPath } from "../../../connector-factory-13bvmpQB.js";
5
5
  logger.level = process.env.LOG_LEVEL || "info";
6
6
  const main = async () => {
7
7
  try {
@@ -1,6 +1,6 @@
1
1
  import "../../../config-WKwu1mMo.js";
2
2
  import { l as logger } from "../../../logger-hqtl8hFM.js";
3
- import { c as createConnectorFromPath } from "../../../connector-factory-OMijBGQX.js";
3
+ import { c as createConnectorFromPath } from "../../../connector-factory-13bvmpQB.js";
4
4
  logger.level = process.env.LOG_LEVEL || "info";
5
5
  const main = async () => {
6
6
  try {
@@ -1,6 +1,6 @@
1
1
  import "../../../config-WKwu1mMo.js";
2
2
  import { l as logger } from "../../../logger-hqtl8hFM.js";
3
- import { c as createConnectorFromPath } from "../../../connector-factory-OMijBGQX.js";
3
+ import { c as createConnectorFromPath } from "../../../connector-factory-13bvmpQB.js";
4
4
  logger.level = process.env.LOG_LEVEL || "info";
5
5
  const main = async () => {
6
6
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"connector-factory.d.ts","sourceRoot":"","sources":["../../src/utils/connector-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAClC,eAAe,MAAM,KACpB,OAAO,CAAC,aAAa,CAqCvB,CAAC"}
1
+ {"version":3,"file":"connector-factory.d.ts","sourceRoot":"","sources":["../../src/utils/connector-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAIvD;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAClC,eAAe,MAAM,KACpB,OAAO,CAAC,aAAa,CAqCvB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@machinemetrics/mm-erp-sdk",
3
3
  "description": "A library for syncing data between MachineMetrics and ERP systems",
4
- "version": "0.1.4-beta.5",
4
+ "version": "0.1.4-beta.6",
5
5
  "license": "MIT",
6
6
  "author": "machinemetrics",
7
7
  "main": "dist/mm-erp-sdk.js",
@@ -1,5 +1,6 @@
1
1
  import { IERPConnector } from "../types/erp-connector";
2
2
  import logger from "../services/reporting-service/logger";
3
+ import { pathToFileURL } from "url";
3
4
 
4
5
  /**
5
6
  * Helper function to dynamically import and create connector instance from a file path
@@ -24,8 +25,8 @@ export const createConnectorFromPath = async (
24
25
  logger.debug(`createConnectorFromPath: Filename: ${filename}`);
25
26
 
26
27
  // Dynamic import the connector module
27
- logger.debug(`createConnectorFromPath: Attempting to import: ${connectorPath}`);
28
- const connectorModule = await import(connectorPath);
28
+ logger.debug(`createConnectorFromPath: Attempting to import: ${pathToFileURL(connectorPath).href}`);
29
+ const connectorModule = await import(pathToFileURL(connectorPath).href);
29
30
 
30
31
  // Get the default export or named export
31
32
  const ConnectorClass =
@@ -1 +0,0 @@
1
- {"version":3,"file":"connector-factory-OMijBGQX.js","sources":["../src/utils/connector-factory.ts"],"sourcesContent":["import { IERPConnector } from \"../types/erp-connector\";\nimport logger from \"../services/reporting-service/logger\";\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 // Add detailed debug logging\n logger.debug(`createConnectorFromPath: Received connector path: ${connectorPath}`);\n logger.debug(`createConnectorFromPath: Path type: ${typeof connectorPath}`);\n logger.debug(`createConnectorFromPath: Path length: ${connectorPath.length}`);\n \n // Log the path components\n const pathParts = connectorPath.split('/');\n logger.debug(`createConnectorFromPath: Path parts: ${JSON.stringify(pathParts)}`);\n \n // Log the filename specifically\n const filename = pathParts[pathParts.length - 1];\n logger.debug(`createConnectorFromPath: Filename: ${filename}`);\n \n // Dynamic import the connector module\n logger.debug(`createConnectorFromPath: Attempting to import: ${connectorPath}`);\n const connectorModule = await import(connectorPath);\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":";AAQO,MAAM,0BAA0B,OACrC,kBAC2B;AAC3B,MAAI;AAEF,WAAO,MAAM,qDAAqD,aAAa,EAAE;AACjF,WAAO,MAAM,uCAAuC,OAAO,aAAa,EAAE;AAC1E,WAAO,MAAM,yCAAyC,cAAc,MAAM,EAAE;AAG5E,UAAM,YAAY,cAAc,MAAM,GAAG;AACzC,WAAO,MAAM,wCAAwC,KAAK,UAAU,SAAS,CAAC,EAAE;AAGhF,UAAM,WAAW,UAAU,UAAU,SAAS,CAAC;AAC/C,WAAO,MAAM,sCAAsC,QAAQ,EAAE;AAG7D,WAAO,MAAM,kDAAkD,aAAa,EAAE;AAC9E,UAAM,kBAAkB,MAAM,OAAO;AAGrC,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;"}