spudmobile-bridge 1.0.1 → 1.0.2
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/supabase.js +19 -2
- package/package.json +1 -1
package/dist/supabase.js
CHANGED
|
@@ -171,12 +171,29 @@ export class SupabaseBridge {
|
|
|
171
171
|
* Activate a device pair using the pair code from callback
|
|
172
172
|
*/
|
|
173
173
|
async activatePair(pairCode) {
|
|
174
|
-
|
|
174
|
+
// Try finding by pair_code first (8-char hex codes)
|
|
175
|
+
let pair = null;
|
|
176
|
+
const { data: byCode } = await this.client
|
|
175
177
|
.from('device_pairs')
|
|
176
178
|
.select('id')
|
|
177
179
|
.eq('pair_code', pairCode)
|
|
178
180
|
.single();
|
|
179
|
-
if (
|
|
181
|
+
if (byCode) {
|
|
182
|
+
pair = byCode;
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
// Fallback: the token might be ios_device_id (UUID from the connect edge function)
|
|
186
|
+
const { data: byDevice } = await this.client
|
|
187
|
+
.from('device_pairs')
|
|
188
|
+
.select('id')
|
|
189
|
+
.ilike('ios_device_id', pairCode)
|
|
190
|
+
.eq('is_active', true)
|
|
191
|
+
.order('created_at', { ascending: false })
|
|
192
|
+
.limit(1)
|
|
193
|
+
.single();
|
|
194
|
+
pair = byDevice;
|
|
195
|
+
}
|
|
196
|
+
if (!pair) {
|
|
180
197
|
throw new Error(`Pair not found for code: ${pairCode}`);
|
|
181
198
|
}
|
|
182
199
|
const { error: updateError } = await this.client
|