@pol-studios/powersync 1.0.4 → 1.0.7
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/CacheSettingsManager-1exbOC6S.d.ts +261 -0
- package/dist/attachments/index.d.ts +65 -355
- package/dist/attachments/index.js +24 -6
- package/dist/{types-Cd7RhNqf.d.ts → background-sync-ChCXW-EV.d.ts} +53 -2
- package/dist/chunk-4C3RY5SU.js +204 -0
- package/dist/chunk-4C3RY5SU.js.map +1 -0
- package/dist/{chunk-3AYXHQ4W.js → chunk-53WH2JJV.js} +111 -47
- package/dist/chunk-53WH2JJV.js.map +1 -0
- package/dist/chunk-A4IBBWGO.js +377 -0
- package/dist/chunk-A4IBBWGO.js.map +1 -0
- package/dist/chunk-BREGB4WL.js +1768 -0
- package/dist/chunk-BREGB4WL.js.map +1 -0
- package/dist/{chunk-EJ23MXPQ.js → chunk-CGL33PL4.js} +3 -1
- package/dist/chunk-CGL33PL4.js.map +1 -0
- package/dist/chunk-DGUM43GV.js +11 -0
- package/dist/chunk-DHYUBVP7.js +131 -0
- package/dist/chunk-DHYUBVP7.js.map +1 -0
- package/dist/chunk-FV2HXEIY.js +124 -0
- package/dist/chunk-FV2HXEIY.js.map +1 -0
- package/dist/chunk-GKF7TOMT.js +1 -0
- package/dist/{chunk-OTJXIRWX.js → chunk-H772V6XQ.js} +304 -51
- package/dist/chunk-H772V6XQ.js.map +1 -0
- package/dist/{chunk-C2RSTGDC.js → chunk-HFOFLW5F.js} +525 -87
- package/dist/chunk-HFOFLW5F.js.map +1 -0
- package/dist/chunk-KGSFAE5B.js +1 -0
- package/dist/chunk-LNL64IJZ.js +1 -0
- package/dist/chunk-MKD2VCX3.js +32 -0
- package/dist/chunk-MKD2VCX3.js.map +1 -0
- package/dist/{chunk-7EMDVIZX.js → chunk-N75DEF5J.js} +19 -1
- package/dist/chunk-N75DEF5J.js.map +1 -0
- package/dist/chunk-P6WOZO7H.js +49 -0
- package/dist/chunk-P6WOZO7H.js.map +1 -0
- package/dist/chunk-TGBT5XBE.js +1 -0
- package/dist/chunk-TGBT5XBE.js.map +1 -0
- package/dist/chunk-UEYRTLKE.js +72 -0
- package/dist/chunk-UEYRTLKE.js.map +1 -0
- package/dist/chunk-WGHNIAF7.js +329 -0
- package/dist/chunk-WGHNIAF7.js.map +1 -0
- package/dist/chunk-WQ5MPAVC.js +449 -0
- package/dist/chunk-WQ5MPAVC.js.map +1 -0
- package/dist/{chunk-FPTDATY5.js → chunk-XQAJM2MW.js} +22 -11
- package/dist/chunk-XQAJM2MW.js.map +1 -0
- package/dist/chunk-YSTEESEG.js +676 -0
- package/dist/chunk-YSTEESEG.js.map +1 -0
- package/dist/chunk-ZEOKPWUC.js +1165 -0
- package/dist/chunk-ZEOKPWUC.js.map +1 -0
- package/dist/connector/index.d.ts +182 -2
- package/dist/connector/index.js +14 -3
- package/dist/core/index.d.ts +5 -3
- package/dist/core/index.js +5 -2
- package/dist/error/index.d.ts +54 -0
- package/dist/error/index.js +8 -0
- package/dist/error/index.js.map +1 -0
- package/dist/index.d.ts +237 -11
- package/dist/index.js +183 -27
- package/dist/index.native.d.ts +20 -9
- package/dist/index.native.js +183 -28
- package/dist/index.web.d.ts +20 -9
- package/dist/index.web.js +184 -28
- package/dist/maintenance/index.d.ts +118 -0
- package/dist/maintenance/index.js +17 -0
- package/dist/maintenance/index.js.map +1 -0
- package/dist/platform/index.d.ts +16 -1
- package/dist/platform/index.js +2 -0
- package/dist/platform/index.js.map +1 -1
- package/dist/platform/index.native.d.ts +2 -2
- package/dist/platform/index.native.js +2 -1
- package/dist/platform/index.web.d.ts +1 -1
- package/dist/platform/index.web.js +2 -1
- package/dist/pol-attachment-queue-C7YNXXhK.d.ts +676 -0
- package/dist/provider/index.d.ts +693 -12
- package/dist/provider/index.js +57 -12
- package/dist/storage/index.d.ts +6 -0
- package/dist/storage/index.js +28 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/index.native.d.ts +6 -0
- package/dist/storage/index.native.js +26 -0
- package/dist/storage/index.native.js.map +1 -0
- package/dist/storage/index.web.d.ts +6 -0
- package/dist/storage/index.web.js +26 -0
- package/dist/storage/index.web.js.map +1 -0
- package/dist/storage/upload/index.d.ts +55 -0
- package/dist/storage/upload/index.js +15 -0
- package/dist/storage/upload/index.js.map +1 -0
- package/dist/storage/upload/index.native.d.ts +57 -0
- package/dist/storage/upload/index.native.js +14 -0
- package/dist/storage/upload/index.native.js.map +1 -0
- package/dist/storage/upload/index.web.d.ts +5 -0
- package/dist/storage/upload/index.web.js +14 -0
- package/dist/storage/upload/index.web.js.map +1 -0
- package/dist/{index-Cb-NI0Ct.d.ts → supabase-connector-qLm-WHkM.d.ts} +146 -10
- package/dist/sync/index.d.ts +288 -22
- package/dist/sync/index.js +23 -5
- package/dist/types-BVacP54t.d.ts +52 -0
- package/dist/types-Bgvx7-E8.d.ts +187 -0
- package/dist/{types-afHtE1U_.d.ts → types-CDqWh56B.d.ts} +2 -0
- package/package.json +72 -2
- package/dist/chunk-32OLICZO.js +0 -1
- package/dist/chunk-3AYXHQ4W.js.map +0 -1
- package/dist/chunk-7EMDVIZX.js.map +0 -1
- package/dist/chunk-7JQZBZ5N.js +0 -1
- package/dist/chunk-C2RSTGDC.js.map +0 -1
- package/dist/chunk-EJ23MXPQ.js.map +0 -1
- package/dist/chunk-FPTDATY5.js.map +0 -1
- package/dist/chunk-GMFDCVMZ.js +0 -1285
- package/dist/chunk-GMFDCVMZ.js.map +0 -1
- package/dist/chunk-OLHGI472.js +0 -1
- package/dist/chunk-OTJXIRWX.js.map +0 -1
- package/dist/chunk-V6LJ6MR2.js +0 -740
- package/dist/chunk-V6LJ6MR2.js.map +0 -1
- package/dist/chunk-VJCL2SWD.js +0 -1
- /package/dist/{chunk-32OLICZO.js.map → chunk-DGUM43GV.js.map} +0 -0
- /package/dist/{chunk-7JQZBZ5N.js.map → chunk-GKF7TOMT.js.map} +0 -0
- /package/dist/{chunk-OLHGI472.js.map → chunk-KGSFAE5B.js.map} +0 -0
- /package/dist/{chunk-VJCL2SWD.js.map → chunk-LNL64IJZ.js.map} +0 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
// src/connector/circuit-breaker.ts
|
|
2
|
+
var DEFAULT_CIRCUIT_BREAKER_CONFIG = {
|
|
3
|
+
failureThreshold: 5,
|
|
4
|
+
failureWindowMs: 6e4,
|
|
5
|
+
initialRecoveryDelayMs: 1e3,
|
|
6
|
+
maxRecoveryDelayMs: 32e3,
|
|
7
|
+
backoffMultiplier: 2
|
|
8
|
+
};
|
|
9
|
+
var CircuitOpenError = class extends Error {
|
|
10
|
+
constructor(timeUntilRetryMs, stats) {
|
|
11
|
+
super(`Circuit breaker is OPEN. Service is unavailable. Retry in ${Math.ceil(timeUntilRetryMs / 1e3)}s after ${stats.openCount} failures.`);
|
|
12
|
+
this.timeUntilRetryMs = timeUntilRetryMs;
|
|
13
|
+
this.stats = stats;
|
|
14
|
+
this.name = "CircuitOpenError";
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var CircuitBreaker = class {
|
|
18
|
+
state = "CLOSED";
|
|
19
|
+
failures = [];
|
|
20
|
+
// Timestamps of failures within window
|
|
21
|
+
successCount = 0;
|
|
22
|
+
openCount = 0;
|
|
23
|
+
lastOpenedAt = null;
|
|
24
|
+
lastClosedAt = null;
|
|
25
|
+
currentRecoveryDelay;
|
|
26
|
+
halfOpenTimer = null;
|
|
27
|
+
halfOpenScheduledAt = null;
|
|
28
|
+
config;
|
|
29
|
+
constructor(config = {}) {
|
|
30
|
+
this.config = {
|
|
31
|
+
...DEFAULT_CIRCUIT_BREAKER_CONFIG,
|
|
32
|
+
...config
|
|
33
|
+
};
|
|
34
|
+
this.currentRecoveryDelay = this.config.initialRecoveryDelayMs;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get current state
|
|
38
|
+
*/
|
|
39
|
+
getState() {
|
|
40
|
+
return this.state;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get circuit breaker statistics
|
|
44
|
+
*/
|
|
45
|
+
getStats() {
|
|
46
|
+
return {
|
|
47
|
+
state: this.state,
|
|
48
|
+
failureCount: this.failures.length,
|
|
49
|
+
successCount: this.successCount,
|
|
50
|
+
openCount: this.openCount,
|
|
51
|
+
lastOpenedAt: this.lastOpenedAt,
|
|
52
|
+
lastClosedAt: this.lastClosedAt,
|
|
53
|
+
currentRecoveryDelayMs: this.currentRecoveryDelay,
|
|
54
|
+
timeUntilHalfOpenMs: this.getTimeUntilHalfOpen()
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Check if requests are allowed through the circuit
|
|
59
|
+
*/
|
|
60
|
+
isAllowed() {
|
|
61
|
+
this.cleanupOldFailures();
|
|
62
|
+
switch (this.state) {
|
|
63
|
+
case "CLOSED":
|
|
64
|
+
return true;
|
|
65
|
+
case "HALF_OPEN":
|
|
66
|
+
return true;
|
|
67
|
+
// Allow test request
|
|
68
|
+
case "OPEN":
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Check if request can proceed, throws if not
|
|
74
|
+
*/
|
|
75
|
+
checkAllowed() {
|
|
76
|
+
if (!this.isAllowed()) {
|
|
77
|
+
throw new CircuitOpenError(this.getTimeUntilHalfOpen() ?? 0, this.getStats());
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Record a successful operation
|
|
82
|
+
*/
|
|
83
|
+
recordSuccess() {
|
|
84
|
+
this.successCount++;
|
|
85
|
+
if (this.state === "HALF_OPEN") {
|
|
86
|
+
this.transition("CLOSED");
|
|
87
|
+
this.currentRecoveryDelay = this.config.initialRecoveryDelayMs;
|
|
88
|
+
this.failures = [];
|
|
89
|
+
}
|
|
90
|
+
this.log("debug", "[CircuitBreaker] Success recorded, state:", this.state);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Record a failed operation
|
|
94
|
+
*/
|
|
95
|
+
recordFailure() {
|
|
96
|
+
const now = Date.now();
|
|
97
|
+
this.failures.push(now);
|
|
98
|
+
this.cleanupOldFailures();
|
|
99
|
+
if (this.state === "HALF_OPEN") {
|
|
100
|
+
this.transition("OPEN");
|
|
101
|
+
this.scheduleHalfOpen();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (this.state === "CLOSED") {
|
|
105
|
+
if (this.failures.length >= this.config.failureThreshold) {
|
|
106
|
+
this.log("warn", `[CircuitBreaker] Failure threshold (${this.config.failureThreshold}) exceeded in ${this.config.failureWindowMs}ms window. Opening circuit.`);
|
|
107
|
+
this.transition("OPEN");
|
|
108
|
+
this.scheduleHalfOpen();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Execute an async operation through the circuit breaker
|
|
114
|
+
*/
|
|
115
|
+
async execute(operation) {
|
|
116
|
+
this.checkAllowed();
|
|
117
|
+
try {
|
|
118
|
+
const result = await operation();
|
|
119
|
+
this.recordSuccess();
|
|
120
|
+
return result;
|
|
121
|
+
} catch (error) {
|
|
122
|
+
this.recordFailure();
|
|
123
|
+
throw error;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Manually reset the circuit breaker to CLOSED state
|
|
128
|
+
*/
|
|
129
|
+
reset() {
|
|
130
|
+
this.clearHalfOpenTimer();
|
|
131
|
+
this.failures = [];
|
|
132
|
+
this.successCount = 0;
|
|
133
|
+
this.currentRecoveryDelay = this.config.initialRecoveryDelayMs;
|
|
134
|
+
this.transition("CLOSED");
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Force the circuit to OPEN state (e.g., for manual intervention)
|
|
138
|
+
*/
|
|
139
|
+
forceOpen() {
|
|
140
|
+
this.clearHalfOpenTimer();
|
|
141
|
+
this.transition("OPEN");
|
|
142
|
+
this.scheduleHalfOpen();
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Dispose the circuit breaker (clear timers)
|
|
146
|
+
*/
|
|
147
|
+
dispose() {
|
|
148
|
+
this.clearHalfOpenTimer();
|
|
149
|
+
}
|
|
150
|
+
// ─── Private Methods ─────────────────────────────────────────────────────────
|
|
151
|
+
transition(newState) {
|
|
152
|
+
if (this.state === newState) return;
|
|
153
|
+
const previousState = this.state;
|
|
154
|
+
this.state = newState;
|
|
155
|
+
if (newState === "OPEN") {
|
|
156
|
+
this.openCount++;
|
|
157
|
+
this.lastOpenedAt = /* @__PURE__ */ new Date();
|
|
158
|
+
this.currentRecoveryDelay = Math.min(this.currentRecoveryDelay * this.config.backoffMultiplier, this.config.maxRecoveryDelayMs);
|
|
159
|
+
} else if (newState === "CLOSED") {
|
|
160
|
+
this.lastClosedAt = /* @__PURE__ */ new Date();
|
|
161
|
+
this.successCount = 0;
|
|
162
|
+
}
|
|
163
|
+
this.log("info", `[CircuitBreaker] State transition: ${previousState} -> ${newState}`);
|
|
164
|
+
this.config.onStateChange?.(newState, previousState);
|
|
165
|
+
}
|
|
166
|
+
scheduleHalfOpen() {
|
|
167
|
+
this.clearHalfOpenTimer();
|
|
168
|
+
this.halfOpenScheduledAt = Date.now() + this.currentRecoveryDelay;
|
|
169
|
+
this.log("debug", `[CircuitBreaker] Scheduling HALF_OPEN in ${this.currentRecoveryDelay}ms`);
|
|
170
|
+
this.halfOpenTimer = setTimeout(() => {
|
|
171
|
+
this.halfOpenTimer = null;
|
|
172
|
+
this.halfOpenScheduledAt = null;
|
|
173
|
+
this.transition("HALF_OPEN");
|
|
174
|
+
this.log("info", "[CircuitBreaker] Circuit is now HALF_OPEN, allowing test request");
|
|
175
|
+
}, this.currentRecoveryDelay);
|
|
176
|
+
}
|
|
177
|
+
clearHalfOpenTimer() {
|
|
178
|
+
if (this.halfOpenTimer) {
|
|
179
|
+
clearTimeout(this.halfOpenTimer);
|
|
180
|
+
this.halfOpenTimer = null;
|
|
181
|
+
this.halfOpenScheduledAt = null;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
getTimeUntilHalfOpen() {
|
|
185
|
+
if (this.state !== "OPEN" || !this.halfOpenScheduledAt) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
return Math.max(0, this.halfOpenScheduledAt - Date.now());
|
|
189
|
+
}
|
|
190
|
+
cleanupOldFailures() {
|
|
191
|
+
const cutoff = Date.now() - this.config.failureWindowMs;
|
|
192
|
+
this.failures = this.failures.filter((timestamp) => timestamp > cutoff);
|
|
193
|
+
}
|
|
194
|
+
log(level, ...args) {
|
|
195
|
+
this.config.logger?.[level]?.(...args);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export {
|
|
200
|
+
DEFAULT_CIRCUIT_BREAKER_CONFIG,
|
|
201
|
+
CircuitOpenError,
|
|
202
|
+
CircuitBreaker
|
|
203
|
+
};
|
|
204
|
+
//# sourceMappingURL=chunk-4C3RY5SU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/connector/circuit-breaker.ts"],"sourcesContent":["/**\n * Circuit Breaker Pattern for PowerSync Connector\n *\n * Prevents cascading failures by temporarily stopping requests when\n * a service is experiencing high failure rates.\n *\n * States:\n * - CLOSED: Normal operation, requests flow through\n * - OPEN: Service is failing, requests are blocked\n * - HALF_OPEN: Testing if service has recovered\n *\n * Transitions:\n * - CLOSED -> OPEN: After failureThreshold failures within failureWindowMs\n * - OPEN -> HALF_OPEN: After timeout (exponential backoff)\n * - HALF_OPEN -> CLOSED: On successful request\n * - HALF_OPEN -> OPEN: On failed request (with reset backoff multiplier)\n */\n\n/**\n * Circuit breaker states\n */\nexport type CircuitState = 'CLOSED' | 'OPEN' | 'HALF_OPEN';\n\n/**\n * Configuration for the circuit breaker\n */\nexport interface CircuitBreakerConfig {\n /**\n * Number of failures required to trip the circuit\n * @default 5\n */\n failureThreshold: number;\n\n /**\n * Time window in ms for counting failures\n * @default 60000 (60 seconds)\n */\n failureWindowMs: number;\n\n /**\n * Initial delay before transitioning from OPEN to HALF_OPEN\n * @default 1000 (1 second)\n */\n initialRecoveryDelayMs: number;\n\n /**\n * Maximum delay for exponential backoff\n * @default 32000 (32 seconds)\n */\n maxRecoveryDelayMs: number;\n\n /**\n * Multiplier for exponential backoff\n * @default 2\n */\n backoffMultiplier: number;\n\n /**\n * Optional callback when state changes\n */\n onStateChange?: (state: CircuitState, previousState: CircuitState) => void;\n\n /**\n * Optional logger\n */\n logger?: {\n debug: (...args: unknown[]) => void;\n info: (...args: unknown[]) => void;\n warn: (...args: unknown[]) => void;\n error: (...args: unknown[]) => void;\n };\n}\n\n/**\n * Default circuit breaker configuration\n */\nexport const DEFAULT_CIRCUIT_BREAKER_CONFIG: CircuitBreakerConfig = {\n failureThreshold: 5,\n failureWindowMs: 60000,\n initialRecoveryDelayMs: 1000,\n maxRecoveryDelayMs: 32000,\n backoffMultiplier: 2\n};\n\n/**\n * Statistics about the circuit breaker state\n */\nexport interface CircuitBreakerStats {\n /** Current state */\n state: CircuitState;\n /** Number of failures in current window */\n failureCount: number;\n /** Number of successful requests since last state change */\n successCount: number;\n /** Number of times circuit has opened */\n openCount: number;\n /** Time when circuit last opened */\n lastOpenedAt: Date | null;\n /** Time when circuit last closed */\n lastClosedAt: Date | null;\n /** Current recovery delay (when OPEN) */\n currentRecoveryDelayMs: number;\n /** Time until next HALF_OPEN attempt (when OPEN) */\n timeUntilHalfOpenMs: number | null;\n}\n\n/**\n * Error thrown when circuit is open\n */\nexport class CircuitOpenError extends Error {\n constructor(public readonly timeUntilRetryMs: number, public readonly stats: CircuitBreakerStats) {\n super(`Circuit breaker is OPEN. Service is unavailable. ` + `Retry in ${Math.ceil(timeUntilRetryMs / 1000)}s after ${stats.openCount} failures.`);\n this.name = 'CircuitOpenError';\n }\n}\n\n/**\n * Circuit Breaker implementation\n *\n * @example\n * ```typescript\n * const breaker = new CircuitBreaker({\n * failureThreshold: 5,\n * failureWindowMs: 60000,\n * onStateChange: (state) => console.log('Circuit state:', state),\n * });\n *\n * // Wrap your async operations\n * try {\n * const result = await breaker.execute(() => fetchData());\n * } catch (error) {\n * if (error instanceof CircuitOpenError) {\n * console.log('Service unavailable, retry later');\n * }\n * }\n * ```\n */\nexport class CircuitBreaker {\n private state: CircuitState = 'CLOSED';\n private failures: number[] = []; // Timestamps of failures within window\n private successCount = 0;\n private openCount = 0;\n private lastOpenedAt: Date | null = null;\n private lastClosedAt: Date | null = null;\n private currentRecoveryDelay: number;\n private halfOpenTimer: ReturnType<typeof setTimeout> | null = null;\n private halfOpenScheduledAt: number | null = null;\n private readonly config: Required<Pick<CircuitBreakerConfig, 'failureThreshold' | 'failureWindowMs' | 'initialRecoveryDelayMs' | 'maxRecoveryDelayMs' | 'backoffMultiplier'>> & Pick<CircuitBreakerConfig, 'onStateChange' | 'logger'>;\n constructor(config: Partial<CircuitBreakerConfig> = {}) {\n this.config = {\n ...DEFAULT_CIRCUIT_BREAKER_CONFIG,\n ...config\n };\n this.currentRecoveryDelay = this.config.initialRecoveryDelayMs;\n }\n\n /**\n * Get current state\n */\n getState(): CircuitState {\n return this.state;\n }\n\n /**\n * Get circuit breaker statistics\n */\n getStats(): CircuitBreakerStats {\n return {\n state: this.state,\n failureCount: this.failures.length,\n successCount: this.successCount,\n openCount: this.openCount,\n lastOpenedAt: this.lastOpenedAt,\n lastClosedAt: this.lastClosedAt,\n currentRecoveryDelayMs: this.currentRecoveryDelay,\n timeUntilHalfOpenMs: this.getTimeUntilHalfOpen()\n };\n }\n\n /**\n * Check if requests are allowed through the circuit\n */\n isAllowed(): boolean {\n this.cleanupOldFailures();\n switch (this.state) {\n case 'CLOSED':\n return true;\n case 'HALF_OPEN':\n return true;\n // Allow test request\n case 'OPEN':\n return false;\n }\n }\n\n /**\n * Check if request can proceed, throws if not\n */\n checkAllowed(): void {\n if (!this.isAllowed()) {\n throw new CircuitOpenError(this.getTimeUntilHalfOpen() ?? 0, this.getStats());\n }\n }\n\n /**\n * Record a successful operation\n */\n recordSuccess(): void {\n this.successCount++;\n if (this.state === 'HALF_OPEN') {\n // Success in HALF_OPEN means service is recovered\n this.transition('CLOSED');\n this.currentRecoveryDelay = this.config.initialRecoveryDelayMs;\n this.failures = [];\n }\n this.log('debug', '[CircuitBreaker] Success recorded, state:', this.state);\n }\n\n /**\n * Record a failed operation\n */\n recordFailure(): void {\n const now = Date.now();\n this.failures.push(now);\n this.cleanupOldFailures();\n if (this.state === 'HALF_OPEN') {\n // Failure in HALF_OPEN means service is still down\n this.transition('OPEN');\n this.scheduleHalfOpen();\n return;\n }\n if (this.state === 'CLOSED') {\n // Check if threshold exceeded\n if (this.failures.length >= this.config.failureThreshold) {\n this.log('warn', `[CircuitBreaker] Failure threshold (${this.config.failureThreshold}) ` + `exceeded in ${this.config.failureWindowMs}ms window. Opening circuit.`);\n this.transition('OPEN');\n this.scheduleHalfOpen();\n }\n }\n }\n\n /**\n * Execute an async operation through the circuit breaker\n */\n async execute<T>(operation: () => Promise<T>): Promise<T> {\n this.checkAllowed();\n try {\n const result = await operation();\n this.recordSuccess();\n return result;\n } catch (error) {\n this.recordFailure();\n throw error;\n }\n }\n\n /**\n * Manually reset the circuit breaker to CLOSED state\n */\n reset(): void {\n this.clearHalfOpenTimer();\n this.failures = [];\n this.successCount = 0;\n this.currentRecoveryDelay = this.config.initialRecoveryDelayMs;\n this.transition('CLOSED');\n }\n\n /**\n * Force the circuit to OPEN state (e.g., for manual intervention)\n */\n forceOpen(): void {\n this.clearHalfOpenTimer();\n this.transition('OPEN');\n this.scheduleHalfOpen();\n }\n\n /**\n * Dispose the circuit breaker (clear timers)\n */\n dispose(): void {\n this.clearHalfOpenTimer();\n }\n\n // ─── Private Methods ─────────────────────────────────────────────────────────\n\n private transition(newState: CircuitState): void {\n if (this.state === newState) return;\n const previousState = this.state;\n this.state = newState;\n if (newState === 'OPEN') {\n this.openCount++;\n this.lastOpenedAt = new Date();\n // Exponential backoff for repeated failures\n this.currentRecoveryDelay = Math.min(this.currentRecoveryDelay * this.config.backoffMultiplier, this.config.maxRecoveryDelayMs);\n } else if (newState === 'CLOSED') {\n this.lastClosedAt = new Date();\n this.successCount = 0;\n }\n this.log('info', `[CircuitBreaker] State transition: ${previousState} -> ${newState}`);\n this.config.onStateChange?.(newState, previousState);\n }\n private scheduleHalfOpen(): void {\n this.clearHalfOpenTimer();\n this.halfOpenScheduledAt = Date.now() + this.currentRecoveryDelay;\n this.log('debug', `[CircuitBreaker] Scheduling HALF_OPEN in ${this.currentRecoveryDelay}ms`);\n this.halfOpenTimer = setTimeout(() => {\n this.halfOpenTimer = null;\n this.halfOpenScheduledAt = null;\n this.transition('HALF_OPEN');\n this.log('info', '[CircuitBreaker] Circuit is now HALF_OPEN, allowing test request');\n }, this.currentRecoveryDelay);\n }\n private clearHalfOpenTimer(): void {\n if (this.halfOpenTimer) {\n clearTimeout(this.halfOpenTimer);\n this.halfOpenTimer = null;\n this.halfOpenScheduledAt = null;\n }\n }\n private getTimeUntilHalfOpen(): number | null {\n if (this.state !== 'OPEN' || !this.halfOpenScheduledAt) {\n return null;\n }\n return Math.max(0, this.halfOpenScheduledAt - Date.now());\n }\n private cleanupOldFailures(): void {\n const cutoff = Date.now() - this.config.failureWindowMs;\n this.failures = this.failures.filter(timestamp => timestamp > cutoff);\n }\n private log(level: 'debug' | 'info' | 'warn' | 'error', ...args: unknown[]): void {\n this.config.logger?.[level]?.(...args);\n }\n}"],"mappings":";AA4EO,IAAM,iCAAuD;AAAA,EAClE,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,wBAAwB;AAAA,EACxB,oBAAoB;AAAA,EACpB,mBAAmB;AACrB;AA2BO,IAAM,mBAAN,cAA+B,MAAM;AAAA,EAC1C,YAA4B,kBAA0C,OAA4B;AAChG,UAAM,6DAAkE,KAAK,KAAK,mBAAmB,GAAI,CAAC,WAAW,MAAM,SAAS,YAAY;AADtH;AAA0C;AAEpE,SAAK,OAAO;AAAA,EACd;AACF;AAuBO,IAAM,iB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function createNativePlatformAdapter(logger) {
|
|
3
3
|
let PowerSyncDatabase;
|
|
4
4
|
let OPSqliteOpenFactory;
|
|
5
|
-
let
|
|
5
|
+
let File;
|
|
6
|
+
let Directory;
|
|
7
|
+
let Paths;
|
|
6
8
|
let AsyncStorage;
|
|
7
9
|
let NetInfo;
|
|
8
10
|
let ImageManipulator;
|
|
@@ -15,8 +17,11 @@ function createNativePlatformAdapter(logger) {
|
|
|
15
17
|
const opSqliteModule = await import("@powersync/op-sqlite");
|
|
16
18
|
OPSqliteOpenFactory = opSqliteModule.OPSqliteOpenFactory;
|
|
17
19
|
}
|
|
18
|
-
if (!
|
|
19
|
-
|
|
20
|
+
if (!File || !Directory || !Paths) {
|
|
21
|
+
const fsModule = await import("expo-file-system");
|
|
22
|
+
File = fsModule.File;
|
|
23
|
+
Directory = fsModule.Directory;
|
|
24
|
+
Paths = fsModule.Paths;
|
|
20
25
|
}
|
|
21
26
|
if (!AsyncStorage) {
|
|
22
27
|
const asModule = await import("@react-native-async-storage/async-storage");
|
|
@@ -32,74 +37,128 @@ function createNativePlatformAdapter(logger) {
|
|
|
32
37
|
};
|
|
33
38
|
const fileSystem = {
|
|
34
39
|
async readFile(uri, encoding = "utf8") {
|
|
35
|
-
if (!
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
if (!File) await loadDependencies();
|
|
41
|
+
const file = new File(uri);
|
|
42
|
+
if (encoding === "base64") {
|
|
43
|
+
return file.base64();
|
|
44
|
+
}
|
|
45
|
+
return file.text();
|
|
39
46
|
},
|
|
40
47
|
async writeFile(uri, data, encoding = "utf8") {
|
|
41
|
-
if (!
|
|
48
|
+
if (!File || !Directory) await loadDependencies();
|
|
42
49
|
const parentDir = uri.substring(0, uri.lastIndexOf("/"));
|
|
43
50
|
if (parentDir) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
const dir = new Directory(parentDir);
|
|
52
|
+
dir.create({
|
|
53
|
+
intermediates: true,
|
|
54
|
+
idempotent: true
|
|
47
55
|
});
|
|
48
56
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
const file = new File(uri);
|
|
58
|
+
if (encoding === "base64") {
|
|
59
|
+
const binaryString = atob(data);
|
|
60
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
61
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
62
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
63
|
+
}
|
|
64
|
+
file.write(bytes);
|
|
65
|
+
} else {
|
|
66
|
+
file.write(data);
|
|
67
|
+
}
|
|
52
68
|
},
|
|
53
69
|
async deleteFile(uri) {
|
|
54
|
-
if (!
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
70
|
+
if (!File) await loadDependencies();
|
|
71
|
+
const file = new File(uri);
|
|
72
|
+
try {
|
|
73
|
+
if (file.exists) {
|
|
74
|
+
file.delete();
|
|
75
|
+
}
|
|
76
|
+
} catch {
|
|
77
|
+
}
|
|
58
78
|
},
|
|
59
79
|
async copyFile(source, destination) {
|
|
60
|
-
if (!
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
80
|
+
if (!File) await loadDependencies();
|
|
81
|
+
const sourceFile = new File(source);
|
|
82
|
+
const destFile = new File(destination);
|
|
83
|
+
sourceFile.copy(destFile);
|
|
65
84
|
},
|
|
66
85
|
async moveFile(source, destination) {
|
|
67
|
-
if (!
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
});
|
|
86
|
+
if (!File) await loadDependencies();
|
|
87
|
+
const sourceFile = new File(source);
|
|
88
|
+
const destFile = new File(destination);
|
|
89
|
+
sourceFile.move(destFile);
|
|
72
90
|
},
|
|
73
91
|
async getFileInfo(uri) {
|
|
74
|
-
if (!
|
|
92
|
+
if (!File || !Paths) await loadDependencies();
|
|
75
93
|
try {
|
|
76
|
-
const
|
|
77
|
-
if (!
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
94
|
+
const pathInfo = Paths.info(uri);
|
|
95
|
+
if (!pathInfo.exists) return null;
|
|
96
|
+
if (pathInfo.isDirectory) {
|
|
97
|
+
const dir = new Directory(uri);
|
|
98
|
+
const dirInfo = dir.info();
|
|
99
|
+
return {
|
|
100
|
+
exists: true,
|
|
101
|
+
size: dirInfo.size ?? 0,
|
|
102
|
+
isDirectory: true,
|
|
103
|
+
modificationTime: dirInfo.modificationTime ? new Date(dirInfo.modificationTime) : void 0
|
|
104
|
+
};
|
|
105
|
+
} else {
|
|
106
|
+
const file = new File(uri);
|
|
107
|
+
const fileInfo = file.info();
|
|
108
|
+
return {
|
|
109
|
+
exists: true,
|
|
110
|
+
size: fileInfo.size ?? 0,
|
|
111
|
+
isDirectory: false,
|
|
112
|
+
modificationTime: fileInfo.modificationTime ? new Date(fileInfo.modificationTime) : void 0
|
|
113
|
+
};
|
|
114
|
+
}
|
|
84
115
|
} catch {
|
|
85
116
|
return null;
|
|
86
117
|
}
|
|
87
118
|
},
|
|
88
119
|
async makeDirectory(uri, options) {
|
|
89
|
-
if (!
|
|
90
|
-
|
|
91
|
-
|
|
120
|
+
if (!Directory) await loadDependencies();
|
|
121
|
+
const dir = new Directory(uri);
|
|
122
|
+
dir.create({
|
|
123
|
+
intermediates: options?.intermediates ?? true,
|
|
124
|
+
idempotent: true
|
|
92
125
|
});
|
|
93
126
|
},
|
|
94
127
|
getDocumentsDirectory() {
|
|
95
|
-
|
|
128
|
+
if (!Paths) {
|
|
129
|
+
throw new Error("[Platform] Paths not loaded. Call an async method first to initialize dependencies.");
|
|
130
|
+
}
|
|
131
|
+
const dir = Paths.document.uri;
|
|
132
|
+
return dir.endsWith("/") ? dir : `${dir}/`;
|
|
96
133
|
},
|
|
97
134
|
getCacheDirectory() {
|
|
98
|
-
|
|
135
|
+
if (!Paths) {
|
|
136
|
+
throw new Error("[Platform] Paths not loaded. Call an async method first to initialize dependencies.");
|
|
137
|
+
}
|
|
138
|
+
const dir = Paths.cache.uri;
|
|
139
|
+
return dir.endsWith("/") ? dir : `${dir}/`;
|
|
99
140
|
},
|
|
100
141
|
async getFreeDiskSpace() {
|
|
101
|
-
if (!
|
|
102
|
-
return
|
|
142
|
+
if (!Paths) await loadDependencies();
|
|
143
|
+
return Paths.availableDiskSpace;
|
|
144
|
+
},
|
|
145
|
+
async downloadFile(url, localPath) {
|
|
146
|
+
if (!File || !Directory) await loadDependencies();
|
|
147
|
+
const parentDir = localPath.substring(0, localPath.lastIndexOf("/"));
|
|
148
|
+
if (parentDir) {
|
|
149
|
+
const dir = new Directory(parentDir);
|
|
150
|
+
dir.create({
|
|
151
|
+
intermediates: true,
|
|
152
|
+
idempotent: true
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
const {
|
|
156
|
+
downloadAsync
|
|
157
|
+
} = await import("expo-file-system");
|
|
158
|
+
const result = await downloadAsync(url, localPath);
|
|
159
|
+
if (result.status !== 200) {
|
|
160
|
+
throw new Error(`Download failed with status ${result.status}: ${url}`);
|
|
161
|
+
}
|
|
103
162
|
}
|
|
104
163
|
};
|
|
105
164
|
const storage = {
|
|
@@ -143,13 +202,18 @@ function createNativePlatformAdapter(logger) {
|
|
|
143
202
|
},
|
|
144
203
|
addConnectionListener(callback) {
|
|
145
204
|
if (!NetInfo) {
|
|
146
|
-
logger.warn("[Platform] NetInfo not loaded,
|
|
205
|
+
logger.warn("[Platform] NetInfo not loaded, setting up listener asynchronously");
|
|
206
|
+
let realUnsubscribe = null;
|
|
207
|
+
let cancelled = false;
|
|
147
208
|
loadDependencies().then(() => {
|
|
148
|
-
|
|
209
|
+
if (cancelled) return;
|
|
210
|
+
realUnsubscribe = NetInfo.addEventListener((state) => {
|
|
149
211
|
callback(state.isConnected ?? false);
|
|
150
212
|
});
|
|
151
213
|
});
|
|
152
214
|
return () => {
|
|
215
|
+
cancelled = true;
|
|
216
|
+
realUnsubscribe?.();
|
|
153
217
|
};
|
|
154
218
|
}
|
|
155
219
|
const unsubscribe = NetInfo.addEventListener((state) => {
|
|
@@ -235,4 +299,4 @@ function createNativePlatformAdapter(logger) {
|
|
|
235
299
|
export {
|
|
236
300
|
createNativePlatformAdapter
|
|
237
301
|
};
|
|
238
|
-
//# sourceMappingURL=chunk-
|
|
302
|
+
//# sourceMappingURL=chunk-53WH2JJV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/platform/index.native.ts"],"sourcesContent":["/**\n * React Native Platform Adapter for @pol-studios/powersync\n *\n * Implements the PlatformAdapter interface using React Native specific APIs:\n * - @powersync/react-native for SQLite database\n * - expo-file-system for file operations (new class-based API)\n * - @react-native-async-storage/async-storage for key-value storage\n * - @react-native-community/netinfo for network monitoring\n * - expo-image-manipulator for image compression\n */\n\nimport type { PlatformAdapter, DatabaseOptions, FileSystemAdapter, AsyncStorageAdapter, NetworkAdapter, LoggerAdapter, ImageProcessorAdapter, FileInfo, CompressedImage, CompressionOptions, ConnectionType } from './types';\nimport type { AbstractPowerSyncDatabase } from '../core/types';\n\n// Import new expo-file-system API types\nimport type { File as ExpoFile, Directory as ExpoDirectory, Paths as ExpoPaths } from 'expo-file-system';\n\n/**\n * Create a React Native platform adapter\n *\n * @param logger - Logger implementation to use\n * @returns Platform adapter configured for React Native\n *\n * @example\n * ```typescript\n * import { createNativePlatformAdapter } from '@pol-studios/powersync/platform';\n *\n * const logger = {\n * debug: console.log,\n * info: console.log,\n * warn: console.warn,\n * error: console.error,\n * };\n *\n * const platform = createNativePlatformAdapter(logger);\n * ```\n */\nexport function createNativePlatformAdapter(logger: LoggerAdapter): PlatformAdapter {\n // Lazy imports to avoid loading these modules until needed\n // This also helps with tree-shaking in web builds\n let PowerSyncDatabase: typeof import('@powersync/react-native').PowerSyncDatabase;\n let OPSqliteOpenFactory: typeof import('@powersync/op-sqlite').OPSqliteOpenFactory;\n // New expo-file-system API classes\n let File: typeof ExpoFile;\n let Directory: typeof ExpoDirectory;\n let Paths: typeof ExpoPaths;\n let AsyncStorage: typeof import('@react-native-async-storage/async-storage').default;\n let NetInfo: typeof import('@react-native-community/netinfo').default;\n let ImageManipulator: typeof import('expo-image-manipulator');\n const loadDependencies = async () => {\n if (!PowerSyncDatabase) {\n const psModule = await import('@powersync/react-native');\n PowerSyncDatabase = psModule.PowerSyncDatabase;\n }\n if (!OPSqliteOpenFactory) {\n const opSqliteModule = await import('@powersync/op-sqlite');\n OPSqliteOpenFactory = opSqliteModule.OPSqliteOpenFactory;\n }\n if (!File || !Directory || !Paths) {\n const fsModule = await import('expo-file-system');\n File = fsModule.File;\n Directory = fsModule.Directory;\n Paths = fsModule.Paths;\n }\n if (!AsyncStorage) {\n const asModule = await import('@react-native-async-storage/async-storage');\n AsyncStorage = asModule.default;\n }\n if (!NetInfo) {\n const niModule = await import('@react-native-community/netinfo');\n NetInfo = niModule.default;\n }\n if (!ImageManipulator) {\n ImageManipulator = await import('expo-image-manipulator');\n }\n };\n\n // File system adapter implementation using new expo-file-system class-based API\n const fileSystem: FileSystemAdapter = {\n async readFile(uri: string, encoding: 'base64' | 'utf8' = 'utf8'): Promise<string> {\n if (!File) await loadDependencies();\n const file = new File!(uri);\n if (encoding === 'base64') {\n return file.base64();\n }\n return file.text();\n },\n async writeFile(uri: string, data: string, encoding: 'base64' | 'utf8' = 'utf8'): Promise<void> {\n if (!File || !Directory) await loadDependencies();\n // Ensure parent directory exists (use idempotent to avoid errors if exists)\n const parentDir = uri.substring(0, uri.lastIndexOf('/'));\n if (parentDir) {\n const dir = new Directory!(parentDir);\n dir.create({\n intermediates: true,\n idempotent: true\n });\n }\n const file = new File!(uri);\n if (encoding === 'base64') {\n // Decode base64 to binary and write as Uint8Array\n const binaryString = atob(data);\n const bytes = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n file.write(bytes);\n } else {\n // Write text directly\n file.write(data);\n }\n },\n async deleteFile(uri: string): Promise<void> {\n if (!File) await loadDependencies();\n const file = new File!(uri);\n try {\n if (file.exists) {\n file.delete();\n }\n } catch {\n // File may not exist, treat as idempotent\n }\n },\n async copyFile(source: string, destination: string): Promise<void> {\n if (!File) await loadDependencies();\n const sourceFile = new File!(source);\n const destFile = new File!(destination);\n sourceFile.copy(destFile);\n },\n async moveFile(source: string, destination: string): Promise<void> {\n if (!File) await loadDependencies();\n const sourceFile = new File!(source);\n const destFile = new File!(destination);\n sourceFile.move(destFile);\n },\n async getFileInfo(uri: string): Promise<FileInfo | null> {\n if (!File || !Paths) await loadDependencies();\n try {\n // Use Paths.info() to check if it's a directory or file\n const pathInfo = Paths!.info(uri);\n if (!pathInfo.exists) return null;\n if (pathInfo.isDirectory) {\n const dir = new Directory!(uri);\n const dirInfo = dir.info();\n return {\n exists: true,\n size: dirInfo.size ?? 0,\n isDirectory: true,\n modificationTime: dirInfo.modificationTime ? new Date(dirInfo.modificationTime) : undefined\n };\n } else {\n const file = new File!(uri);\n const fileInfo = file.info();\n return {\n exists: true,\n size: fileInfo.size ?? 0,\n isDirectory: false,\n modificationTime: fileInfo.modificationTime ? new Date(fileInfo.modificationTime) : undefined\n };\n }\n } catch {\n return null;\n }\n },\n async makeDirectory(uri: string, options?: {\n intermediates?: boolean;\n }): Promise<void> {\n if (!Directory) await loadDependencies();\n const dir = new Directory!(uri);\n dir.create({\n intermediates: options?.intermediates ?? true,\n idempotent: true\n });\n },\n getDocumentsDirectory(): string {\n if (!Paths) {\n throw new Error('[Platform] Paths not loaded. Call an async method first to initialize dependencies.');\n }\n // Ensure trailing slash for consistency with legacy FileSystem.documentDirectory\n const dir = Paths.document.uri;\n return dir.endsWith('/') ? dir : `${dir}/`;\n },\n getCacheDirectory(): string {\n if (!Paths) {\n throw new Error('[Platform] Paths not loaded. Call an async method first to initialize dependencies.');\n }\n // Ensure trailing slash for consistency with legacy FileSystem.cacheDirectory\n const dir = Paths.cache.uri;\n return dir.endsWith('/') ? dir : `${dir}/`;\n },\n async getFreeDiskSpace(): Promise<number> {\n if (!Paths) await loadDependencies();\n // New API provides this as a property on Paths\n return Paths!.availableDiskSpace;\n },\n async downloadFile(url: string, localPath: string): Promise<void> {\n if (!File || !Directory) await loadDependencies();\n\n // Ensure parent directory exists\n const parentDir = localPath.substring(0, localPath.lastIndexOf('/'));\n if (parentDir) {\n const dir = new Directory!(parentDir);\n dir.create({\n intermediates: true,\n idempotent: true\n });\n }\n\n // Use expo-file-system's downloadAsync for memory-efficient streaming download\n const {\n downloadAsync\n } = await import('expo-file-system');\n const result = await downloadAsync(url, localPath);\n if (result.status !== 200) {\n throw new Error(`Download failed with status ${result.status}: ${url}`);\n }\n }\n };\n\n // Async storage adapter implementation\n const storage: AsyncStorageAdapter = {\n async getItem(key: string): Promise<string | null> {\n if (!AsyncStorage) await loadDependencies();\n return AsyncStorage!.getItem(key);\n },\n async setItem(key: string, value: string): Promise<void> {\n if (!AsyncStorage) await loadDependencies();\n await AsyncStorage!.setItem(key, value);\n },\n async removeItem(key: string): Promise<void> {\n if (!AsyncStorage) await loadDependencies();\n await AsyncStorage!.removeItem(key);\n },\n async multiGet(keys: string[]): Promise<[string, string | null][]> {\n if (!AsyncStorage) await loadDependencies();\n const result = await AsyncStorage!.multiGet(keys);\n return result as [string, string | null][];\n },\n async multiSet(entries: [string, string][]): Promise<void> {\n if (!AsyncStorage) await loadDependencies();\n await AsyncStorage!.multiSet(entries);\n }\n };\n\n // Network adapter implementation\n const network: NetworkAdapter = {\n async isConnected(): Promise<boolean> {\n if (!NetInfo) await loadDependencies();\n const state = await NetInfo!.fetch();\n return state.isConnected ?? false;\n },\n async getConnectionType(): Promise<ConnectionType> {\n if (!NetInfo) await loadDependencies();\n const state = await NetInfo!.fetch();\n const type = state.type;\n if (type === 'wifi') return 'wifi';\n if (type === 'cellular') return 'cellular';\n if (type === 'ethernet') return 'ethernet';\n if (type === 'none') return 'none';\n return 'unknown';\n },\n addConnectionListener(callback: (isConnected: boolean) => void): () => void {\n if (!NetInfo) {\n logger.warn('[Platform] NetInfo not loaded, setting up listener asynchronously');\n let realUnsubscribe: (() => void) | null = null;\n let cancelled = false;\n loadDependencies().then(() => {\n if (cancelled) return;\n realUnsubscribe = NetInfo!.addEventListener(state => {\n callback(state.isConnected ?? false);\n });\n });\n return () => {\n cancelled = true;\n realUnsubscribe?.();\n };\n }\n const unsubscribe = NetInfo.addEventListener(state => {\n callback(state.isConnected ?? false);\n });\n return unsubscribe;\n }\n };\n\n // Image processor adapter implementation\n const imageProcessor: ImageProcessorAdapter = {\n async compress(uri: string, options: CompressionOptions): Promise<CompressedImage> {\n if (!ImageManipulator) await loadDependencies();\n const actions: import('expo-image-manipulator').Action[] = [];\n\n // Add resize action if maxWidth or maxHeight specified\n if (options.maxWidth || options.maxHeight) {\n actions.push({\n resize: {\n width: options.maxWidth,\n height: options.maxHeight\n }\n });\n }\n\n // Determine output format\n let format: import('expo-image-manipulator').SaveFormat;\n switch (options.format) {\n case 'png':\n format = ImageManipulator!.SaveFormat.PNG;\n break;\n case 'webp':\n format = ImageManipulator!.SaveFormat.WEBP;\n break;\n case 'jpeg':\n default:\n format = ImageManipulator!.SaveFormat.JPEG;\n break;\n }\n const result = await ImageManipulator!.manipulateAsync(uri, actions, {\n compress: options.quality,\n format\n });\n return {\n uri: result.uri,\n width: result.width,\n height: result.height\n };\n }\n };\n\n // Main platform adapter\n return {\n async createDatabase(options: DatabaseOptions): Promise<AbstractPowerSyncDatabase> {\n if (!PowerSyncDatabase) await loadDependencies();\n logger.info('[Platform] Creating PowerSync database:', options.dbFilename);\n const db = new PowerSyncDatabase!({\n schema: options.schema as any,\n database: new OPSqliteOpenFactory!({\n dbFilename: options.dbFilename\n })\n });\n logger.info('[Platform] Initializing database...');\n await db.init();\n\n // Verify database is queryable before returning\n // This prevents race conditions where db.connect() is called before SQLite is truly ready\n const maxAttempts = 3;\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n try {\n await db.get('SELECT 1');\n logger.info('[Platform] Database initialized and verified');\n return db as unknown as AbstractPowerSyncDatabase;\n } catch (err) {\n if (attempt < maxAttempts - 1) {\n logger.warn(`[Platform] Database readiness check failed (attempt ${attempt + 1}/${maxAttempts}), retrying...`);\n await new Promise(r => setTimeout(r, 100 * Math.pow(2, attempt))); // 100ms, 200ms, 400ms\n } else {\n logger.error('[Platform] Database failed readiness verification after all attempts');\n throw new Error(`Database failed readiness verification: ${err instanceof Error ? err.message : err}`);\n }\n }\n }\n\n // TypeScript: unreachable but needed for return type\n throw new Error('Database readiness verification failed');\n },\n fileSystem,\n storage,\n network,\n logger,\n imageProcessor\n };\n}\n\n// Re-export types for convenience\nexport type { PlatformAdapter, LoggerAdapter } from './types';"],"mappings":";AAqCO,SAAS,4BAA4B,QAAwC;AAGlF,MAAI;AACJ,MAAI;AAEJ,MAAI;AACJ,MAAI;AACJ,MAAI;AACJ,MAAI;AACJ,MAAI;AACJ,MAAI;AACJ,QAAM,mBAAmB,YAAY;AACnC,QAAI,CAAC,mBAAmB;AACtB,YAAM,WAAW,MAAM,OAAO,yBAAyB;AACvD,0BAAoB,SAAS;AAAA,IAC/B;AACA,QAAI,CAAC,qBAAqB;AACxB,YAAM,iBAAiB,MAAM,OAAO,sBAAsB;AAC1D,4BAAsB,eAAe;AAAA,IACvC;AACA,QAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO;AACjC,YAAM,WAAW,MAAM,OAAO,kBAAkB;AAChD,aAAO,SAAS;AAChB,kBAAY,SAAS;AACrB,cAAQ,SAAS;AAAA,IACnB;AACA,QAAI,CAAC,cAAc;AACjB,YAAM,WAAW,MAAM,OAAO,2CAA2C;AACzE,qBAAe,SAAS;AAAA,IAC1B;AACA,QAAI,CAAC,SAAS;AACZ,YAAM,WAAW,MAAM,OAAO,iCAAiC;AAC/D,gBAAU,SAAS;AAAA,IACrB;AACA,QAAI,CAAC,kBAAkB;AACrB,yBAAmB,MAAM,OAAO,wBAAwB;AAAA,IAC1D;AAAA,EACF;AAGA,QAAM,aAAgC;AAAA,IACpC,MAA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