@teincfood/core 0.10.9 → 0.10.10

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.
@@ -12,7 +12,7 @@ import { REFERENCE_CHANGED_EVENT_TYPE } from "../reference/events";
12
12
  import { applyReferenceChangeEvent } from "../reference/events";
13
13
  import { referenceSyncService } from "../reference/service";
14
14
  import { openSyncDatabase } from "../db/connection";
15
- import { insertOrder, listOrdersWithHlc } from "../db/operations";
15
+ import { getUnsyncedEvents, insertOrder, listOrdersWithHlc } from "../db/operations";
16
16
  import { getPendingOrdersSnapshot } from "../adapters/pending-orders";
17
17
  import { generateEventId } from "../utils/uuid";
18
18
  import { createLocalOrder, transitionLocalOrder } from "../domain/orders/service";
@@ -116,7 +116,18 @@ class LocalNodeServiceCore {
116
116
  for (const order of rows)
117
117
  byId.set(order.id, order);
118
118
  // Queued offline creations have no `orders` row yet; they live in the
119
- // pending overlay. Include them so a pre-linkup sale is shared too.
119
+ // pending overlay and the durable event journal. Include both so a
120
+ // pre-linkup sale is shared even after an app restart.
121
+ for (const origin of ["local", "lan"]) {
122
+ const events = await getUnsyncedEvents(db, origin, Number.MAX_SAFE_INTEGER);
123
+ for (const event of events) {
124
+ if (event.event_type !== "order.create_queued")
125
+ continue;
126
+ const order = event.payload;
127
+ if (order?.id && order.order_number)
128
+ byId.set(order.id, order);
129
+ }
130
+ }
120
131
  for (const order of getPendingOrdersSnapshot().orders) {
121
132
  if (order.business_id === this.businessId)
122
133
  byId.set(order.id, order);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teincfood/core",
3
- "version": "0.10.9",
3
+ "version": "0.10.10",
4
4
  "description": "TeincFood shared offline-first core — types, sync engine, local DB, reference data, and repositories for mobile + desktop",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",