@machinemetrics/mm-erp-sdk 0.2.0-beta.2 → 0.2.0-beta.3

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.
@@ -3988,7 +3988,7 @@ class NatsService {
3988
3988
  natsConnected: this.isConnected()
3989
3989
  };
3990
3990
  await this.publish(
3991
- `mm.14.${this.config.locationRef}.erp.status`,
3991
+ `mm.16.${this.config.locationRef}.status`,
3992
3992
  status
3993
3993
  );
3994
3994
  logger.debug("Published connector status");
@@ -4079,7 +4079,7 @@ class NatsLaborTicketListener {
4079
4079
  this.registerLaborTicketHandler(companyInfo.locationRef, erpType);
4080
4080
  await this.natsService.connect();
4081
4081
  logger.info("NATS listener started successfully", {
4082
- subject: `mm.14.${companyInfo.locationRef}.labor-ticket.*`
4082
+ subject: `mm.16.${companyInfo.locationRef}.labor-ticket.*`
4083
4083
  });
4084
4084
  } catch (error) {
4085
4085
  logger.error("Failed to start NATS listener", { error });
@@ -4091,7 +4091,7 @@ class NatsLaborTicketListener {
4091
4091
  registerHealthCheckHandler(locationRef, erpType) {
4092
4092
  if (!this.natsService) return;
4093
4093
  this.natsService.registerHandler({
4094
- subject: `mm.14.${locationRef}.erp.health`,
4094
+ subject: `mm.16.${locationRef}.health`,
4095
4095
  description: "Health check - responds immediately to indicate connector is online",
4096
4096
  handler: {
4097
4097
  handle: async () => {
@@ -4112,7 +4112,7 @@ class NatsLaborTicketListener {
4112
4112
  registerLaborTicketHandler(locationRef, erpType) {
4113
4113
  if (!this.natsService) return;
4114
4114
  this.natsService.registerHandler({
4115
- subject: `mm.14.${locationRef}.labor-ticket.*`,
4115
+ subject: `mm.16.${locationRef}.labor-ticket.*`,
4116
4116
  description: "Process labor tickets in real-time from NATS",
4117
4117
  handler: {
4118
4118
  handle: async ({ data }, subject) => {
@@ -4272,6 +4272,7 @@ class NatsLaborTicketListener {
4272
4272
  */
4273
4273
  async updateCheckpoint(erpType, result) {
4274
4274
  const mmApiClient = new MMApiClient();
4275
+ const newTimestamp = (/* @__PURE__ */ new Date()).toISOString();
4275
4276
  const currentCheckpoint = await mmApiClient.getCheckpoint({
4276
4277
  system: erpType,
4277
4278
  table: "labor_tickets",
@@ -4281,7 +4282,6 @@ class NatsLaborTicketListener {
4281
4282
  }
4282
4283
  });
4283
4284
  const currentTimestamp = currentCheckpoint?.timestamp;
4284
- const newTimestamp = result.laborTicket.updatedAt || (/* @__PURE__ */ new Date()).toISOString();
4285
4285
  if (!currentTimestamp || new Date(newTimestamp) > new Date(currentTimestamp)) {
4286
4286
  await mmApiClient.saveCheckpoint({
4287
4287
  system: erpType,