@machinemetrics/mm-erp-sdk 0.1.2 → 0.1.4-beta.0

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.
Files changed (45) hide show
  1. package/dist/{config-2l5vnNkA.js → config-WKwu1mMo.js} +6 -6
  2. package/dist/{config-2l5vnNkA.js.map → config-WKwu1mMo.js.map} +1 -1
  3. package/dist/{connector-factory-CQ8e7Tae.js → connector-factory-DFv3ex0X.js} +2 -2
  4. package/dist/{connector-factory-CQ8e7Tae.js.map → connector-factory-DFv3ex0X.js.map} +1 -1
  5. package/dist/{hashed-cache-manager-Ci59eC75.js → hashed-cache-manager-INiCs0JC.js} +4 -4
  6. package/dist/{hashed-cache-manager-Ci59eC75.js.map → hashed-cache-manager-INiCs0JC.js.map} +1 -1
  7. package/dist/{index-CXbOvFyf.js → index-aci_wdcn.js} +7 -7
  8. package/dist/{index-CXbOvFyf.js.map → index-aci_wdcn.js.map} +1 -1
  9. package/dist/index.d.ts +6 -3
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/{logger-QG73MndU.js → logger-hqtl8hFM.js} +6 -6
  12. package/dist/{logger-QG73MndU.js.map → logger-hqtl8hFM.js.map} +1 -1
  13. package/dist/mm-erp-sdk.js +390 -8
  14. package/dist/mm-erp-sdk.js.map +1 -1
  15. package/dist/services/data-sync-service/jobs/clean-up-expired-cache.js +4 -4
  16. package/dist/services/data-sync-service/jobs/from-erp.js +4 -4
  17. package/dist/services/data-sync-service/jobs/retry-failed-labor-tickets.js +3 -3
  18. package/dist/services/data-sync-service/jobs/run-migrations.js +1 -1
  19. package/dist/services/data-sync-service/jobs/to-erp.js +3 -3
  20. package/dist/services/erp-api-services/index.d.ts +4 -1
  21. package/dist/services/erp-api-services/index.d.ts.map +1 -1
  22. package/dist/services/mm-api-service/mm-api-service.d.ts +20 -0
  23. package/dist/services/mm-api-service/mm-api-service.d.ts.map +1 -1
  24. package/dist/utils/connector-log/log-deduper.d.ts +56 -0
  25. package/dist/utils/connector-log/log-deduper.d.ts.map +1 -0
  26. package/dist/utils/connector-log/mm-connector-logger-example.d.ts +1 -0
  27. package/dist/utils/connector-log/mm-connector-logger-example.d.ts.map +1 -0
  28. package/dist/utils/connector-log/mm-connector-logger.d.ts +74 -0
  29. package/dist/utils/connector-log/mm-connector-logger.d.ts.map +1 -0
  30. package/dist/utils/error-utils.d.ts +2 -0
  31. package/dist/utils/error-utils.d.ts.map +1 -0
  32. package/dist/utils/index.d.ts +9 -1
  33. package/dist/utils/index.d.ts.map +1 -1
  34. package/dist/utils/standard-process-drivers/index.d.ts +2 -1
  35. package/dist/utils/standard-process-drivers/index.d.ts.map +1 -1
  36. package/package.json +1 -1
  37. package/src/index.ts +8 -2
  38. package/src/services/erp-api-services/index.ts +6 -1
  39. package/src/services/mm-api-service/mm-api-service.ts +29 -1
  40. package/src/utils/connector-log/log-deduper.ts +282 -0
  41. package/src/utils/connector-log/mm-connector-logger-example.ts +97 -0
  42. package/src/utils/connector-log/mm-connector-logger.ts +177 -0
  43. package/src/utils/error-utils.ts +18 -0
  44. package/src/utils/index.ts +10 -4
  45. package/src/utils/standard-process-drivers/index.ts +2 -4
@@ -2,10 +2,10 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
2
2
  var __commonJS = (cb, mod) => function __require() {
3
3
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4
4
  };
5
- import "../../../config-2l5vnNkA.js";
6
- import { H as HashedCacheManager } from "../../../hashed-cache-manager-Ci59eC75.js";
7
- import { S as SQLiteCoordinator } from "../../../index-CXbOvFyf.js";
8
- import { l as logger } from "../../../logger-QG73MndU.js";
5
+ import "../../../config-WKwu1mMo.js";
6
+ import { H as HashedCacheManager } from "../../../hashed-cache-manager-INiCs0JC.js";
7
+ import { S as SQLiteCoordinator } from "../../../index-aci_wdcn.js";
8
+ import { l as logger } from "../../../logger-hqtl8hFM.js";
9
9
  var require_clean_up_expired_cache = __commonJS({
10
10
  "services/data-sync-service/jobs/clean-up-expired-cache.js"(exports, module) {
11
11
  const main = async () => {
@@ -1,7 +1,7 @@
1
- import "../../../config-2l5vnNkA.js";
2
- import { l as logger } from "../../../logger-QG73MndU.js";
3
- import { S as SQLiteCoordinator } from "../../../index-CXbOvFyf.js";
4
- import { c as createConnectorFromPath } from "../../../connector-factory-CQ8e7Tae.js";
1
+ import "../../../config-WKwu1mMo.js";
2
+ import { l as logger } from "../../../logger-hqtl8hFM.js";
3
+ import { S as SQLiteCoordinator } from "../../../index-aci_wdcn.js";
4
+ import { c as createConnectorFromPath } from "../../../connector-factory-DFv3ex0X.js";
5
5
  const main = async () => {
6
6
  try {
7
7
  logger.info('Worker for job "from-erp" online');
@@ -2,9 +2,9 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
2
2
  var __commonJS = (cb, mod) => function __require() {
3
3
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4
4
  };
5
- import "../../../config-2l5vnNkA.js";
6
- import { l as logger } from "../../../logger-QG73MndU.js";
7
- import { c as createConnectorFromPath } from "../../../connector-factory-CQ8e7Tae.js";
5
+ import "../../../config-WKwu1mMo.js";
6
+ import { l as logger } from "../../../logger-hqtl8hFM.js";
7
+ import { c as createConnectorFromPath } from "../../../connector-factory-DFv3ex0X.js";
8
8
  var require_retry_failed_labor_tickets = __commonJS({
9
9
  "services/data-sync-service/jobs/retry-failed-labor-tickets.js"(exports, module) {
10
10
  const main = async () => {
@@ -1,5 +1,5 @@
1
1
  import knex from "knex";
2
- import { l as logger } from "../../../logger-QG73MndU.js";
2
+ import { l as logger } from "../../../logger-hqtl8hFM.js";
3
3
  import { c as config } from "../../../knexfile-1qKKIORB.js";
4
4
  const db = knex(config.local);
5
5
  async function runMigrations() {
@@ -1,6 +1,6 @@
1
- import "../../../config-2l5vnNkA.js";
2
- import { l as logger } from "../../../logger-QG73MndU.js";
3
- import { c as createConnectorFromPath } from "../../../connector-factory-CQ8e7Tae.js";
1
+ import "../../../config-WKwu1mMo.js";
2
+ import { l as logger } from "../../../logger-hqtl8hFM.js";
3
+ import { c as createConnectorFromPath } from "../../../connector-factory-DFv3ex0X.js";
4
4
  const main = async () => {
5
5
  try {
6
6
  logger.info('Worker for job "to-erp" online');
@@ -5,5 +5,8 @@
5
5
  export { RestAPIService } from "./rest/rest-api-service";
6
6
  export type { QueryParams } from "./rest/get-query-params";
7
7
  export { GraphQLService } from "./graphql/graphql-service";
8
- export { OAuthClient } from "./oauth-client";
8
+ export type { GraphQLServerError } from './graphql/types';
9
+ export { OAuthClient } from './oauth-client';
10
+ export type { OAuthConfig } from './oauth-client';
11
+ export type { APIResponse } from './types';
9
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/erp-api-services/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/erp-api-services/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG1D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
@@ -199,6 +199,26 @@ export declare class MMApiClient {
199
199
  */
200
200
  addFailedLaborTicketRefs(system: ERPType, failedTicketRefs: string[]): Promise<MMApiBaseResponse>;
201
201
  fetchFailedLaborTickets(system: ERPType): Promise<MMReceiveLaborTicket[]>;
202
+ /**
203
+ * Send connector logs to the MM API
204
+ * @param logEntry Single log entry to send
205
+ * @returns Promise with the API response
206
+ */
207
+ sendConnectorLog(logEntry: {
208
+ source: string;
209
+ level: string;
210
+ message: string;
211
+ }): Promise<MMApiBaseResponse>;
212
+ /**
213
+ * Send bulk connector logs to the MM API
214
+ * @param logs Array of log entries to send
215
+ * @returns Promise with the API response
216
+ */
217
+ sendBulkConnectorLogs(logs: {
218
+ source: string;
219
+ level: string;
220
+ message: string;
221
+ }[]): Promise<MMApiBaseResponse>;
202
222
  deleteFailedLaborTicketIds(system: ERPType, laborTicketRefs: string[]): Promise<MMApiBaseResponse>;
203
223
  /**
204
224
  * Fetch machine groups from the MM API
@@ -1 +1 @@
1
- {"version":3,"file":"mm-api-service.d.ts","sourceRoot":"","sources":["../../../src/services/mm-api-service/mm-api-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACL,UAAU,EAIX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,gCAAgC,CAAC;AAYxC;;;GAGG;AACH,qBAAa,WAAW;IACtB,QAAQ,EAAE,cAAc,CAAC;IACzB,GAAG,EAAE,UAAU,CAAC;IAEhB,OAAO,CAAC,QAAQ,CAA0B;IAE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IG;IACG,wBAAwB,CAC5B,MAAM,EAAE,OAAO,EACf,gBAAgB,EAAE,MAAM,EAAE,GACzB,OAAO,CAAC,iBAAiB,CAAC;IAQvB,uBAAuB,CAC3B,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAUlC;;;;OAIG;IACG,gBAAgB,CAAC,QAAQ,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAShH;;;;OAIG;IACG,qBAAqB,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAS7G,0BAA0B,CAC9B,MAAM,EAAE,OAAO,EACf,eAAe,EAAE,MAAM,EAAE,GACxB,OAAO,CAAC,iBAAiB,CAAC;IAQ7B;;;OAGG;IACG,kBAAkB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAQ5D;;;OAGG;IACG,yBAAyB,IAAI,OAAO,CAAC,yBAAyB,CAAC;IAOrE;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAO/B"}
@@ -0,0 +1,56 @@
1
+ import type { LogEntry } from './mm-connector-logger';
2
+ /**
3
+ * Implement a custom LogDeduper or use the provided FileLogDeduper
4
+ */
5
+ export interface LogDeduper {
6
+ decide(entry: LogEntry, now: number): Promise<string | null>;
7
+ onSuccess(entry: LogEntry, now: number): Promise<void>;
8
+ retryFailedTransmissions?(send: (entry: LogEntry, message: string) => Promise<void>): Promise<void>;
9
+ }
10
+ /**
11
+ * FileLogDeduper implements the LogDeduper interface to deduplicate
12
+ * logs by storing them in a file; this allows deduping across jobs.
13
+ */
14
+ export declare class FileLogDeduper implements LogDeduper {
15
+ private readonly storeFilePath;
16
+ private readonly windowMs;
17
+ private readonly ttlMs;
18
+ private readonly sweepIntervalMs;
19
+ private lastSweepTsMs;
20
+ private readonly DEFAULT_WINDOW_TEN_MINS;
21
+ private readonly DEFAULT_TTL_ONE_HOUR;
22
+ private readonly DEFAULT_SWEEP_INTERVAL_FIVE_MINS;
23
+ private readonly DEFAULT_STORE_FILE_PATH;
24
+ /**
25
+ * Ctor.
26
+ * @param storeFilePath: The path to the file where the deduplication store is stored; recommended is to use the default
27
+ * @param windowSeconds: Suppression window. Duplicates within this period are suppressed.
28
+ * @param ttlSeconds: Eviction TTL. Store entries for keys inactive beyond this are removed. Enforced to be ≥ windowSeconds.
29
+ * @param sweepIntervalSeconds: Efficiency parameter. How often (min interval) to run opportunistic eviction; retry always sweeps
30
+ * The sweep is lazy, used only when the store is accessed
31
+ */
32
+ constructor({ storeFilePath, windowSeconds, ttlSeconds, sweepIntervalSeconds }?: {
33
+ storeFilePath?: string;
34
+ windowSeconds?: number;
35
+ ttlSeconds?: number;
36
+ sweepIntervalSeconds?: number;
37
+ });
38
+ /**
39
+ * Deduplication gating function
40
+ * Returns the formatted message to send, or null to suppress
41
+ * Decision is based on the dedupeKey and the time of the entry
42
+ */
43
+ decide(entry: LogEntry, now: number): Promise<string | null>;
44
+ onSuccess(entry: LogEntry, now: number): Promise<void>;
45
+ retryFailedTransmissions(send: (entry: LogEntry, message: string) => Promise<void>): Promise<void>;
46
+ private ensureStoreFileExists;
47
+ private readStore;
48
+ private writeStore;
49
+ private formatMessage;
50
+ private withLock;
51
+ /**
52
+ * Evict expired entries from the store based on the TTL and the key's last transmitted time
53
+ */
54
+ private evictExpiredInStore;
55
+ }
56
+ //# sourceMappingURL=log-deduper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-deduper.d.ts","sourceRoot":"","sources":["../../../src/utils/connector-log/log-deduper.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAkB,MAAM,uBAAuB,CAAC;AAEtE;;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AAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBtD,wBAAwB,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAyCxG,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,aAAa;YAUP,QAAQ;IA2BtB;;OAEG;IACH,OAAO,CAAC,mBAAmB;CAW5B"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=mm-connector-logger-example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mm-connector-logger-example.d.ts","sourceRoot":"","sources":["../../../src/utils/connector-log/mm-connector-logger-example.ts"],"names":[],"mappings":""}
@@ -0,0 +1,74 @@
1
+ import type { LogDeduper } from './log-deduper';
2
+ export type LogLevelString = 'info' | 'warn' | 'error';
3
+ /**
4
+ * dedupeKey - key used to deduplicate log entries when a LogDeduper is injected into the MMConnectorLogger
5
+ *
6
+ * A recommended practice is to use a meaningful unique identifier for this log entry type.
7
+ * Examples: SyncFromERPCompleted
8
+ * SyncFromERPError:HTTPError
9
+ */
10
+ export declare class LogEntry {
11
+ level: LogLevelString;
12
+ message: string;
13
+ dedupeKey: string;
14
+ eventTime: number;
15
+ constructor(params: {
16
+ level: LogLevelString;
17
+ message: string;
18
+ dedupeKey: string;
19
+ });
20
+ }
21
+ /**
22
+ * The response from the MM connector logging API
23
+ */
24
+ export interface LogResponse {
25
+ message: string;
26
+ processed?: number;
27
+ }
28
+ /**
29
+ * MM Connector Logger for sending progress and error updates to the MM cloud
30
+ *
31
+ * This class provides helper methods to send individual logs to the
32
+ * MM connector logging API, providing support for validation, retries, and error handling
33
+ * according to the API specification.
34
+ *
35
+ * By injecting a LogDeduper, the log entries are deduplicated across jobs over a specified time window
36
+ */
37
+ export declare class MMConnectorLogger {
38
+ private readonly MAX_MSG_LEN;
39
+ private mmApiClient;
40
+ private readonly deduper?;
41
+ private readonly source;
42
+ constructor(source: string, deduper?: LogDeduper);
43
+ /**
44
+ * Send a single log entry to the MM cloud with deduplication.
45
+ *
46
+ * The deduplication is handled by the injected LogDeduper.
47
+ * If no deduper is injected, the log entry is sent without deduplication.
48
+ *
49
+ * The standard deduper, FileLogDeduper, stores the deduplication state in a file,
50
+ * allowing deduplication across jobs,
51
+ *
52
+ * @param logEntry - The log entry to send
53
+ * @returns Promise resolving to the API response or null if suppressed
54
+ * @throws HTTPError if the request fails or Error if the log entry is invalid
55
+ */
56
+ sendLog(logEntry: LogEntry): Promise<LogResponse | null>;
57
+ /**
58
+ * @throws Error if validation fails
59
+ */
60
+ private validateLogEntry;
61
+ /**
62
+ * Retry all failed transmissions silently
63
+ * This method attempts to retry all messages that failed to transmit
64
+ * and removes them from the failed list if successful, else leaves them for the client to retry
65
+ *
66
+ * Expected usage is by a client to call this as part of its own retry mechanism
67
+ */
68
+ retryFailedTransmissions(): Promise<void>;
69
+ /**
70
+ * Clean up resources
71
+ */
72
+ destroy(): Promise<void>;
73
+ }
74
+ //# sourceMappingURL=mm-connector-logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mm-connector-logger.d.ts","sourceRoot":"","sources":["../../../src/utils/connector-log/mm-connector-logger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEvD;;;;;;GAMG;AACH,qBAAa,QAAQ;IACnB,KAAK,EAAE,cAAc,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;gBAEN,MAAM,EAAE;QAAE,KAAK,EAAE,cAAc,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAC;CAMjF;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAaD;;;;;;;;GAQG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;IAEpC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAa;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU;IAYhD;;;;;;;;;;;;OAYG;IACG,OAAO,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAsC9D;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAsBxB;;;;;;OAMG;IACG,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC;IAa/C;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B"}
@@ -0,0 +1,2 @@
1
+ export declare function getErrorType(error: unknown): string;
2
+ //# sourceMappingURL=error-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-utils.d.ts","sourceRoot":"","sources":["../../src/utils/error-utils.ts"],"names":[],"mappings":"AAQA,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CASnD"}
@@ -25,7 +25,8 @@ export { BatchCacheManager } from "../services/caching-service/batch-cache-manag
25
25
  * Process and data transformation utilities
26
26
  */
27
27
  export { StandardProcessDrivers } from "./standard-process-drivers/";
28
- export type { WriteEntitiesToMMResult, MMBatchValidationError, } from "./standard-process-drivers/";
28
+ export type { WriteEntitiesToMMResult } from "./standard-process-drivers/";
29
+ export { MMBatchValidationError } from "./standard-process-drivers/";
29
30
  export { getCachedTimezoneOffset } from "./local-data-store/jobs-shared-data";
30
31
  export { getInitialLoadComplete, setInitialLoadComplete, } from "./local-data-store/jobs-shared-data";
31
32
  /**
@@ -38,10 +39,17 @@ export { getERPAPITypeFromEntity } from "./erp-type-from-entity";
38
39
  * HTTP Client utilities
39
40
  */
40
41
  export { HTTPClientFactory } from "./http-client";
42
+ export type { HTTPClient, HTTPRequestConfig, HTTPResponse, HTTPError } from "./http-client";
41
43
  /**
42
44
  * MM Labor Ticket utilities
43
45
  */
44
46
  export * from "./mm-labor-ticket-helpers";
47
+ export { getErrorType } from './error-utils';
48
+ /**
49
+ * MM Connector Logger utilities
50
+ */
51
+ export { MMConnectorLogger, type LogResponse, type LogEntry, type LogLevelString } from './connector-log/mm-connector-logger';
52
+ export { FileLogDeduper } from './connector-log/log-deduper';
45
53
  /**
46
54
  * Application initializer
47
55
  */
@@ -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,EAC7B,0BAA0B,GAC3B,MAAM,uBAAuB,CAAC;AAE/B;;GAEG;AACH,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAC5D,cAAc,cAAc,CAAC;AAE7B;;GAEG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAC5F,YAAY,EAAE,oBAAoB,EAA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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"}
@@ -1,3 +1,4 @@
1
1
  export { StandardProcessDrivers } from "./standard-process-drivers";
2
- export type { WriteEntitiesToMMResult, MMBatchValidationError, } from "./standard-process-drivers";
2
+ export type { WriteEntitiesToMMResult } from "./standard-process-drivers";
3
+ export { MMBatchValidationError } from "./standard-process-drivers";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/standard-process-drivers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,YAAY,EACV,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/standard-process-drivers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,YAAY,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,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.2",
4
+ "version": "0.1.4-beta.0",
5
5
  "license": "MIT",
6
6
  "author": "machinemetrics",
7
7
  "main": "dist/mm-erp-sdk.js",
package/src/index.ts CHANGED
@@ -48,6 +48,7 @@ export {
48
48
  formatDateWithTZOffset,
49
49
  applyTimezoneOffsetsToFields,
50
50
  convertToLocalTime,
51
+ getErrorType,
51
52
  } from "./utils";
52
53
 
53
54
  // Local data store
@@ -55,7 +56,7 @@ export { getInitialLoadComplete, setInitialLoadComplete } from "./utils";
55
56
 
56
57
  // HTTP client factory and types for custom API integrations
57
58
  export { HTTPClientFactory } from "./utils/http-client";
58
- export type { HTTPResponse } from "./utils/http-client";
59
+ export type { HTTPResponse, HTTPError, HTTPClient, HTTPRequestConfig } from "./utils/http-client";
59
60
 
60
61
  // Application initialization utilities
61
62
  export { ApplicationInitializer } from "./utils/application-initializer";
@@ -71,9 +72,11 @@ export type { IERPLaborTicketHandler } from "./types/erp-connector";
71
72
 
72
73
  // Process drivers and utilities
73
74
  export { StandardProcessDrivers, getCachedTimezoneOffset } from "./utils";
74
- export type { WriteEntitiesToMMResult, MMBatchValidationError } from "./utils";
75
+ export type { WriteEntitiesToMMResult } from "./utils";
76
+ export { MMBatchValidationError } from "./utils";
75
77
 
76
78
  // API services
79
+ export type { APIResponse } from './services/erp-api-services/types';
77
80
  export { RestAPIService } from "./services/erp-api-services/rest/rest-api-service";
78
81
  export { ErrorHandler } from "./services/erp-api-services/errors";
79
82
  export type {
@@ -100,3 +103,6 @@ export {
100
103
  SqlServerHelper,
101
104
  } from "./services/sql-server-erp-service";
102
105
  export type { SQLInput } from "./services/sql-server-erp-service";
106
+
107
+ // MM Connector Logging
108
+ export { MMConnectorLogger, FileLogDeduper, type LogEntry, type LogLevelString, type LogResponse } from './utils';
@@ -9,6 +9,11 @@ export type { QueryParams } from "./rest/get-query-params";
9
9
 
10
10
  // GraphQL Service
11
11
  export { GraphQLService } from "./graphql/graphql-service";
12
+ export type { GraphQLServerError } from './graphql/types';
12
13
 
13
14
  // OAuth Client
14
- export { OAuthClient } from "./oauth-client";
15
+ export { OAuthClient } from './oauth-client';
16
+ export type { OAuthConfig } from './oauth-client';
17
+
18
+ // API Response
19
+ export type { APIResponse } from './types';
@@ -60,7 +60,7 @@ export class MMApiClient {
60
60
  [UrlBase.ApiBase]: CoreConfiguration.inst().mmApiBaseUrl,
61
61
  };
62
62
  this.api = HTTPClientFactory.getInstance({
63
- baseUrl: CoreConfiguration.inst().mmERPSvcApiBaseUrl,
63
+ baseUrl: '',
64
64
  retryAttempts: CoreConfiguration.inst().mmApiRetryAttempts,
65
65
  });
66
66
  }
@@ -646,6 +646,34 @@ export class MMApiClient {
646
646
  );
647
647
  }
648
648
 
649
+ /**
650
+ * Send connector logs to the MM API
651
+ * @param logEntry Single log entry to send
652
+ * @returns Promise with the API response
653
+ */
654
+ async sendConnectorLog(logEntry: { source: string; level: string; message: string }): Promise<MMApiBaseResponse> {
655
+ return await this.postData(
656
+ '/connector/logs',
657
+ logEntry,
658
+ {},
659
+ { baseUrl: UrlBase.ApiBase }
660
+ );
661
+ }
662
+
663
+ /**
664
+ * Send bulk connector logs to the MM API
665
+ * @param logs Array of log entries to send
666
+ * @returns Promise with the API response
667
+ */
668
+ async sendBulkConnectorLogs(logs: { source: string; level: string; message: string }[]): Promise<MMApiBaseResponse> {
669
+ return await this.postData(
670
+ '/connector/logs',
671
+ { logs },
672
+ {},
673
+ { baseUrl: UrlBase.ApiBase }
674
+ );
675
+ }
676
+
649
677
  async deleteFailedLaborTicketIds(
650
678
  system: ERPType,
651
679
  laborTicketRefs: string[]