@teincfood/core 0.9.21 → 0.9.23
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/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/reference/service.js +13 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -150,7 +150,7 @@ export { orderEventsService } from "./realtime/order-events.service";
|
|
|
150
150
|
export { useEventsConnection } from "./realtime/useEventsConnection";
|
|
151
151
|
export { getSyncJobsPendingCount, debugDumpSyncJobs, drainPending } from "./sync/sync-jobs.service";
|
|
152
152
|
export { performFullSync } from "./sync/full-sync";
|
|
153
|
-
export { stopHealthProbe } from "./sync/health-probe";
|
|
153
|
+
export { stopHealthProbe, probeCloudHealth } from "./sync/health-probe";
|
|
154
154
|
export { notifyAuthChanged, subscribeAuth } from "./adapters/auth";
|
|
155
155
|
export { isAuthenticated, hasActiveBusiness, canBusinessSync, setOfflineSyncEnabled, isOfflineSyncEnabled } from "./sync/sync-guard";
|
|
156
156
|
export { ACCESS_EXPIRED_CODE, SESSION_DEAD_CODES, SKIP_AUTH_RETRY, extractAuthFailure, isAccessExpired, isSessionDead, hasAuthRetrySkip, refreshSession, withAuthRetry, } from "./auth/session";
|
package/dist/index.js
CHANGED
|
@@ -164,7 +164,7 @@ export { useEventsConnection } from "./realtime/useEventsConnection";
|
|
|
164
164
|
// ── Sync jobs (POS primary sync) — debug helpers for DiagnosticsScreen
|
|
165
165
|
export { getSyncJobsPendingCount, debugDumpSyncJobs, drainPending } from "./sync/sync-jobs.service";
|
|
166
166
|
export { performFullSync } from "./sync/full-sync";
|
|
167
|
-
export { stopHealthProbe } from "./sync/health-probe";
|
|
167
|
+
export { stopHealthProbe, probeCloudHealth } from "./sync/health-probe";
|
|
168
168
|
export { notifyAuthChanged, subscribeAuth } from "./adapters/auth";
|
|
169
169
|
export { isAuthenticated, hasActiveBusiness, canBusinessSync, setOfflineSyncEnabled, isOfflineSyncEnabled } from "./sync/sync-guard";
|
|
170
170
|
// ── Session lifecycle (access-expired → refresh → refresh-expired → logout)
|
|
@@ -14,6 +14,7 @@ import { menuService, businessService, rolesService } from "../adapters/services
|
|
|
14
14
|
import { cacheImageBatch, pruneImageCache } from "../adapters/image-cache";
|
|
15
15
|
import { getConnectivityState } from "../adapters/connectivity";
|
|
16
16
|
import { canBusinessSync } from "../sync/sync-guard";
|
|
17
|
+
import { getAuthToken } from "../adapters/auth";
|
|
17
18
|
import { paceSync, isRateLimited } from "../sync/rate-limit";
|
|
18
19
|
import { getReferenceData, getReferenceVersion, mergeReferenceData, writeServerReferenceData, } from "./operations";
|
|
19
20
|
import { anchorServerTime } from "./entitlement-clock";
|
|
@@ -119,6 +120,18 @@ class ReferenceSyncService {
|
|
|
119
120
|
catch (error) {
|
|
120
121
|
result.failed.push(key);
|
|
121
122
|
result.errors[key] = String(error);
|
|
123
|
+
// A persisted-but-expired session can pass `canBusinessSync` on the
|
|
124
|
+
// stale token; the first request then 401s and core's session
|
|
125
|
+
// lifecycle clears auth mid-pass. Every remaining key would just fail
|
|
126
|
+
// with "no authentication token" — abort quietly instead of emitting
|
|
127
|
+
// one error per key. Expected logout, not a sync fault.
|
|
128
|
+
if (!getAuthToken()) {
|
|
129
|
+
for (const remaining of keys.slice(keys.indexOf(key) + 1)) {
|
|
130
|
+
result.skipped.push(remaining);
|
|
131
|
+
}
|
|
132
|
+
syncLogger.warn("ReferenceSync", "Aborting sync — session ended mid-pass (logged out)", { key });
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
122
135
|
syncLogger.error("ReferenceSync", `Failed to sync ${key}`, {
|
|
123
136
|
error: String(error),
|
|
124
137
|
});
|
package/package.json
CHANGED