The job_run_logs table tracks scheduled job orchestration, not individual worker jobs. Worker info (worker_id, worker_hostname) belongs on dispensary_crawl_jobs, not job_run_logs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
107 lines
4.6 KiB
JavaScript
107 lines
4.6 KiB
JavaScript
"use strict";
|
|
/**
|
|
* Dutchie Configuration
|
|
*
|
|
* Centralized configuration for Dutchie GraphQL API interaction.
|
|
* Update hashes here when Dutchie changes their persisted query system.
|
|
*/
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.ARIZONA_CENTERPOINTS = exports.GRAPHQL_HASHES = exports.dutchieConfig = void 0;
|
|
exports.dutchieConfig = {
|
|
// ============================================================
|
|
// GRAPHQL ENDPOINT
|
|
// ============================================================
|
|
/** GraphQL endpoint - must be the api-3 graphql endpoint (NOT api-gw.dutchie.com which no longer exists) */
|
|
graphqlEndpoint: 'https://dutchie.com/api-3/graphql',
|
|
// ============================================================
|
|
// GRAPHQL PERSISTED QUERY HASHES
|
|
// ============================================================
|
|
//
|
|
// These hashes identify specific GraphQL operations.
|
|
// If Dutchie changes their schema, you may need to capture
|
|
// new hashes from live browser traffic (Network tab → graphql requests).
|
|
/** FilteredProducts - main product listing query */
|
|
filteredProductsHash: 'ee29c060826dc41c527e470e9ae502c9b2c169720faa0a9f5d25e1b9a530a4a0',
|
|
/** GetAddressBasedDispensaryData - resolve slug to internal ID */
|
|
getDispensaryDataHash: '13461f73abf7268770dfd05fe7e10c523084b2bb916a929c08efe3d87531977b',
|
|
/**
|
|
* ConsumerDispensaries - geo-based discovery
|
|
* NOTE: This is a placeholder guess. If discovery fails, either:
|
|
* 1. Capture the real hash from live traffic
|
|
* 2. Rely on known AZDHS slugs instead (set useDiscovery: false)
|
|
*/
|
|
consumerDispensariesHash: '0a5bfa6ca1d64ae47bcccb7c8077c87147cbc4e6982c17ceec97a2a4948b311b',
|
|
// ============================================================
|
|
// BEHAVIOR FLAGS
|
|
// ============================================================
|
|
/** Enable geo-based discovery (false = use known AZDHS slugs only) */
|
|
useDiscovery: true,
|
|
/** Prefer GET requests (true) or POST (false). GET is default. */
|
|
preferGet: true,
|
|
/**
|
|
* Enable POST fallback when GET fails with 405 or blocked.
|
|
* If true, will retry failed GETs as POSTs.
|
|
*/
|
|
enablePostFallback: true,
|
|
// ============================================================
|
|
// PAGINATION & RETRY
|
|
// ============================================================
|
|
/** Products per page for pagination */
|
|
perPage: 100,
|
|
/** Maximum pages to fetch (safety limit) */
|
|
maxPages: 200,
|
|
/** Number of retries for failed page fetches */
|
|
maxRetries: 1,
|
|
/** Delay between pages in ms */
|
|
pageDelayMs: 500,
|
|
/** Delay between modes in ms */
|
|
modeDelayMs: 2000,
|
|
// ============================================================
|
|
// HTTP HEADERS
|
|
// ============================================================
|
|
/** Default headers to mimic browser requests */
|
|
defaultHeaders: {
|
|
'accept': 'application/json, text/plain, */*',
|
|
'accept-language': 'en-US,en;q=0.9',
|
|
'apollographql-client-name': 'Marketplace (production)',
|
|
},
|
|
/** User agent string */
|
|
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
|
|
// ============================================================
|
|
// BROWSER LAUNCH OPTIONS
|
|
// ============================================================
|
|
browserArgs: [
|
|
'--no-sandbox',
|
|
'--disable-setuid-sandbox',
|
|
'--disable-dev-shm-usage',
|
|
'--disable-blink-features=AutomationControlled',
|
|
],
|
|
/** Navigation timeout in ms */
|
|
navigationTimeout: 60000,
|
|
/** Initial page load delay in ms */
|
|
pageLoadDelay: 2000,
|
|
};
|
|
/**
|
|
* Get GraphQL hashes object for backward compatibility
|
|
*/
|
|
exports.GRAPHQL_HASHES = {
|
|
FilteredProducts: exports.dutchieConfig.filteredProductsHash,
|
|
GetAddressBasedDispensaryData: exports.dutchieConfig.getDispensaryDataHash,
|
|
ConsumerDispensaries: exports.dutchieConfig.consumerDispensariesHash,
|
|
};
|
|
/**
|
|
* Arizona geo centerpoints for discovery scans
|
|
*/
|
|
exports.ARIZONA_CENTERPOINTS = [
|
|
{ name: 'Phoenix', lat: 33.4484, lng: -112.074 },
|
|
{ name: 'Tucson', lat: 32.2226, lng: -110.9747 },
|
|
{ name: 'Flagstaff', lat: 35.1983, lng: -111.6513 },
|
|
{ name: 'Mesa', lat: 33.4152, lng: -111.8315 },
|
|
{ name: 'Scottsdale', lat: 33.4942, lng: -111.9261 },
|
|
{ name: 'Tempe', lat: 33.4255, lng: -111.94 },
|
|
{ name: 'Yuma', lat: 32.6927, lng: -114.6277 },
|
|
{ name: 'Prescott', lat: 34.54, lng: -112.4685 },
|
|
{ name: 'Lake Havasu', lat: 34.4839, lng: -114.3224 },
|
|
{ name: 'Sierra Vista', lat: 31.5455, lng: -110.2773 },
|
|
];
|