Packaging was silently hanging forever because yauzl 2.10.0 read streams
emit no data events under Node 26, causing extract-zip to block indefinitely
inside @electron/packager 20. Fix: postinstall script patches
@electron/packager/dist/unzip.js to use bsdtar (libarchive) instead.
bsdtar was chosen over 7z because 7z refuses chained symlinks in macOS
.app framework bundles. Both package:linux and package:mac now produce
correct output.
Also corrects the V3 API bootstrap contract in api_client.ts:
- SearchQuery body was wrapped in an extra {search_query: ...} layer — removed
- x-no-account-id header standardised to 'bypass'
- Redundant x-no-account-id removed from file download headers
- Smoke test rewritten to validate the real two-step bootstrap path
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
65 lines
2.8 KiB
JavaScript
65 lines
2.8 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.fetchFullConfig = fetchFullConfig;
|
|
async function fetchFullConfig(seed) {
|
|
const apiUrls = [
|
|
seed.onsite_api_base_url,
|
|
seed.primary_api_base_url,
|
|
seed.backup_api_base_url
|
|
].filter(url => url !== null && url !== undefined);
|
|
let lastError = null;
|
|
for (const baseUrl of apiUrls) {
|
|
try {
|
|
console.log(`Bootstrap: Attempting connection to ${baseUrl}...`);
|
|
// --- STEP 1: Get Device Config ---
|
|
const deviceUrl = `${baseUrl}/v3/crud/event_device/${seed.event_device_id}`;
|
|
const deviceResponse = await fetch(deviceUrl, {
|
|
method: 'GET',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'x-aether-api-key': seed.aether_api_key,
|
|
'x-no-account-id': 'bypass'
|
|
},
|
|
});
|
|
if (!deviceResponse.ok) {
|
|
throw new Error(`Device lookup failed (${deviceResponse.status})`);
|
|
}
|
|
const deviceResult = await deviceResponse.json();
|
|
const deviceData = deviceResult.data || deviceResult;
|
|
// Use 'app_base_url' as the FQDN for the site lookup
|
|
const fqdn = deviceData.app_base_url || 'native-demo.oneskyit.com';
|
|
// --- STEP 2: Get Site Context ---
|
|
const searchUrl = `${baseUrl}/v3/crud/site_domain/search?limit=1`;
|
|
const siteResponse = await fetch(searchUrl, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'x-aether-api-key': seed.aether_api_key,
|
|
'x-account-id': deviceData.account_id_random || deviceData.account_id || ''
|
|
},
|
|
body: JSON.stringify({
|
|
and: [{ field: 'fqdn', op: 'eq', value: fqdn }]
|
|
})
|
|
});
|
|
if (!siteResponse.ok) {
|
|
throw new Error(`Site context lookup failed (${siteResponse.status})`);
|
|
}
|
|
const siteResult = await siteResponse.json();
|
|
const siteDomain = (siteResult.data && siteResult.data.length > 0) ? siteResult.data[0] : null;
|
|
console.log(`Bootstrap Success using ${baseUrl}`);
|
|
return {
|
|
...siteDomain,
|
|
native_device: deviceData,
|
|
aether_api_key: seed.aether_api_key // Include the key for frontend use
|
|
};
|
|
}
|
|
catch (error) {
|
|
console.warn(`Bootstrap failed for ${baseUrl}: `, error);
|
|
lastError = error;
|
|
continue; // Try next URL
|
|
}
|
|
}
|
|
console.error('Bootstrap Critical Failure: All API endpoints exhausted.', lastError);
|
|
return null;
|
|
}
|
|
//# sourceMappingURL=api_client.js.map
|