[{"data":1,"prerenderedAt":9290},["ShallowReactive",2],{"content-query-I16D7CSOrK":3,"related-posts-/blog/nuxt-and-cloudflare-vectorize-setting-up-d1-drizzle-and-workers-ai-/blog/nuxt-cloudflare-queues-and-vectorize-data-sync-pipeline-/blog/build-and-deploy-nuxt3-static-site-with-pinia-and-stripe-checkout-on-firebase":9274},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"layout":10,"date":11,"intro":9,"preview_image":12,"featured_image":13,"openGraph":14,"datePublished":11,"dateModified":11,"breadcrumbs":20,"related":24,"body":28,"_type":9268,"_id":9269,"_source":9270,"_file":9271,"_stem":9272,"_extension":9273},"/blog/nuxt-cloudflare-vectorize-semantic-matching","blog",false,"en","Implementing Semantic Matching in Nuxt with Cloudflare Vectorize","Learn how to implement AI-powered semantic matching in Nuxt using Cloudflare Vectorize. We normalize messy real-world data using vector search and automate the workflow with scheduled tasks.","article","2025-12-21","/nuxt-cloudflare-vectorize-semantic-matching/nuxt-cloudflare-vectorize-semantic-matching.webp","/nuxt-cloudflare-vectorize-semantic-matching/nuxt-cloudflare-vectorize-semantic-matching_featured.webp",{"image":15},{"url":16,"width":17,"height":18,"type":19},"/images/og/nuxt-cloudflare-vectorize-semantic-matching.png",1200,630,"image/png",[21],{"title":22,"url":23},"Blog","/blog/",[25,26,27],"/blog/nuxt-and-cloudflare-vectorize-setting-up-d1-drizzle-and-workers-ai","/blog/nuxt-cloudflare-queues-and-vectorize-data-sync-pipeline","/blog/build-and-deploy-nuxt3-static-site-with-pinia-and-stripe-checkout-on-firebase",{"type":29,"children":30,"toc":9260},"root",[31,41,56,69,114,132,137,142,149,163,481,493,560,565,701,714,750,1720,1732,1737,1743,1748,1753,1762,1772,1784,3887,3899,3904,3908,3914,3919,3940,3953,3966,4470,4482,5712,5725,5738,5743,5780,5791,5913,5924,5978,5991,7091,7103,8105,8118,8566,8571,8583,8911,8916,8993,9006,9014,9019,9026,9031,9052,9084,9096,9170,9175,9181,9186,9191,9225,9230,9244,9249,9254],{"type":32,"tag":33,"props":34,"children":35},"element","p",{},[36],{"type":32,"tag":37,"props":38,"children":40},"img",{"alt":8,"height":18,"src":39,"title":8,"width":17},"/images/blog/articles/nuxt-cloudflare-vectorize-semantic-matching/nuxt-cloudflare-vectorize-semantic-matching.webp",[],{"type":32,"tag":33,"props":42,"children":43},{},[44,47,54],{"type":45,"value":46},"text","Building on the ",{"type":32,"tag":48,"props":49,"children":51},"a",{"href":50},"/blog/nuxt-cloudflare-queues-and-vectorize-data-sync-pipeline/",[52],{"type":45,"value":53},"previous article",{"type":45,"value":55},", where we set up our Cloudflare Queue to process location data and populate the Vectorize store, this article focuses on implementing the core semantic matching logic. This step is crucial for accurately matching locations from property agents' feeds with our internal data, enabling effective synchronisation of property data.",{"type":32,"tag":33,"props":57,"children":58},{},[59,61,67],{"type":45,"value":60},"This article is the third and final part of the ",{"type":32,"tag":62,"props":63,"children":64},"strong",{},[65],{"type":45,"value":66},"Nuxt & Cloudflare AI Vector Pipeline Series",{"type":45,"value":68},":",{"type":32,"tag":70,"props":71,"children":72},"ul",{},[73,90,104],{"type":32,"tag":74,"props":75,"children":76},"li",{},[77,82,84],{"type":32,"tag":62,"props":78,"children":79},{},[80],{"type":45,"value":81},"Part one:",{"type":45,"value":83}," ",{"type":32,"tag":48,"props":85,"children":87},{"href":86},"/blog/nuxt-and-cloudflare-vectorize-setting-up-d1-drizzle-and-workers-ai/",[88],{"type":45,"value":89},"Nuxt & Cloudflare Vectorize: Setting up D1, Drizzle, and Workers AI",{"type":32,"tag":74,"props":91,"children":92},{},[93,98,99],{"type":32,"tag":62,"props":94,"children":95},{},[96],{"type":45,"value":97},"Part two:",{"type":45,"value":83},{"type":32,"tag":48,"props":100,"children":101},{"href":50},[102],{"type":45,"value":103},"Nuxt & Cloudflare Queues: Building a Data Sync Pipeline using Vectorize",{"type":32,"tag":74,"props":105,"children":106},{},[107,112],{"type":32,"tag":62,"props":108,"children":109},{},[110],{"type":45,"value":111},"Part three:",{"type":45,"value":113}," Implementing semantic matching in Nuxt with Cloudflare Vectorize",{"type":32,"tag":33,"props":115,"children":116},{},[117,119,130],{"type":45,"value":118},"The code for the entire demo application is publicly available on GitHub: ",{"type":32,"tag":48,"props":120,"children":125},{"href":121,"rel":122,":target":124},"https://github.com/keithmifsud/nuxt-data-sync-pipeline-with-cloudflare-cron-queues-and-ai-vectorize-demo",[123],"nofollow","_blank",[126],{"type":32,"tag":62,"props":127,"children":128},{},[129],{"type":45,"value":66},{"type":45,"value":131}," — give it a ⭐.",{"type":32,"tag":33,"props":133,"children":134},{},[135],{"type":45,"value":136},"The outcome covered today is a scheduled Nitro Task that adds properties from the agents' dummy feeds. We use a service class for the synchronisation process and a queue so that the process runs in the background, in batches.",{"type":32,"tag":33,"props":138,"children":139},{},[140],{"type":45,"value":141},"I opted to use a service because the sync process includes several steps: retrieving the agent feed, ignoring previously added properties, attempting to match the agent property to our locations datatable using simple string matching, falling back to AI Semantic matching, and finally persisting the matched properties to our database.",{"type":32,"tag":143,"props":144,"children":146},"h2",{"id":145},"cloudflare-vectorize-semantic-matching",[147],{"type":45,"value":148},"Cloudflare Vectorize semantic matching",{"type":32,"tag":33,"props":150,"children":151},{},[152,154,161],{"type":45,"value":153},"Since we know our service will need to use an AI vector repository, we can add this dependency. Create ",{"type":32,"tag":155,"props":156,"children":158},"code",{"className":157},[],[159],{"type":45,"value":160},"/server/utils/services/propertySync/repository/AILocationMatcherRepository.ts",{"type":45,"value":162}," with:",{"type":32,"tag":164,"props":165,"children":170},"pre",{"className":166,"code":167,"language":168,"meta":169,"style":169},"language-typescript shiki shiki-themes monokai","import {\n  AILocationMatch,\n} from '~~/server/utils/services/propertySync/AILocationMatch'\nimport {\n  AgentProperty,\n} from '~~/server/utils/services/propertySync/AgentProperty'\n\nexport interface AILocationMatcherRepository {\n  /**\n   * Attempts to find location matches based on the provided query.\n   *\n   * @returns A promise that resolves to an array of AILocationMatch objects.\n   * @param property\n   * @param limit\n   */\n  findMatches (\n    property: AgentProperty, limit?: number\n  ): Promise\u003CAILocationMatch[]>\n}\n","typescript","",[171],{"type":32,"tag":155,"props":172,"children":173},{"__ignoreMap":169},[174,192,201,221,233,242,259,269,294,304,313,322,341,359,376,385,400,439,472],{"type":32,"tag":175,"props":176,"children":179},"span",{"class":177,"line":178},"line",1,[180,186],{"type":32,"tag":175,"props":181,"children":183},{"style":182},"--shiki-default:#F92672",[184],{"type":45,"value":185},"import",{"type":32,"tag":175,"props":187,"children":189},{"style":188},"--shiki-default:#F8F8F2",[190],{"type":45,"value":191}," {\n",{"type":32,"tag":175,"props":193,"children":195},{"class":177,"line":194},2,[196],{"type":32,"tag":175,"props":197,"children":198},{"style":188},[199],{"type":45,"value":200},"  AILocationMatch,\n",{"type":32,"tag":175,"props":202,"children":204},{"class":177,"line":203},3,[205,210,215],{"type":32,"tag":175,"props":206,"children":207},{"style":188},[208],{"type":45,"value":209},"} ",{"type":32,"tag":175,"props":211,"children":212},{"style":182},[213],{"type":45,"value":214},"from",{"type":32,"tag":175,"props":216,"children":218},{"style":217},"--shiki-default:#E6DB74",[219],{"type":45,"value":220}," '~~/server/utils/services/propertySync/AILocationMatch'\n",{"type":32,"tag":175,"props":222,"children":224},{"class":177,"line":223},4,[225,229],{"type":32,"tag":175,"props":226,"children":227},{"style":182},[228],{"type":45,"value":185},{"type":32,"tag":175,"props":230,"children":231},{"style":188},[232],{"type":45,"value":191},{"type":32,"tag":175,"props":234,"children":236},{"class":177,"line":235},5,[237],{"type":32,"tag":175,"props":238,"children":239},{"style":188},[240],{"type":45,"value":241},"  AgentProperty,\n",{"type":32,"tag":175,"props":243,"children":245},{"class":177,"line":244},6,[246,250,254],{"type":32,"tag":175,"props":247,"children":248},{"style":188},[249],{"type":45,"value":209},{"type":32,"tag":175,"props":251,"children":252},{"style":182},[253],{"type":45,"value":214},{"type":32,"tag":175,"props":255,"children":256},{"style":217},[257],{"type":45,"value":258}," '~~/server/utils/services/propertySync/AgentProperty'\n",{"type":32,"tag":175,"props":260,"children":262},{"class":177,"line":261},7,[263],{"type":32,"tag":175,"props":264,"children":266},{"emptyLinePlaceholder":265},true,[267],{"type":45,"value":268},"\n",{"type":32,"tag":175,"props":270,"children":272},{"class":177,"line":271},8,[273,278,284,290],{"type":32,"tag":175,"props":274,"children":275},{"style":182},[276],{"type":45,"value":277},"export",{"type":32,"tag":175,"props":279,"children":281},{"style":280},"--shiki-default:#66D9EF;--shiki-default-font-style:italic",[282],{"type":45,"value":283}," interface",{"type":32,"tag":175,"props":285,"children":287},{"style":286},"--shiki-default:#A6E22E;--shiki-default-text-decoration:underline",[288],{"type":45,"value":289}," AILocationMatcherRepository",{"type":32,"tag":175,"props":291,"children":292},{"style":188},[293],{"type":45,"value":191},{"type":32,"tag":175,"props":295,"children":297},{"class":177,"line":296},9,[298],{"type":32,"tag":175,"props":299,"children":301},{"style":300},"--shiki-default:#88846F",[302],{"type":45,"value":303},"  /**\n",{"type":32,"tag":175,"props":305,"children":307},{"class":177,"line":306},10,[308],{"type":32,"tag":175,"props":309,"children":310},{"style":300},[311],{"type":45,"value":312},"   * Attempts to find location matches based on the provided query.\n",{"type":32,"tag":175,"props":314,"children":316},{"class":177,"line":315},11,[317],{"type":32,"tag":175,"props":318,"children":319},{"style":300},[320],{"type":45,"value":321},"   *\n",{"type":32,"tag":175,"props":323,"children":325},{"class":177,"line":324},12,[326,331,336],{"type":32,"tag":175,"props":327,"children":328},{"style":300},[329],{"type":45,"value":330},"   * ",{"type":32,"tag":175,"props":332,"children":333},{"style":280},[334],{"type":45,"value":335},"@returns",{"type":32,"tag":175,"props":337,"children":338},{"style":300},[339],{"type":45,"value":340}," A promise that resolves to an array of AILocationMatch objects.\n",{"type":32,"tag":175,"props":342,"children":344},{"class":177,"line":343},13,[345,349,354],{"type":32,"tag":175,"props":346,"children":347},{"style":300},[348],{"type":45,"value":330},{"type":32,"tag":175,"props":350,"children":351},{"style":280},[352],{"type":45,"value":353},"@param",{"type":32,"tag":175,"props":355,"children":356},{"style":188},[357],{"type":45,"value":358}," property\n",{"type":32,"tag":175,"props":360,"children":362},{"class":177,"line":361},14,[363,367,371],{"type":32,"tag":175,"props":364,"children":365},{"style":300},[366],{"type":45,"value":330},{"type":32,"tag":175,"props":368,"children":369},{"style":280},[370],{"type":45,"value":353},{"type":32,"tag":175,"props":372,"children":373},{"style":188},[374],{"type":45,"value":375}," limit\n",{"type":32,"tag":175,"props":377,"children":379},{"class":177,"line":378},15,[380],{"type":32,"tag":175,"props":381,"children":382},{"style":300},[383],{"type":45,"value":384},"   */\n",{"type":32,"tag":175,"props":386,"children":388},{"class":177,"line":387},16,[389,395],{"type":32,"tag":175,"props":390,"children":392},{"style":391},"--shiki-default:#A6E22E",[393],{"type":45,"value":394},"  findMatches",{"type":32,"tag":175,"props":396,"children":397},{"style":188},[398],{"type":45,"value":399}," (\n",{"type":32,"tag":175,"props":401,"children":403},{"class":177,"line":402},17,[404,410,414,419,424,429,434],{"type":32,"tag":175,"props":405,"children":407},{"style":406},"--shiki-default:#FD971F;--shiki-default-font-style:italic",[408],{"type":45,"value":409},"    property",{"type":32,"tag":175,"props":411,"children":412},{"style":182},[413],{"type":45,"value":68},{"type":32,"tag":175,"props":415,"children":416},{"style":286},[417],{"type":45,"value":418}," AgentProperty",{"type":32,"tag":175,"props":420,"children":421},{"style":188},[422],{"type":45,"value":423},", ",{"type":32,"tag":175,"props":425,"children":426},{"style":406},[427],{"type":45,"value":428},"limit",{"type":32,"tag":175,"props":430,"children":431},{"style":182},[432],{"type":45,"value":433},"?:",{"type":32,"tag":175,"props":435,"children":436},{"style":280},[437],{"type":45,"value":438}," number\n",{"type":32,"tag":175,"props":440,"children":442},{"class":177,"line":441},18,[443,448,452,457,462,467],{"type":32,"tag":175,"props":444,"children":445},{"style":188},[446],{"type":45,"value":447},"  )",{"type":32,"tag":175,"props":449,"children":450},{"style":182},[451],{"type":45,"value":68},{"type":32,"tag":175,"props":453,"children":454},{"style":286},[455],{"type":45,"value":456}," Promise",{"type":32,"tag":175,"props":458,"children":459},{"style":188},[460],{"type":45,"value":461},"\u003C",{"type":32,"tag":175,"props":463,"children":464},{"style":286},[465],{"type":45,"value":466},"AILocationMatch",{"type":32,"tag":175,"props":468,"children":469},{"style":188},[470],{"type":45,"value":471},"[]>\n",{"type":32,"tag":175,"props":473,"children":475},{"class":177,"line":474},19,[476],{"type":32,"tag":175,"props":477,"children":478},{"style":188},[479],{"type":45,"value":480},"}\n",{"type":32,"tag":33,"props":482,"children":483},{},[484,486,492],{"type":45,"value":485},"and ",{"type":32,"tag":155,"props":487,"children":489},{"className":488},[],[490],{"type":45,"value":491},"/server/utils/services/propertySync/AILocationMatch.ts",{"type":45,"value":162},{"type":32,"tag":164,"props":494,"children":496},{"className":166,"code":495,"language":168,"meta":169,"style":169},"export interface AILocationMatch {\n  id: string\n  score: number\n}\n",[497],{"type":32,"tag":155,"props":498,"children":499},{"__ignoreMap":169},[500,520,537,553],{"type":32,"tag":175,"props":501,"children":502},{"class":177,"line":178},[503,507,511,516],{"type":32,"tag":175,"props":504,"children":505},{"style":182},[506],{"type":45,"value":277},{"type":32,"tag":175,"props":508,"children":509},{"style":280},[510],{"type":45,"value":283},{"type":32,"tag":175,"props":512,"children":513},{"style":286},[514],{"type":45,"value":515}," AILocationMatch",{"type":32,"tag":175,"props":517,"children":518},{"style":188},[519],{"type":45,"value":191},{"type":32,"tag":175,"props":521,"children":522},{"class":177,"line":194},[523,528,532],{"type":32,"tag":175,"props":524,"children":525},{"style":188},[526],{"type":45,"value":527},"  id",{"type":32,"tag":175,"props":529,"children":530},{"style":182},[531],{"type":45,"value":68},{"type":32,"tag":175,"props":533,"children":534},{"style":280},[535],{"type":45,"value":536}," string\n",{"type":32,"tag":175,"props":538,"children":539},{"class":177,"line":203},[540,545,549],{"type":32,"tag":175,"props":541,"children":542},{"style":188},[543],{"type":45,"value":544},"  score",{"type":32,"tag":175,"props":546,"children":547},{"style":182},[548],{"type":45,"value":68},{"type":32,"tag":175,"props":550,"children":551},{"style":280},[552],{"type":45,"value":438},{"type":32,"tag":175,"props":554,"children":555},{"class":177,"line":223},[556],{"type":32,"tag":175,"props":557,"children":558},{"style":188},[559],{"type":45,"value":480},{"type":32,"tag":33,"props":561,"children":562},{},[563],{"type":45,"value":564},"and also ``server/utils/services/propertySync/AgentProperty.ts` with:",{"type":32,"tag":164,"props":566,"children":568},{"className":166,"code":567,"language":168,"meta":169,"style":169},"export interface AgentProperty {\n  propertyId: string;\n  title: string;\n  description?: string;\n  location?: string,\n  postcode?: string,\n}\n",[569],{"type":32,"tag":155,"props":570,"children":571},{"__ignoreMap":169},[572,591,613,633,653,674,694],{"type":32,"tag":175,"props":573,"children":574},{"class":177,"line":178},[575,579,583,587],{"type":32,"tag":175,"props":576,"children":577},{"style":182},[578],{"type":45,"value":277},{"type":32,"tag":175,"props":580,"children":581},{"style":280},[582],{"type":45,"value":283},{"type":32,"tag":175,"props":584,"children":585},{"style":286},[586],{"type":45,"value":418},{"type":32,"tag":175,"props":588,"children":589},{"style":188},[590],{"type":45,"value":191},{"type":32,"tag":175,"props":592,"children":593},{"class":177,"line":194},[594,599,603,608],{"type":32,"tag":175,"props":595,"children":596},{"style":188},[597],{"type":45,"value":598},"  propertyId",{"type":32,"tag":175,"props":600,"children":601},{"style":182},[602],{"type":45,"value":68},{"type":32,"tag":175,"props":604,"children":605},{"style":280},[606],{"type":45,"value":607}," string",{"type":32,"tag":175,"props":609,"children":610},{"style":188},[611],{"type":45,"value":612},";\n",{"type":32,"tag":175,"props":614,"children":615},{"class":177,"line":203},[616,621,625,629],{"type":32,"tag":175,"props":617,"children":618},{"style":188},[619],{"type":45,"value":620},"  title",{"type":32,"tag":175,"props":622,"children":623},{"style":182},[624],{"type":45,"value":68},{"type":32,"tag":175,"props":626,"children":627},{"style":280},[628],{"type":45,"value":607},{"type":32,"tag":175,"props":630,"children":631},{"style":188},[632],{"type":45,"value":612},{"type":32,"tag":175,"props":634,"children":635},{"class":177,"line":223},[636,641,645,649],{"type":32,"tag":175,"props":637,"children":638},{"style":188},[639],{"type":45,"value":640},"  description",{"type":32,"tag":175,"props":642,"children":643},{"style":182},[644],{"type":45,"value":433},{"type":32,"tag":175,"props":646,"children":647},{"style":280},[648],{"type":45,"value":607},{"type":32,"tag":175,"props":650,"children":651},{"style":188},[652],{"type":45,"value":612},{"type":32,"tag":175,"props":654,"children":655},{"class":177,"line":235},[656,661,665,669],{"type":32,"tag":175,"props":657,"children":658},{"style":188},[659],{"type":45,"value":660},"  location",{"type":32,"tag":175,"props":662,"children":663},{"style":182},[664],{"type":45,"value":433},{"type":32,"tag":175,"props":666,"children":667},{"style":280},[668],{"type":45,"value":607},{"type":32,"tag":175,"props":670,"children":671},{"style":188},[672],{"type":45,"value":673},",\n",{"type":32,"tag":175,"props":675,"children":676},{"class":177,"line":244},[677,682,686,690],{"type":32,"tag":175,"props":678,"children":679},{"style":188},[680],{"type":45,"value":681},"  postcode",{"type":32,"tag":175,"props":683,"children":684},{"style":182},[685],{"type":45,"value":433},{"type":32,"tag":175,"props":687,"children":688},{"style":280},[689],{"type":45,"value":607},{"type":32,"tag":175,"props":691,"children":692},{"style":188},[693],{"type":45,"value":673},{"type":32,"tag":175,"props":695,"children":696},{"class":177,"line":261},[697],{"type":32,"tag":175,"props":698,"children":699},{"style":188},[700],{"type":45,"value":480},{"type":32,"tag":33,"props":702,"children":703},{},[704,706,712],{"type":45,"value":705},"For the returned promise by the repository's ",{"type":32,"tag":155,"props":707,"children":709},{"className":708},[],[710],{"type":45,"value":711},"findMatches()",{"type":45,"value":713}," method.",{"type":32,"tag":33,"props":715,"children":716},{},[717,719,725,727,733,735,741,743,748],{"type":45,"value":718},"We can now implement the repository interface ",{"type":32,"tag":155,"props":720,"children":722},{"className":721},[],[723],{"type":45,"value":724},"AILocationMatcherRepository",{"type":45,"value":726}," in our ",{"type":32,"tag":155,"props":728,"children":730},{"className":729},[],[731],{"type":45,"value":732},"CloudflareVectorAIRepository",{"type":45,"value":734},", which we created ",{"type":32,"tag":48,"props":736,"children":738},{"href":737},"/blog/nuxt-cloudflare-queues-and-vectorize-data-sync-pipeline/#upserting-vectors-using-cloudflare-workers-ai-and-vectorize",[739],{"type":45,"value":740},"last time",{"type":45,"value":742},", and implement the ",{"type":32,"tag":155,"props":744,"children":746},{"className":745},[],[747],{"type":45,"value":711},{"type":45,"value":749}," like so:",{"type":32,"tag":164,"props":751,"children":753},{"className":166,"code":752,"language":168,"meta":169,"style":169}," /**\n   * Finds matching locations for the given agent property.\n   *\n   * @param property\n   * @param limit\n   */\n  public async findMatches (\n    property: AgentProperty,\n    limit: number = 5,\n  ): Promise\u003CAILocationMatch[]> {\n\n    const queryText = this.buildSearchQueryForProperty(property)\n\n    if (!queryText) return []\n\n    try {\n      // Generate Embedding\n      // Wraps existing private helper in case of model timeouts\n      const vectors = await this.embedTextBatch([queryText])\n      const queryVector = vectors[0]\n\n      if (!queryVector) return []\n\n      // Query Vectorize\n      const result = await this.vectorIndex.query(queryVector, {\n        topK: limit,\n        returnMetadata: 'none',\n      })\n\n      // Map Results\n      return  result.matches.map((match) => ({\n        id: match.id,\n        score: match.score,\n      }))\n\n    } catch (error) {\n      console.error('[Repo] Vector search failed:', error)\n      return []\n    }\n  }\n  \n   /**\n   * Builds the search query string for an agent's property.\n   *\n   * @param property\n   * @private\n   */\n  private buildSearchQueryForProperty (property: AgentProperty): string {\n    const parts: string[] = [\n      property.title,\n      property.description ?? '',\n      property.postcode ?? '',\n      property.location ?? '',\n    ]\n\n    return parts\n    .filter(p => p && p.trim().length > 0)\n    .join(' ')\n    .trim()\n  }\n",[754],{"type":32,"tag":155,"props":755,"children":756},{"__ignoreMap":169},[757,765,773,780,795,810,817,834,842,865,896,903,936,943,966,973,981,989,997,1037,1069,1077,1111,1119,1128,1168,1177,1195,1204,1212,1221,1265,1274,1283,1292,1300,1309,1346,1355,1364,1373,1382,1391,1400,1408,1424,1437,1445,1463,1499,1508,1531,1552,1573,1582,1590,1604,1669,1695,1712],{"type":32,"tag":175,"props":758,"children":759},{"class":177,"line":178},[760],{"type":32,"tag":175,"props":761,"children":762},{"style":300},[763],{"type":45,"value":764}," /**\n",{"type":32,"tag":175,"props":766,"children":767},{"class":177,"line":194},[768],{"type":32,"tag":175,"props":769,"children":770},{"style":300},[771],{"type":45,"value":772},"   * Finds matching locations for the given agent property.\n",{"type":32,"tag":175,"props":774,"children":775},{"class":177,"line":203},[776],{"type":32,"tag":175,"props":777,"children":778},{"style":300},[779],{"type":45,"value":321},{"type":32,"tag":175,"props":781,"children":782},{"class":177,"line":223},[783,787,791],{"type":32,"tag":175,"props":784,"children":785},{"style":300},[786],{"type":45,"value":330},{"type":32,"tag":175,"props":788,"children":789},{"style":280},[790],{"type":45,"value":353},{"type":32,"tag":175,"props":792,"children":793},{"style":188},[794],{"type":45,"value":358},{"type":32,"tag":175,"props":796,"children":797},{"class":177,"line":235},[798,802,806],{"type":32,"tag":175,"props":799,"children":800},{"style":300},[801],{"type":45,"value":330},{"type":32,"tag":175,"props":803,"children":804},{"style":280},[805],{"type":45,"value":353},{"type":32,"tag":175,"props":807,"children":808},{"style":188},[809],{"type":45,"value":375},{"type":32,"tag":175,"props":811,"children":812},{"class":177,"line":244},[813],{"type":32,"tag":175,"props":814,"children":815},{"style":300},[816],{"type":45,"value":384},{"type":32,"tag":175,"props":818,"children":819},{"class":177,"line":261},[820,825,830],{"type":32,"tag":175,"props":821,"children":822},{"style":188},[823],{"type":45,"value":824},"  public async ",{"type":32,"tag":175,"props":826,"children":827},{"style":391},[828],{"type":45,"value":829},"findMatches",{"type":32,"tag":175,"props":831,"children":832},{"style":188},[833],{"type":45,"value":399},{"type":32,"tag":175,"props":835,"children":836},{"class":177,"line":271},[837],{"type":32,"tag":175,"props":838,"children":839},{"style":188},[840],{"type":45,"value":841},"    property: AgentProperty,\n",{"type":32,"tag":175,"props":843,"children":844},{"class":177,"line":296},[845,850,855,861],{"type":32,"tag":175,"props":846,"children":847},{"style":188},[848],{"type":45,"value":849},"    limit: number ",{"type":32,"tag":175,"props":851,"children":852},{"style":182},[853],{"type":45,"value":854},"=",{"type":32,"tag":175,"props":856,"children":858},{"style":857},"--shiki-default:#AE81FF",[859],{"type":45,"value":860}," 5",{"type":32,"tag":175,"props":862,"children":863},{"style":188},[864],{"type":45,"value":673},{"type":32,"tag":175,"props":866,"children":867},{"class":177,"line":306},[868,873,878,882,887,892],{"type":32,"tag":175,"props":869,"children":870},{"style":188},[871],{"type":45,"value":872},"  ): ",{"type":32,"tag":175,"props":874,"children":875},{"style":280},[876],{"type":45,"value":877},"Promise",{"type":32,"tag":175,"props":879,"children":880},{"style":182},[881],{"type":45,"value":461},{"type":32,"tag":175,"props":883,"children":884},{"style":188},[885],{"type":45,"value":886},"AILocationMatch[]",{"type":32,"tag":175,"props":888,"children":889},{"style":182},[890],{"type":45,"value":891},">",{"type":32,"tag":175,"props":893,"children":894},{"style":188},[895],{"type":45,"value":191},{"type":32,"tag":175,"props":897,"children":898},{"class":177,"line":315},[899],{"type":32,"tag":175,"props":900,"children":901},{"emptyLinePlaceholder":265},[902],{"type":45,"value":268},{"type":32,"tag":175,"props":904,"children":905},{"class":177,"line":324},[906,911,915,921,926,931],{"type":32,"tag":175,"props":907,"children":908},{"style":188},[909],{"type":45,"value":910},"    const queryText ",{"type":32,"tag":175,"props":912,"children":913},{"style":182},[914],{"type":45,"value":854},{"type":32,"tag":175,"props":916,"children":918},{"style":917},"--shiki-default:#FD971F",[919],{"type":45,"value":920}," this",{"type":32,"tag":175,"props":922,"children":923},{"style":188},[924],{"type":45,"value":925},".",{"type":32,"tag":175,"props":927,"children":928},{"style":391},[929],{"type":45,"value":930},"buildSearchQueryForProperty",{"type":32,"tag":175,"props":932,"children":933},{"style":188},[934],{"type":45,"value":935},"(property)\n",{"type":32,"tag":175,"props":937,"children":938},{"class":177,"line":343},[939],{"type":32,"tag":175,"props":940,"children":941},{"emptyLinePlaceholder":265},[942],{"type":45,"value":268},{"type":32,"tag":175,"props":944,"children":945},{"class":177,"line":361},[946,951,956,961],{"type":32,"tag":175,"props":947,"children":948},{"style":391},[949],{"type":45,"value":950},"    if",{"type":32,"tag":175,"props":952,"children":953},{"style":188},[954],{"type":45,"value":955}," (!",{"type":32,"tag":175,"props":957,"children":958},{"style":406},[959],{"type":45,"value":960},"queryText",{"type":32,"tag":175,"props":962,"children":963},{"style":188},[964],{"type":45,"value":965},") return []\n",{"type":32,"tag":175,"props":967,"children":968},{"class":177,"line":378},[969],{"type":32,"tag":175,"props":970,"children":971},{"emptyLinePlaceholder":265},[972],{"type":45,"value":268},{"type":32,"tag":175,"props":974,"children":975},{"class":177,"line":387},[976],{"type":32,"tag":175,"props":977,"children":978},{"style":188},[979],{"type":45,"value":980},"    try {\n",{"type":32,"tag":175,"props":982,"children":983},{"class":177,"line":402},[984],{"type":32,"tag":175,"props":985,"children":986},{"style":300},[987],{"type":45,"value":988},"      // Generate Embedding\n",{"type":32,"tag":175,"props":990,"children":991},{"class":177,"line":441},[992],{"type":32,"tag":175,"props":993,"children":994},{"style":300},[995],{"type":45,"value":996},"      // Wraps existing private helper in case of model timeouts\n",{"type":32,"tag":175,"props":998,"children":999},{"class":177,"line":474},[1000,1005,1010,1014,1019,1023,1027,1032],{"type":32,"tag":175,"props":1001,"children":1002},{"style":280},[1003],{"type":45,"value":1004},"      const",{"type":32,"tag":175,"props":1006,"children":1007},{"style":188},[1008],{"type":45,"value":1009}," vectors ",{"type":32,"tag":175,"props":1011,"children":1012},{"style":182},[1013],{"type":45,"value":854},{"type":32,"tag":175,"props":1015,"children":1016},{"style":182},[1017],{"type":45,"value":1018}," await",{"type":32,"tag":175,"props":1020,"children":1021},{"style":917},[1022],{"type":45,"value":920},{"type":32,"tag":175,"props":1024,"children":1025},{"style":188},[1026],{"type":45,"value":925},{"type":32,"tag":175,"props":1028,"children":1029},{"style":391},[1030],{"type":45,"value":1031},"embedTextBatch",{"type":32,"tag":175,"props":1033,"children":1034},{"style":188},[1035],{"type":45,"value":1036},"([queryText])\n",{"type":32,"tag":175,"props":1038,"children":1040},{"class":177,"line":1039},20,[1041,1045,1050,1054,1059,1064],{"type":32,"tag":175,"props":1042,"children":1043},{"style":280},[1044],{"type":45,"value":1004},{"type":32,"tag":175,"props":1046,"children":1047},{"style":188},[1048],{"type":45,"value":1049}," queryVector ",{"type":32,"tag":175,"props":1051,"children":1052},{"style":182},[1053],{"type":45,"value":854},{"type":32,"tag":175,"props":1055,"children":1056},{"style":188},[1057],{"type":45,"value":1058}," vectors[",{"type":32,"tag":175,"props":1060,"children":1061},{"style":857},[1062],{"type":45,"value":1063},"0",{"type":32,"tag":175,"props":1065,"children":1066},{"style":188},[1067],{"type":45,"value":1068},"]\n",{"type":32,"tag":175,"props":1070,"children":1072},{"class":177,"line":1071},21,[1073],{"type":32,"tag":175,"props":1074,"children":1075},{"emptyLinePlaceholder":265},[1076],{"type":45,"value":268},{"type":32,"tag":175,"props":1078,"children":1080},{"class":177,"line":1079},22,[1081,1086,1091,1096,1101,1106],{"type":32,"tag":175,"props":1082,"children":1083},{"style":182},[1084],{"type":45,"value":1085},"      if",{"type":32,"tag":175,"props":1087,"children":1088},{"style":188},[1089],{"type":45,"value":1090}," (",{"type":32,"tag":175,"props":1092,"children":1093},{"style":182},[1094],{"type":45,"value":1095},"!",{"type":32,"tag":175,"props":1097,"children":1098},{"style":188},[1099],{"type":45,"value":1100},"queryVector) ",{"type":32,"tag":175,"props":1102,"children":1103},{"style":182},[1104],{"type":45,"value":1105},"return",{"type":32,"tag":175,"props":1107,"children":1108},{"style":188},[1109],{"type":45,"value":1110}," []\n",{"type":32,"tag":175,"props":1112,"children":1114},{"class":177,"line":1113},23,[1115],{"type":32,"tag":175,"props":1116,"children":1117},{"emptyLinePlaceholder":265},[1118],{"type":45,"value":268},{"type":32,"tag":175,"props":1120,"children":1122},{"class":177,"line":1121},24,[1123],{"type":32,"tag":175,"props":1124,"children":1125},{"style":300},[1126],{"type":45,"value":1127},"      // Query Vectorize\n",{"type":32,"tag":175,"props":1129,"children":1131},{"class":177,"line":1130},25,[1132,1136,1141,1145,1149,1153,1158,1163],{"type":32,"tag":175,"props":1133,"children":1134},{"style":280},[1135],{"type":45,"value":1004},{"type":32,"tag":175,"props":1137,"children":1138},{"style":188},[1139],{"type":45,"value":1140}," result ",{"type":32,"tag":175,"props":1142,"children":1143},{"style":182},[1144],{"type":45,"value":854},{"type":32,"tag":175,"props":1146,"children":1147},{"style":182},[1148],{"type":45,"value":1018},{"type":32,"tag":175,"props":1150,"children":1151},{"style":917},[1152],{"type":45,"value":920},{"type":32,"tag":175,"props":1154,"children":1155},{"style":188},[1156],{"type":45,"value":1157},".vectorIndex.",{"type":32,"tag":175,"props":1159,"children":1160},{"style":391},[1161],{"type":45,"value":1162},"query",{"type":32,"tag":175,"props":1164,"children":1165},{"style":188},[1166],{"type":45,"value":1167},"(queryVector, {\n",{"type":32,"tag":175,"props":1169,"children":1171},{"class":177,"line":1170},26,[1172],{"type":32,"tag":175,"props":1173,"children":1174},{"style":188},[1175],{"type":45,"value":1176},"        topK: limit,\n",{"type":32,"tag":175,"props":1178,"children":1180},{"class":177,"line":1179},27,[1181,1186,1191],{"type":32,"tag":175,"props":1182,"children":1183},{"style":188},[1184],{"type":45,"value":1185},"        returnMetadata: ",{"type":32,"tag":175,"props":1187,"children":1188},{"style":217},[1189],{"type":45,"value":1190},"'none'",{"type":32,"tag":175,"props":1192,"children":1193},{"style":188},[1194],{"type":45,"value":673},{"type":32,"tag":175,"props":1196,"children":1198},{"class":177,"line":1197},28,[1199],{"type":32,"tag":175,"props":1200,"children":1201},{"style":188},[1202],{"type":45,"value":1203},"      })\n",{"type":32,"tag":175,"props":1205,"children":1207},{"class":177,"line":1206},29,[1208],{"type":32,"tag":175,"props":1209,"children":1210},{"emptyLinePlaceholder":265},[1211],{"type":45,"value":268},{"type":32,"tag":175,"props":1213,"children":1215},{"class":177,"line":1214},30,[1216],{"type":32,"tag":175,"props":1217,"children":1218},{"style":300},[1219],{"type":45,"value":1220},"      // Map Results\n",{"type":32,"tag":175,"props":1222,"children":1224},{"class":177,"line":1223},31,[1225,1230,1235,1240,1245,1250,1255,1260],{"type":32,"tag":175,"props":1226,"children":1227},{"style":182},[1228],{"type":45,"value":1229},"      return",{"type":32,"tag":175,"props":1231,"children":1232},{"style":188},[1233],{"type":45,"value":1234},"  result.matches.",{"type":32,"tag":175,"props":1236,"children":1237},{"style":391},[1238],{"type":45,"value":1239},"map",{"type":32,"tag":175,"props":1241,"children":1242},{"style":188},[1243],{"type":45,"value":1244},"((",{"type":32,"tag":175,"props":1246,"children":1247},{"style":406},[1248],{"type":45,"value":1249},"match",{"type":32,"tag":175,"props":1251,"children":1252},{"style":188},[1253],{"type":45,"value":1254},") ",{"type":32,"tag":175,"props":1256,"children":1257},{"style":280},[1258],{"type":45,"value":1259},"=>",{"type":32,"tag":175,"props":1261,"children":1262},{"style":188},[1263],{"type":45,"value":1264}," ({\n",{"type":32,"tag":175,"props":1266,"children":1268},{"class":177,"line":1267},32,[1269],{"type":32,"tag":175,"props":1270,"children":1271},{"style":188},[1272],{"type":45,"value":1273},"        id: match.id,\n",{"type":32,"tag":175,"props":1275,"children":1277},{"class":177,"line":1276},33,[1278],{"type":32,"tag":175,"props":1279,"children":1280},{"style":188},[1281],{"type":45,"value":1282},"        score: match.score,\n",{"type":32,"tag":175,"props":1284,"children":1286},{"class":177,"line":1285},34,[1287],{"type":32,"tag":175,"props":1288,"children":1289},{"style":188},[1290],{"type":45,"value":1291},"      }))\n",{"type":32,"tag":175,"props":1293,"children":1295},{"class":177,"line":1294},35,[1296],{"type":32,"tag":175,"props":1297,"children":1298},{"emptyLinePlaceholder":265},[1299],{"type":45,"value":268},{"type":32,"tag":175,"props":1301,"children":1303},{"class":177,"line":1302},36,[1304],{"type":32,"tag":175,"props":1305,"children":1306},{"style":188},[1307],{"type":45,"value":1308},"    } catch (error) {\n",{"type":32,"tag":175,"props":1310,"children":1312},{"class":177,"line":1311},37,[1313,1318,1323,1328,1333,1337,1341],{"type":32,"tag":175,"props":1314,"children":1315},{"style":188},[1316],{"type":45,"value":1317},"      console.",{"type":32,"tag":175,"props":1319,"children":1320},{"style":391},[1321],{"type":45,"value":1322},"error",{"type":32,"tag":175,"props":1324,"children":1325},{"style":188},[1326],{"type":45,"value":1327},"(",{"type":32,"tag":175,"props":1329,"children":1330},{"style":217},[1331],{"type":45,"value":1332},"'[Repo] Vector search failed:'",{"type":32,"tag":175,"props":1334,"children":1335},{"style":188},[1336],{"type":45,"value":423},{"type":32,"tag":175,"props":1338,"children":1339},{"style":406},[1340],{"type":45,"value":1322},{"type":32,"tag":175,"props":1342,"children":1343},{"style":188},[1344],{"type":45,"value":1345},")\n",{"type":32,"tag":175,"props":1347,"children":1349},{"class":177,"line":1348},38,[1350],{"type":32,"tag":175,"props":1351,"children":1352},{"style":188},[1353],{"type":45,"value":1354},"      return []\n",{"type":32,"tag":175,"props":1356,"children":1358},{"class":177,"line":1357},39,[1359],{"type":32,"tag":175,"props":1360,"children":1361},{"style":188},[1362],{"type":45,"value":1363},"    }\n",{"type":32,"tag":175,"props":1365,"children":1367},{"class":177,"line":1366},40,[1368],{"type":32,"tag":175,"props":1369,"children":1370},{"style":188},[1371],{"type":45,"value":1372},"  }\n",{"type":32,"tag":175,"props":1374,"children":1376},{"class":177,"line":1375},41,[1377],{"type":32,"tag":175,"props":1378,"children":1379},{"style":188},[1380],{"type":45,"value":1381},"  \n",{"type":32,"tag":175,"props":1383,"children":1385},{"class":177,"line":1384},42,[1386],{"type":32,"tag":175,"props":1387,"children":1388},{"style":300},[1389],{"type":45,"value":1390},"   /**\n",{"type":32,"tag":175,"props":1392,"children":1394},{"class":177,"line":1393},43,[1395],{"type":32,"tag":175,"props":1396,"children":1397},{"style":300},[1398],{"type":45,"value":1399},"   * Builds the search query string for an agent's property.\n",{"type":32,"tag":175,"props":1401,"children":1403},{"class":177,"line":1402},44,[1404],{"type":32,"tag":175,"props":1405,"children":1406},{"style":300},[1407],{"type":45,"value":321},{"type":32,"tag":175,"props":1409,"children":1411},{"class":177,"line":1410},45,[1412,1416,1420],{"type":32,"tag":175,"props":1413,"children":1414},{"style":300},[1415],{"type":45,"value":330},{"type":32,"tag":175,"props":1417,"children":1418},{"style":280},[1419],{"type":45,"value":353},{"type":32,"tag":175,"props":1421,"children":1422},{"style":188},[1423],{"type":45,"value":358},{"type":32,"tag":175,"props":1425,"children":1427},{"class":177,"line":1426},46,[1428,1432],{"type":32,"tag":175,"props":1429,"children":1430},{"style":300},[1431],{"type":45,"value":330},{"type":32,"tag":175,"props":1433,"children":1434},{"style":280},[1435],{"type":45,"value":1436},"@private\n",{"type":32,"tag":175,"props":1438,"children":1440},{"class":177,"line":1439},47,[1441],{"type":32,"tag":175,"props":1442,"children":1443},{"style":300},[1444],{"type":45,"value":384},{"type":32,"tag":175,"props":1446,"children":1448},{"class":177,"line":1447},48,[1449,1454,1458],{"type":32,"tag":175,"props":1450,"children":1451},{"style":188},[1452],{"type":45,"value":1453},"  private ",{"type":32,"tag":175,"props":1455,"children":1456},{"style":391},[1457],{"type":45,"value":930},{"type":32,"tag":175,"props":1459,"children":1460},{"style":188},[1461],{"type":45,"value":1462}," (property: AgentProperty): string {\n",{"type":32,"tag":175,"props":1464,"children":1466},{"class":177,"line":1465},49,[1467,1472,1477,1481,1485,1490,1494],{"type":32,"tag":175,"props":1468,"children":1469},{"style":280},[1470],{"type":45,"value":1471},"    const",{"type":32,"tag":175,"props":1473,"children":1474},{"style":188},[1475],{"type":45,"value":1476}," parts",{"type":32,"tag":175,"props":1478,"children":1479},{"style":182},[1480],{"type":45,"value":68},{"type":32,"tag":175,"props":1482,"children":1483},{"style":280},[1484],{"type":45,"value":607},{"type":32,"tag":175,"props":1486,"children":1487},{"style":188},[1488],{"type":45,"value":1489},"[] ",{"type":32,"tag":175,"props":1491,"children":1492},{"style":182},[1493],{"type":45,"value":854},{"type":32,"tag":175,"props":1495,"children":1496},{"style":188},[1497],{"type":45,"value":1498}," [\n",{"type":32,"tag":175,"props":1500,"children":1502},{"class":177,"line":1501},50,[1503],{"type":32,"tag":175,"props":1504,"children":1505},{"style":188},[1506],{"type":45,"value":1507},"      property.title,\n",{"type":32,"tag":175,"props":1509,"children":1511},{"class":177,"line":1510},51,[1512,1517,1522,1527],{"type":32,"tag":175,"props":1513,"children":1514},{"style":188},[1515],{"type":45,"value":1516},"      property.description ",{"type":32,"tag":175,"props":1518,"children":1519},{"style":182},[1520],{"type":45,"value":1521},"??",{"type":32,"tag":175,"props":1523,"children":1524},{"style":217},[1525],{"type":45,"value":1526}," ''",{"type":32,"tag":175,"props":1528,"children":1529},{"style":188},[1530],{"type":45,"value":673},{"type":32,"tag":175,"props":1532,"children":1534},{"class":177,"line":1533},52,[1535,1540,1544,1548],{"type":32,"tag":175,"props":1536,"children":1537},{"style":188},[1538],{"type":45,"value":1539},"      property.postcode ",{"type":32,"tag":175,"props":1541,"children":1542},{"style":182},[1543],{"type":45,"value":1521},{"type":32,"tag":175,"props":1545,"children":1546},{"style":217},[1547],{"type":45,"value":1526},{"type":32,"tag":175,"props":1549,"children":1550},{"style":188},[1551],{"type":45,"value":673},{"type":32,"tag":175,"props":1553,"children":1555},{"class":177,"line":1554},53,[1556,1561,1565,1569],{"type":32,"tag":175,"props":1557,"children":1558},{"style":188},[1559],{"type":45,"value":1560},"      property.location ",{"type":32,"tag":175,"props":1562,"children":1563},{"style":182},[1564],{"type":45,"value":1521},{"type":32,"tag":175,"props":1566,"children":1567},{"style":217},[1568],{"type":45,"value":1526},{"type":32,"tag":175,"props":1570,"children":1571},{"style":188},[1572],{"type":45,"value":673},{"type":32,"tag":175,"props":1574,"children":1576},{"class":177,"line":1575},54,[1577],{"type":32,"tag":175,"props":1578,"children":1579},{"style":188},[1580],{"type":45,"value":1581},"    ]\n",{"type":32,"tag":175,"props":1583,"children":1585},{"class":177,"line":1584},55,[1586],{"type":32,"tag":175,"props":1587,"children":1588},{"emptyLinePlaceholder":265},[1589],{"type":45,"value":268},{"type":32,"tag":175,"props":1591,"children":1593},{"class":177,"line":1592},56,[1594,1599],{"type":32,"tag":175,"props":1595,"children":1596},{"style":182},[1597],{"type":45,"value":1598},"    return",{"type":32,"tag":175,"props":1600,"children":1601},{"style":188},[1602],{"type":45,"value":1603}," parts\n",{"type":32,"tag":175,"props":1605,"children":1607},{"class":177,"line":1606},57,[1608,1613,1618,1622,1626,1631,1636,1641,1646,1651,1656,1660,1665],{"type":32,"tag":175,"props":1609,"children":1610},{"style":188},[1611],{"type":45,"value":1612},"    .",{"type":32,"tag":175,"props":1614,"children":1615},{"style":391},[1616],{"type":45,"value":1617},"filter",{"type":32,"tag":175,"props":1619,"children":1620},{"style":188},[1621],{"type":45,"value":1327},{"type":32,"tag":175,"props":1623,"children":1624},{"style":406},[1625],{"type":45,"value":33},{"type":32,"tag":175,"props":1627,"children":1628},{"style":280},[1629],{"type":45,"value":1630}," =>",{"type":32,"tag":175,"props":1632,"children":1633},{"style":188},[1634],{"type":45,"value":1635}," p ",{"type":32,"tag":175,"props":1637,"children":1638},{"style":182},[1639],{"type":45,"value":1640},"&&",{"type":32,"tag":175,"props":1642,"children":1643},{"style":188},[1644],{"type":45,"value":1645}," p.",{"type":32,"tag":175,"props":1647,"children":1648},{"style":391},[1649],{"type":45,"value":1650},"trim",{"type":32,"tag":175,"props":1652,"children":1653},{"style":188},[1654],{"type":45,"value":1655},"().length ",{"type":32,"tag":175,"props":1657,"children":1658},{"style":182},[1659],{"type":45,"value":891},{"type":32,"tag":175,"props":1661,"children":1662},{"style":857},[1663],{"type":45,"value":1664}," 0",{"type":32,"tag":175,"props":1666,"children":1667},{"style":188},[1668],{"type":45,"value":1345},{"type":32,"tag":175,"props":1670,"children":1672},{"class":177,"line":1671},58,[1673,1677,1682,1686,1691],{"type":32,"tag":175,"props":1674,"children":1675},{"style":188},[1676],{"type":45,"value":1612},{"type":32,"tag":175,"props":1678,"children":1679},{"style":391},[1680],{"type":45,"value":1681},"join",{"type":32,"tag":175,"props":1683,"children":1684},{"style":188},[1685],{"type":45,"value":1327},{"type":32,"tag":175,"props":1687,"children":1688},{"style":217},[1689],{"type":45,"value":1690},"' '",{"type":32,"tag":175,"props":1692,"children":1693},{"style":188},[1694],{"type":45,"value":1345},{"type":32,"tag":175,"props":1696,"children":1698},{"class":177,"line":1697},59,[1699,1703,1707],{"type":32,"tag":175,"props":1700,"children":1701},{"style":188},[1702],{"type":45,"value":1612},{"type":32,"tag":175,"props":1704,"children":1705},{"style":391},[1706],{"type":45,"value":1650},{"type":32,"tag":175,"props":1708,"children":1709},{"style":188},[1710],{"type":45,"value":1711},"()\n",{"type":32,"tag":175,"props":1713,"children":1715},{"class":177,"line":1714},60,[1716],{"type":32,"tag":175,"props":1717,"children":1718},{"style":188},[1719],{"type":45,"value":1372},{"type":32,"tag":33,"props":1721,"children":1722},{},[1723,1725,1730],{"type":45,"value":1724},"The ",{"type":32,"tag":155,"props":1726,"children":1728},{"className":1727},[],[1729],{"type":45,"value":711},{"type":45,"value":1731}," method builds a text search query using several attributes of an Agent's property, which may help match a vectorised location, queries the vector index, and returns the best five matches.",{"type":32,"tag":33,"props":1733,"children":1734},{},[1735],{"type":45,"value":1736},"That's it for the vector store repository. We can now move on to a matching helper class.",{"type":32,"tag":143,"props":1738,"children":1740},{"id":1739},"semantic-search-semantic-matching-and-deterministic-checks",[1741],{"type":45,"value":1742},"Semantic search, semantic matching, and deterministic checks",{"type":32,"tag":33,"props":1744,"children":1745},{},[1746],{"type":45,"value":1747},"When working with semantic search, we aim to reduce the burden and thus reduce costs with external providers, whether that is Cloudflare or other AI model services. We should always take steps to resolve matching deterministically first.",{"type":32,"tag":33,"props":1749,"children":1750},{},[1751],{"type":45,"value":1752},"In our example, we do this by matching the agent's location name against our internal records using simple string matching; we do the same for postcodes. In a production system, we typically do much more than basic string matching, but I am keeping this example simple for brevity and because we are using Cloudflare's D1. Since D1 is essentially an SQLite database, it lacks the native advanced fuzzy matching functionality found in other engines.",{"type":32,"tag":1754,"props":1755,"children":1756},"blockquote",{},[1757],{"type":32,"tag":33,"props":1758,"children":1759},{},[1760],{"type":45,"value":1761},"💡 Note: PostgreSQL offers native fuzzy matching via trigrams, allowing it to understand that human errors such as 'London' and 'Lodnon' are the same entity without leaving the database layer. Let me know in the comments below if you’d like me to write more about AI integration strategies.",{"type":32,"tag":1763,"props":1764,"children":1771},"cta-section",{":sub-link":1765,"button-text":1766,"link":1767,"sub-link-text":1768,"text":1769,"title":1770},"/services/nuxt-consultant/","Get in touch","/contact","Nuxt consultant","I can help with every LLM and AI providers","Need help with AI integrations on Nuxt?",[],{"type":32,"tag":33,"props":1773,"children":1774},{},[1775,1777,1783],{"type":45,"value":1776},"With that said, let's add a helper class to avoid overcrowding our upcoming service class. Create ",{"type":32,"tag":155,"props":1778,"children":1780},{"className":1779},[],[1781],{"type":45,"value":1782},"server/utils/services/propertySync/helpers/LocationMatcher.ts",{"type":45,"value":162},{"type":32,"tag":164,"props":1785,"children":1787},{"className":166,"code":1786,"language":168,"meta":169,"style":169},"import type { Location } from '~~/server/database/types'\nimport type {\n  AILocationMatcherRepository,\n} from '~~/server/utils/services/propertySync/repositories/AILocationMatcherRepository'\nimport {\n  AILocationMatch,\n} from '~~/server/utils/services/propertySync/AILocationMatch'\nimport {\n  AgentProperty,\n} from '~~/server/utils/services/propertySync/AgentProperty'\n\n/**\n * Attempts to match raw agent location data with canonical internal Locations.\n */\nexport class LocationMatcher {\n  public constructor (\n    private readonly canonicalLocations: Location[],\n    private readonly aiLocationMatcherRepository: AILocationMatcherRepository,\n  ) {}\n\n  /**\n   * Attempts to match the given agent property location\n   * with an internal canonical location.\n   */\n  public async match (\n    agentProperty: AgentProperty,\n  ): Promise\u003CLocation | null> {\n\n    // \"easy string\" Tries strict name or postcode resolution first\n    const exactMatch = this.resolveExact(\n      agentProperty.location,\n      agentProperty.postcode,\n    )\n\n    if (exactMatch) {\n      return exactMatch\n    }\n\n    // Failing that, we try AI-based matching\n    const aiMatches = await this.aiLocationMatcherRepository.findMatches(\n      agentProperty,\n      5,\n    )\n\n    const autoLinkTarget = this.pickAutoLinkTarget(aiMatches)\n\n    if (autoLinkTarget) {\n      const matchedLocation = this.canonicalLocations.find(\n        (loc) => loc.id === autoLinkTarget.id,\n      )\n\n      if (matchedLocation) {\n        return matchedLocation\n      }\n    }\n\n    return null\n  }\n\n  /**\n   * Tries to find a Location based on exact Name match (case-insensitive)\n   * or Postcode prefix match.\n   *\n   * @private\n   * @param locationName\n   * @param postcode\n   */\n  private resolveExact (\n    locationName?: string,\n    postcode?: string,\n  ): Location | null {\n    // Name match first\n    if (locationName) {\n      const cleanName = locationName.trim().toLowerCase()\n      const matchedByName = this.canonicalLocations.find(\n        (loc) => loc.name.toLowerCase() === cleanName,\n      )\n      if (matchedByName) return matchedByName\n    }\n\n    // Then postcode prefix match\n    // Agent might provide \"E1 6AN\", we match if our location has \"E1\"\n    if (postcode) {\n      const cleanPostcode = postcode.trim().toUpperCase()\n\n      const matchedByPostcode = this.canonicalLocations.find((loc) =>\n        loc.postcodes.some(p => cleanPostcode.startsWith(p)),\n      )\n\n      if (matchedByPostcode) return matchedByPostcode\n    }\n\n    return null\n  }\n\n  /**\n   * Picks an auto-link target from the given candidates\n   * based on configured thresholds.\n   *\n   * @param candidates\n   * @returns The picked AI match or null if no suitable match is found.\n   */\n  public pickAutoLinkTarget (\n    candidates: AILocationMatch[],\n  ): AILocationMatch | null {\n    const config = useRuntimeConfig()\n\n    // The strict minimum score to accept\n    const strictMin = Number(config.aiMatcher?.minScore ?? 0.40)\n\n    // The strict margin over the second-best candidate\n    const strictMargin = Number(config.aiMatcher?.margin ?? 0.05)\n\n    if (!candidates.length) {\n      return null\n    }\n\n    const best = candidates[0]\n    if (!best) {\n      return null\n    }\n\n    const second = candidates.length > 1 ? candidates[1] : undefined\n\n    // Must meet minimum confidence score\n    const passesMin = best.score >= strictMin\n\n    // Must be \"significantly\" better than the runner-up\n    const passesMargin = !second || (best.score - second.score >= strictMargin)\n\n    if (!passesMin || !passesMargin) {\n      return null\n    }\n\n    return best\n  }\n}\n\n",[1788],{"type":32,"tag":155,"props":1789,"children":1790},{"__ignoreMap":169},[1791,1817,1832,1840,1856,1867,1874,1889,1900,1907,1922,1929,1937,1945,1953,1974,1991,2023,2051,2059,2066,2073,2081,2089,2096,2117,2137,2176,2183,2191,2225,2233,2241,2249,2256,2268,2280,2287,2294,2302,2339,2347,2359,2366,2373,2407,2414,2426,2460,2496,2504,2511,2523,2536,2544,2551,2558,2570,2577,2584,2591,2600,2609,2617,2629,2646,2663,2671,2689,2710,2731,2759,2768,2781,2821,2854,2897,2905,2927,2935,2943,2952,2961,2974,3013,3021,3067,3108,3116,3124,3146,3154,3162,3174,3182,3190,3198,3207,3216,3224,3241,3258,3266,3283,3304,3332,3358,3366,3375,3415,3423,3432,3471,3479,3500,3512,3520,3528,3558,3579,3591,3599,3607,3666,3674,3683,3715,3723,3732,3788,3796,3830,3842,3850,3858,3871,3879],{"type":32,"tag":175,"props":1792,"children":1793},{"class":177,"line":178},[1794,1798,1803,1808,1812],{"type":32,"tag":175,"props":1795,"children":1796},{"style":182},[1797],{"type":45,"value":185},{"type":32,"tag":175,"props":1799,"children":1800},{"style":182},[1801],{"type":45,"value":1802}," type",{"type":32,"tag":175,"props":1804,"children":1805},{"style":188},[1806],{"type":45,"value":1807}," { Location } ",{"type":32,"tag":175,"props":1809,"children":1810},{"style":182},[1811],{"type":45,"value":214},{"type":32,"tag":175,"props":1813,"children":1814},{"style":217},[1815],{"type":45,"value":1816}," '~~/server/database/types'\n",{"type":32,"tag":175,"props":1818,"children":1819},{"class":177,"line":194},[1820,1824,1828],{"type":32,"tag":175,"props":1821,"children":1822},{"style":182},[1823],{"type":45,"value":185},{"type":32,"tag":175,"props":1825,"children":1826},{"style":182},[1827],{"type":45,"value":1802},{"type":32,"tag":175,"props":1829,"children":1830},{"style":188},[1831],{"type":45,"value":191},{"type":32,"tag":175,"props":1833,"children":1834},{"class":177,"line":203},[1835],{"type":32,"tag":175,"props":1836,"children":1837},{"style":188},[1838],{"type":45,"value":1839},"  AILocationMatcherRepository,\n",{"type":32,"tag":175,"props":1841,"children":1842},{"class":177,"line":223},[1843,1847,1851],{"type":32,"tag":175,"props":1844,"children":1845},{"style":188},[1846],{"type":45,"value":209},{"type":32,"tag":175,"props":1848,"children":1849},{"style":182},[1850],{"type":45,"value":214},{"type":32,"tag":175,"props":1852,"children":1853},{"style":217},[1854],{"type":45,"value":1855}," '~~/server/utils/services/propertySync/repositories/AILocationMatcherRepository'\n",{"type":32,"tag":175,"props":1857,"children":1858},{"class":177,"line":235},[1859,1863],{"type":32,"tag":175,"props":1860,"children":1861},{"style":182},[1862],{"type":45,"value":185},{"type":32,"tag":175,"props":1864,"children":1865},{"style":188},[1866],{"type":45,"value":191},{"type":32,"tag":175,"props":1868,"children":1869},{"class":177,"line":244},[1870],{"type":32,"tag":175,"props":1871,"children":1872},{"style":188},[1873],{"type":45,"value":200},{"type":32,"tag":175,"props":1875,"children":1876},{"class":177,"line":261},[1877,1881,1885],{"type":32,"tag":175,"props":1878,"children":1879},{"style":188},[1880],{"type":45,"value":209},{"type":32,"tag":175,"props":1882,"children":1883},{"style":182},[1884],{"type":45,"value":214},{"type":32,"tag":175,"props":1886,"children":1887},{"style":217},[1888],{"type":45,"value":220},{"type":32,"tag":175,"props":1890,"children":1891},{"class":177,"line":271},[1892,1896],{"type":32,"tag":175,"props":1893,"children":1894},{"style":182},[1895],{"type":45,"value":185},{"type":32,"tag":175,"props":1897,"children":1898},{"style":188},[1899],{"type":45,"value":191},{"type":32,"tag":175,"props":1901,"children":1902},{"class":177,"line":296},[1903],{"type":32,"tag":175,"props":1904,"children":1905},{"style":188},[1906],{"type":45,"value":241},{"type":32,"tag":175,"props":1908,"children":1909},{"class":177,"line":306},[1910,1914,1918],{"type":32,"tag":175,"props":1911,"children":1912},{"style":188},[1913],{"type":45,"value":209},{"type":32,"tag":175,"props":1915,"children":1916},{"style":182},[1917],{"type":45,"value":214},{"type":32,"tag":175,"props":1919,"children":1920},{"style":217},[1921],{"type":45,"value":258},{"type":32,"tag":175,"props":1923,"children":1924},{"class":177,"line":315},[1925],{"type":32,"tag":175,"props":1926,"children":1927},{"emptyLinePlaceholder":265},[1928],{"type":45,"value":268},{"type":32,"tag":175,"props":1930,"children":1931},{"class":177,"line":324},[1932],{"type":32,"tag":175,"props":1933,"children":1934},{"style":300},[1935],{"type":45,"value":1936},"/**\n",{"type":32,"tag":175,"props":1938,"children":1939},{"class":177,"line":343},[1940],{"type":32,"tag":175,"props":1941,"children":1942},{"style":300},[1943],{"type":45,"value":1944}," * Attempts to match raw agent location data with canonical internal Locations.\n",{"type":32,"tag":175,"props":1946,"children":1947},{"class":177,"line":361},[1948],{"type":32,"tag":175,"props":1949,"children":1950},{"style":300},[1951],{"type":45,"value":1952}," */\n",{"type":32,"tag":175,"props":1954,"children":1955},{"class":177,"line":378},[1956,1960,1965,1970],{"type":32,"tag":175,"props":1957,"children":1958},{"style":182},[1959],{"type":45,"value":277},{"type":32,"tag":175,"props":1961,"children":1962},{"style":280},[1963],{"type":45,"value":1964}," class",{"type":32,"tag":175,"props":1966,"children":1967},{"style":286},[1968],{"type":45,"value":1969}," LocationMatcher",{"type":32,"tag":175,"props":1971,"children":1972},{"style":188},[1973],{"type":45,"value":191},{"type":32,"tag":175,"props":1975,"children":1976},{"class":177,"line":387},[1977,1982,1987],{"type":32,"tag":175,"props":1978,"children":1979},{"style":182},[1980],{"type":45,"value":1981},"  public",{"type":32,"tag":175,"props":1983,"children":1984},{"style":280},[1985],{"type":45,"value":1986}," constructor",{"type":32,"tag":175,"props":1988,"children":1989},{"style":188},[1990],{"type":45,"value":399},{"type":32,"tag":175,"props":1992,"children":1993},{"class":177,"line":402},[1994,1999,2004,2009,2013,2018],{"type":32,"tag":175,"props":1995,"children":1996},{"style":182},[1997],{"type":45,"value":1998},"    private",{"type":32,"tag":175,"props":2000,"children":2001},{"style":182},[2002],{"type":45,"value":2003}," readonly",{"type":32,"tag":175,"props":2005,"children":2006},{"style":406},[2007],{"type":45,"value":2008}," canonicalLocations",{"type":32,"tag":175,"props":2010,"children":2011},{"style":182},[2012],{"type":45,"value":68},{"type":32,"tag":175,"props":2014,"children":2015},{"style":286},[2016],{"type":45,"value":2017}," Location",{"type":32,"tag":175,"props":2019,"children":2020},{"style":188},[2021],{"type":45,"value":2022},"[],\n",{"type":32,"tag":175,"props":2024,"children":2025},{"class":177,"line":441},[2026,2030,2034,2039,2043,2047],{"type":32,"tag":175,"props":2027,"children":2028},{"style":182},[2029],{"type":45,"value":1998},{"type":32,"tag":175,"props":2031,"children":2032},{"style":182},[2033],{"type":45,"value":2003},{"type":32,"tag":175,"props":2035,"children":2036},{"style":406},[2037],{"type":45,"value":2038}," aiLocationMatcherRepository",{"type":32,"tag":175,"props":2040,"children":2041},{"style":182},[2042],{"type":45,"value":68},{"type":32,"tag":175,"props":2044,"children":2045},{"style":286},[2046],{"type":45,"value":289},{"type":32,"tag":175,"props":2048,"children":2049},{"style":188},[2050],{"type":45,"value":673},{"type":32,"tag":175,"props":2052,"children":2053},{"class":177,"line":474},[2054],{"type":32,"tag":175,"props":2055,"children":2056},{"style":188},[2057],{"type":45,"value":2058},"  ) {}\n",{"type":32,"tag":175,"props":2060,"children":2061},{"class":177,"line":1039},[2062],{"type":32,"tag":175,"props":2063,"children":2064},{"emptyLinePlaceholder":265},[2065],{"type":45,"value":268},{"type":32,"tag":175,"props":2067,"children":2068},{"class":177,"line":1071},[2069],{"type":32,"tag":175,"props":2070,"children":2071},{"style":300},[2072],{"type":45,"value":303},{"type":32,"tag":175,"props":2074,"children":2075},{"class":177,"line":1079},[2076],{"type":32,"tag":175,"props":2077,"children":2078},{"style":300},[2079],{"type":45,"value":2080},"   * Attempts to match the given agent property location\n",{"type":32,"tag":175,"props":2082,"children":2083},{"class":177,"line":1113},[2084],{"type":32,"tag":175,"props":2085,"children":2086},{"style":300},[2087],{"type":45,"value":2088},"   * with an internal canonical location.\n",{"type":32,"tag":175,"props":2090,"children":2091},{"class":177,"line":1121},[2092],{"type":32,"tag":175,"props":2093,"children":2094},{"style":300},[2095],{"type":45,"value":384},{"type":32,"tag":175,"props":2097,"children":2098},{"class":177,"line":1130},[2099,2103,2108,2113],{"type":32,"tag":175,"props":2100,"children":2101},{"style":182},[2102],{"type":45,"value":1981},{"type":32,"tag":175,"props":2104,"children":2105},{"style":182},[2106],{"type":45,"value":2107}," async",{"type":32,"tag":175,"props":2109,"children":2110},{"style":391},[2111],{"type":45,"value":2112}," match",{"type":32,"tag":175,"props":2114,"children":2115},{"style":188},[2116],{"type":45,"value":399},{"type":32,"tag":175,"props":2118,"children":2119},{"class":177,"line":1170},[2120,2125,2129,2133],{"type":32,"tag":175,"props":2121,"children":2122},{"style":406},[2123],{"type":45,"value":2124},"    agentProperty",{"type":32,"tag":175,"props":2126,"children":2127},{"style":182},[2128],{"type":45,"value":68},{"type":32,"tag":175,"props":2130,"children":2131},{"style":286},[2132],{"type":45,"value":418},{"type":32,"tag":175,"props":2134,"children":2135},{"style":188},[2136],{"type":45,"value":673},{"type":32,"tag":175,"props":2138,"children":2139},{"class":177,"line":1179},[2140,2144,2148,2152,2156,2161,2166,2171],{"type":32,"tag":175,"props":2141,"children":2142},{"style":188},[2143],{"type":45,"value":447},{"type":32,"tag":175,"props":2145,"children":2146},{"style":182},[2147],{"type":45,"value":68},{"type":32,"tag":175,"props":2149,"children":2150},{"style":286},[2151],{"type":45,"value":456},{"type":32,"tag":175,"props":2153,"children":2154},{"style":188},[2155],{"type":45,"value":461},{"type":32,"tag":175,"props":2157,"children":2158},{"style":286},[2159],{"type":45,"value":2160},"Location",{"type":32,"tag":175,"props":2162,"children":2163},{"style":182},[2164],{"type":45,"value":2165}," |",{"type":32,"tag":175,"props":2167,"children":2168},{"style":280},[2169],{"type":45,"value":2170}," null",{"type":32,"tag":175,"props":2172,"children":2173},{"style":188},[2174],{"type":45,"value":2175},"> {\n",{"type":32,"tag":175,"props":2177,"children":2178},{"class":177,"line":1197},[2179],{"type":32,"tag":175,"props":2180,"children":2181},{"emptyLinePlaceholder":265},[2182],{"type":45,"value":268},{"type":32,"tag":175,"props":2184,"children":2185},{"class":177,"line":1206},[2186],{"type":32,"tag":175,"props":2187,"children":2188},{"style":300},[2189],{"type":45,"value":2190},"    // \"easy string\" Tries strict name or postcode resolution first\n",{"type":32,"tag":175,"props":2192,"children":2193},{"class":177,"line":1214},[2194,2198,2203,2207,2211,2215,2220],{"type":32,"tag":175,"props":2195,"children":2196},{"style":280},[2197],{"type":45,"value":1471},{"type":32,"tag":175,"props":2199,"children":2200},{"style":188},[2201],{"type":45,"value":2202}," exactMatch ",{"type":32,"tag":175,"props":2204,"children":2205},{"style":182},[2206],{"type":45,"value":854},{"type":32,"tag":175,"props":2208,"children":2209},{"style":917},[2210],{"type":45,"value":920},{"type":32,"tag":175,"props":2212,"children":2213},{"style":188},[2214],{"type":45,"value":925},{"type":32,"tag":175,"props":2216,"children":2217},{"style":391},[2218],{"type":45,"value":2219},"resolveExact",{"type":32,"tag":175,"props":2221,"children":2222},{"style":188},[2223],{"type":45,"value":2224},"(\n",{"type":32,"tag":175,"props":2226,"children":2227},{"class":177,"line":1223},[2228],{"type":32,"tag":175,"props":2229,"children":2230},{"style":188},[2231],{"type":45,"value":2232},"      agentProperty.location,\n",{"type":32,"tag":175,"props":2234,"children":2235},{"class":177,"line":1267},[2236],{"type":32,"tag":175,"props":2237,"children":2238},{"style":188},[2239],{"type":45,"value":2240},"      agentProperty.postcode,\n",{"type":32,"tag":175,"props":2242,"children":2243},{"class":177,"line":1276},[2244],{"type":32,"tag":175,"props":2245,"children":2246},{"style":188},[2247],{"type":45,"value":2248},"    )\n",{"type":32,"tag":175,"props":2250,"children":2251},{"class":177,"line":1285},[2252],{"type":32,"tag":175,"props":2253,"children":2254},{"emptyLinePlaceholder":265},[2255],{"type":45,"value":268},{"type":32,"tag":175,"props":2257,"children":2258},{"class":177,"line":1294},[2259,2263],{"type":32,"tag":175,"props":2260,"children":2261},{"style":182},[2262],{"type":45,"value":950},{"type":32,"tag":175,"props":2264,"children":2265},{"style":188},[2266],{"type":45,"value":2267}," (exactMatch) {\n",{"type":32,"tag":175,"props":2269,"children":2270},{"class":177,"line":1302},[2271,2275],{"type":32,"tag":175,"props":2272,"children":2273},{"style":182},[2274],{"type":45,"value":1229},{"type":32,"tag":175,"props":2276,"children":2277},{"style":188},[2278],{"type":45,"value":2279}," exactMatch\n",{"type":32,"tag":175,"props":2281,"children":2282},{"class":177,"line":1311},[2283],{"type":32,"tag":175,"props":2284,"children":2285},{"style":188},[2286],{"type":45,"value":1363},{"type":32,"tag":175,"props":2288,"children":2289},{"class":177,"line":1348},[2290],{"type":32,"tag":175,"props":2291,"children":2292},{"emptyLinePlaceholder":265},[2293],{"type":45,"value":268},{"type":32,"tag":175,"props":2295,"children":2296},{"class":177,"line":1357},[2297],{"type":32,"tag":175,"props":2298,"children":2299},{"style":300},[2300],{"type":45,"value":2301},"    // Failing that, we try AI-based matching\n",{"type":32,"tag":175,"props":2303,"children":2304},{"class":177,"line":1366},[2305,2309,2314,2318,2322,2326,2331,2335],{"type":32,"tag":175,"props":2306,"children":2307},{"style":280},[2308],{"type":45,"value":1471},{"type":32,"tag":175,"props":2310,"children":2311},{"style":188},[2312],{"type":45,"value":2313}," aiMatches ",{"type":32,"tag":175,"props":2315,"children":2316},{"style":182},[2317],{"type":45,"value":854},{"type":32,"tag":175,"props":2319,"children":2320},{"style":182},[2321],{"type":45,"value":1018},{"type":32,"tag":175,"props":2323,"children":2324},{"style":917},[2325],{"type":45,"value":920},{"type":32,"tag":175,"props":2327,"children":2328},{"style":188},[2329],{"type":45,"value":2330},".aiLocationMatcherRepository.",{"type":32,"tag":175,"props":2332,"children":2333},{"style":391},[2334],{"type":45,"value":829},{"type":32,"tag":175,"props":2336,"children":2337},{"style":188},[2338],{"type":45,"value":2224},{"type":32,"tag":175,"props":2340,"children":2341},{"class":177,"line":1375},[2342],{"type":32,"tag":175,"props":2343,"children":2344},{"style":188},[2345],{"type":45,"value":2346},"      agentProperty,\n",{"type":32,"tag":175,"props":2348,"children":2349},{"class":177,"line":1384},[2350,2355],{"type":32,"tag":175,"props":2351,"children":2352},{"style":857},[2353],{"type":45,"value":2354},"      5",{"type":32,"tag":175,"props":2356,"children":2357},{"style":188},[2358],{"type":45,"value":673},{"type":32,"tag":175,"props":2360,"children":2361},{"class":177,"line":1393},[2362],{"type":32,"tag":175,"props":2363,"children":2364},{"style":188},[2365],{"type":45,"value":2248},{"type":32,"tag":175,"props":2367,"children":2368},{"class":177,"line":1402},[2369],{"type":32,"tag":175,"props":2370,"children":2371},{"emptyLinePlaceholder":265},[2372],{"type":45,"value":268},{"type":32,"tag":175,"props":2374,"children":2375},{"class":177,"line":1410},[2376,2380,2385,2389,2393,2397,2402],{"type":32,"tag":175,"props":2377,"children":2378},{"style":280},[2379],{"type":45,"value":1471},{"type":32,"tag":175,"props":2381,"children":2382},{"style":188},[2383],{"type":45,"value":2384}," autoLinkTarget ",{"type":32,"tag":175,"props":2386,"children":2387},{"style":182},[2388],{"type":45,"value":854},{"type":32,"tag":175,"props":2390,"children":2391},{"style":917},[2392],{"type":45,"value":920},{"type":32,"tag":175,"props":2394,"children":2395},{"style":188},[2396],{"type":45,"value":925},{"type":32,"tag":175,"props":2398,"children":2399},{"style":391},[2400],{"type":45,"value":2401},"pickAutoLinkTarget",{"type":32,"tag":175,"props":2403,"children":2404},{"style":188},[2405],{"type":45,"value":2406},"(aiMatches)\n",{"type":32,"tag":175,"props":2408,"children":2409},{"class":177,"line":1426},[2410],{"type":32,"tag":175,"props":2411,"children":2412},{"emptyLinePlaceholder":265},[2413],{"type":45,"value":268},{"type":32,"tag":175,"props":2415,"children":2416},{"class":177,"line":1439},[2417,2421],{"type":32,"tag":175,"props":2418,"children":2419},{"style":182},[2420],{"type":45,"value":950},{"type":32,"tag":175,"props":2422,"children":2423},{"style":188},[2424],{"type":45,"value":2425}," (autoLinkTarget) {\n",{"type":32,"tag":175,"props":2427,"children":2428},{"class":177,"line":1447},[2429,2433,2438,2442,2446,2451,2456],{"type":32,"tag":175,"props":2430,"children":2431},{"style":280},[2432],{"type":45,"value":1004},{"type":32,"tag":175,"props":2434,"children":2435},{"style":188},[2436],{"type":45,"value":2437}," matchedLocation ",{"type":32,"tag":175,"props":2439,"children":2440},{"style":182},[2441],{"type":45,"value":854},{"type":32,"tag":175,"props":2443,"children":2444},{"style":917},[2445],{"type":45,"value":920},{"type":32,"tag":175,"props":2447,"children":2448},{"style":188},[2449],{"type":45,"value":2450},".canonicalLocations.",{"type":32,"tag":175,"props":2452,"children":2453},{"style":391},[2454],{"type":45,"value":2455},"find",{"type":32,"tag":175,"props":2457,"children":2458},{"style":188},[2459],{"type":45,"value":2224},{"type":32,"tag":175,"props":2461,"children":2462},{"class":177,"line":1465},[2463,2468,2473,2477,2481,2486,2491],{"type":32,"tag":175,"props":2464,"children":2465},{"style":188},[2466],{"type":45,"value":2467},"        (",{"type":32,"tag":175,"props":2469,"children":2470},{"style":406},[2471],{"type":45,"value":2472},"loc",{"type":32,"tag":175,"props":2474,"children":2475},{"style":188},[2476],{"type":45,"value":1254},{"type":32,"tag":175,"props":2478,"children":2479},{"style":280},[2480],{"type":45,"value":1259},{"type":32,"tag":175,"props":2482,"children":2483},{"style":188},[2484],{"type":45,"value":2485}," loc.id ",{"type":32,"tag":175,"props":2487,"children":2488},{"style":182},[2489],{"type":45,"value":2490},"===",{"type":32,"tag":175,"props":2492,"children":2493},{"style":188},[2494],{"type":45,"value":2495}," autoLinkTarget.id,\n",{"type":32,"tag":175,"props":2497,"children":2498},{"class":177,"line":1501},[2499],{"type":32,"tag":175,"props":2500,"children":2501},{"style":188},[2502],{"type":45,"value":2503},"      )\n",{"type":32,"tag":175,"props":2505,"children":2506},{"class":177,"line":1510},[2507],{"type":32,"tag":175,"props":2508,"children":2509},{"emptyLinePlaceholder":265},[2510],{"type":45,"value":268},{"type":32,"tag":175,"props":2512,"children":2513},{"class":177,"line":1533},[2514,2518],{"type":32,"tag":175,"props":2515,"children":2516},{"style":182},[2517],{"type":45,"value":1085},{"type":32,"tag":175,"props":2519,"children":2520},{"style":188},[2521],{"type":45,"value":2522}," (matchedLocation) {\n",{"type":32,"tag":175,"props":2524,"children":2525},{"class":177,"line":1554},[2526,2531],{"type":32,"tag":175,"props":2527,"children":2528},{"style":182},[2529],{"type":45,"value":2530},"        return",{"type":32,"tag":175,"props":2532,"children":2533},{"style":188},[2534],{"type":45,"value":2535}," matchedLocation\n",{"type":32,"tag":175,"props":2537,"children":2538},{"class":177,"line":1575},[2539],{"type":32,"tag":175,"props":2540,"children":2541},{"style":188},[2542],{"type":45,"value":2543},"      }\n",{"type":32,"tag":175,"props":2545,"children":2546},{"class":177,"line":1584},[2547],{"type":32,"tag":175,"props":2548,"children":2549},{"style":188},[2550],{"type":45,"value":1363},{"type":32,"tag":175,"props":2552,"children":2553},{"class":177,"line":1592},[2554],{"type":32,"tag":175,"props":2555,"children":2556},{"emptyLinePlaceholder":265},[2557],{"type":45,"value":268},{"type":32,"tag":175,"props":2559,"children":2560},{"class":177,"line":1606},[2561,2565],{"type":32,"tag":175,"props":2562,"children":2563},{"style":182},[2564],{"type":45,"value":1598},{"type":32,"tag":175,"props":2566,"children":2567},{"style":857},[2568],{"type":45,"value":2569}," null\n",{"type":32,"tag":175,"props":2571,"children":2572},{"class":177,"line":1671},[2573],{"type":32,"tag":175,"props":2574,"children":2575},{"style":188},[2576],{"type":45,"value":1372},{"type":32,"tag":175,"props":2578,"children":2579},{"class":177,"line":1697},[2580],{"type":32,"tag":175,"props":2581,"children":2582},{"emptyLinePlaceholder":265},[2583],{"type":45,"value":268},{"type":32,"tag":175,"props":2585,"children":2586},{"class":177,"line":1714},[2587],{"type":32,"tag":175,"props":2588,"children":2589},{"style":300},[2590],{"type":45,"value":303},{"type":32,"tag":175,"props":2592,"children":2594},{"class":177,"line":2593},61,[2595],{"type":32,"tag":175,"props":2596,"children":2597},{"style":300},[2598],{"type":45,"value":2599},"   * Tries to find a Location based on exact Name match (case-insensitive)\n",{"type":32,"tag":175,"props":2601,"children":2603},{"class":177,"line":2602},62,[2604],{"type":32,"tag":175,"props":2605,"children":2606},{"style":300},[2607],{"type":45,"value":2608},"   * or Postcode prefix match.\n",{"type":32,"tag":175,"props":2610,"children":2612},{"class":177,"line":2611},63,[2613],{"type":32,"tag":175,"props":2614,"children":2615},{"style":300},[2616],{"type":45,"value":321},{"type":32,"tag":175,"props":2618,"children":2620},{"class":177,"line":2619},64,[2621,2625],{"type":32,"tag":175,"props":2622,"children":2623},{"style":300},[2624],{"type":45,"value":330},{"type":32,"tag":175,"props":2626,"children":2627},{"style":280},[2628],{"type":45,"value":1436},{"type":32,"tag":175,"props":2630,"children":2632},{"class":177,"line":2631},65,[2633,2637,2641],{"type":32,"tag":175,"props":2634,"children":2635},{"style":300},[2636],{"type":45,"value":330},{"type":32,"tag":175,"props":2638,"children":2639},{"style":280},[2640],{"type":45,"value":353},{"type":32,"tag":175,"props":2642,"children":2643},{"style":188},[2644],{"type":45,"value":2645}," locationName\n",{"type":32,"tag":175,"props":2647,"children":2649},{"class":177,"line":2648},66,[2650,2654,2658],{"type":32,"tag":175,"props":2651,"children":2652},{"style":300},[2653],{"type":45,"value":330},{"type":32,"tag":175,"props":2655,"children":2656},{"style":280},[2657],{"type":45,"value":353},{"type":32,"tag":175,"props":2659,"children":2660},{"style":188},[2661],{"type":45,"value":2662}," postcode\n",{"type":32,"tag":175,"props":2664,"children":2666},{"class":177,"line":2665},67,[2667],{"type":32,"tag":175,"props":2668,"children":2669},{"style":300},[2670],{"type":45,"value":384},{"type":32,"tag":175,"props":2672,"children":2674},{"class":177,"line":2673},68,[2675,2680,2685],{"type":32,"tag":175,"props":2676,"children":2677},{"style":182},[2678],{"type":45,"value":2679},"  private",{"type":32,"tag":175,"props":2681,"children":2682},{"style":391},[2683],{"type":45,"value":2684}," resolveExact",{"type":32,"tag":175,"props":2686,"children":2687},{"style":188},[2688],{"type":45,"value":399},{"type":32,"tag":175,"props":2690,"children":2692},{"class":177,"line":2691},69,[2693,2698,2702,2706],{"type":32,"tag":175,"props":2694,"children":2695},{"style":406},[2696],{"type":45,"value":2697},"    locationName",{"type":32,"tag":175,"props":2699,"children":2700},{"style":182},[2701],{"type":45,"value":433},{"type":32,"tag":175,"props":2703,"children":2704},{"style":280},[2705],{"type":45,"value":607},{"type":32,"tag":175,"props":2707,"children":2708},{"style":188},[2709],{"type":45,"value":673},{"type":32,"tag":175,"props":2711,"children":2713},{"class":177,"line":2712},70,[2714,2719,2723,2727],{"type":32,"tag":175,"props":2715,"children":2716},{"style":406},[2717],{"type":45,"value":2718},"    postcode",{"type":32,"tag":175,"props":2720,"children":2721},{"style":182},[2722],{"type":45,"value":433},{"type":32,"tag":175,"props":2724,"children":2725},{"style":280},[2726],{"type":45,"value":607},{"type":32,"tag":175,"props":2728,"children":2729},{"style":188},[2730],{"type":45,"value":673},{"type":32,"tag":175,"props":2732,"children":2734},{"class":177,"line":2733},71,[2735,2739,2743,2747,2751,2755],{"type":32,"tag":175,"props":2736,"children":2737},{"style":188},[2738],{"type":45,"value":447},{"type":32,"tag":175,"props":2740,"children":2741},{"style":182},[2742],{"type":45,"value":68},{"type":32,"tag":175,"props":2744,"children":2745},{"style":286},[2746],{"type":45,"value":2017},{"type":32,"tag":175,"props":2748,"children":2749},{"style":182},[2750],{"type":45,"value":2165},{"type":32,"tag":175,"props":2752,"children":2753},{"style":280},[2754],{"type":45,"value":2170},{"type":32,"tag":175,"props":2756,"children":2757},{"style":188},[2758],{"type":45,"value":191},{"type":32,"tag":175,"props":2760,"children":2762},{"class":177,"line":2761},72,[2763],{"type":32,"tag":175,"props":2764,"children":2765},{"style":300},[2766],{"type":45,"value":2767},"    // Name match first\n",{"type":32,"tag":175,"props":2769,"children":2771},{"class":177,"line":2770},73,[2772,2776],{"type":32,"tag":175,"props":2773,"children":2774},{"style":182},[2775],{"type":45,"value":950},{"type":32,"tag":175,"props":2777,"children":2778},{"style":188},[2779],{"type":45,"value":2780}," (locationName) {\n",{"type":32,"tag":175,"props":2782,"children":2784},{"class":177,"line":2783},74,[2785,2789,2794,2798,2803,2807,2812,2817],{"type":32,"tag":175,"props":2786,"children":2787},{"style":280},[2788],{"type":45,"value":1004},{"type":32,"tag":175,"props":2790,"children":2791},{"style":188},[2792],{"type":45,"value":2793}," cleanName ",{"type":32,"tag":175,"props":2795,"children":2796},{"style":182},[2797],{"type":45,"value":854},{"type":32,"tag":175,"props":2799,"children":2800},{"style":188},[2801],{"type":45,"value":2802}," locationName.",{"type":32,"tag":175,"props":2804,"children":2805},{"style":391},[2806],{"type":45,"value":1650},{"type":32,"tag":175,"props":2808,"children":2809},{"style":188},[2810],{"type":45,"value":2811},"().",{"type":32,"tag":175,"props":2813,"children":2814},{"style":391},[2815],{"type":45,"value":2816},"toLowerCase",{"type":32,"tag":175,"props":2818,"children":2819},{"style":188},[2820],{"type":45,"value":1711},{"type":32,"tag":175,"props":2822,"children":2824},{"class":177,"line":2823},75,[2825,2829,2834,2838,2842,2846,2850],{"type":32,"tag":175,"props":2826,"children":2827},{"style":280},[2828],{"type":45,"value":1004},{"type":32,"tag":175,"props":2830,"children":2831},{"style":188},[2832],{"type":45,"value":2833}," matchedByName ",{"type":32,"tag":175,"props":2835,"children":2836},{"style":182},[2837],{"type":45,"value":854},{"type":32,"tag":175,"props":2839,"children":2840},{"style":917},[2841],{"type":45,"value":920},{"type":32,"tag":175,"props":2843,"children":2844},{"style":188},[2845],{"type":45,"value":2450},{"type":32,"tag":175,"props":2847,"children":2848},{"style":391},[2849],{"type":45,"value":2455},{"type":32,"tag":175,"props":2851,"children":2852},{"style":188},[2853],{"type":45,"value":2224},{"type":32,"tag":175,"props":2855,"children":2857},{"class":177,"line":2856},76,[2858,2862,2866,2870,2874,2879,2883,2888,2892],{"type":32,"tag":175,"props":2859,"children":2860},{"style":188},[2861],{"type":45,"value":2467},{"type":32,"tag":175,"props":2863,"children":2864},{"style":406},[2865],{"type":45,"value":2472},{"type":32,"tag":175,"props":2867,"children":2868},{"style":188},[2869],{"type":45,"value":1254},{"type":32,"tag":175,"props":2871,"children":2872},{"style":280},[2873],{"type":45,"value":1259},{"type":32,"tag":175,"props":2875,"children":2876},{"style":188},[2877],{"type":45,"value":2878}," loc.name.",{"type":32,"tag":175,"props":2880,"children":2881},{"style":391},[2882],{"type":45,"value":2816},{"type":32,"tag":175,"props":2884,"children":2885},{"style":188},[2886],{"type":45,"value":2887},"() ",{"type":32,"tag":175,"props":2889,"children":2890},{"style":182},[2891],{"type":45,"value":2490},{"type":32,"tag":175,"props":2893,"children":2894},{"style":188},[2895],{"type":45,"value":2896}," cleanName,\n",{"type":32,"tag":175,"props":2898,"children":2900},{"class":177,"line":2899},77,[2901],{"type":32,"tag":175,"props":2902,"children":2903},{"style":188},[2904],{"type":45,"value":2503},{"type":32,"tag":175,"props":2906,"children":2908},{"class":177,"line":2907},78,[2909,2913,2918,2922],{"type":32,"tag":175,"props":2910,"children":2911},{"style":182},[2912],{"type":45,"value":1085},{"type":32,"tag":175,"props":2914,"children":2915},{"style":188},[2916],{"type":45,"value":2917}," (matchedByName) ",{"type":32,"tag":175,"props":2919,"children":2920},{"style":182},[2921],{"type":45,"value":1105},{"type":32,"tag":175,"props":2923,"children":2924},{"style":188},[2925],{"type":45,"value":2926}," matchedByName\n",{"type":32,"tag":175,"props":2928,"children":2930},{"class":177,"line":2929},79,[2931],{"type":32,"tag":175,"props":2932,"children":2933},{"style":188},[2934],{"type":45,"value":1363},{"type":32,"tag":175,"props":2936,"children":2938},{"class":177,"line":2937},80,[2939],{"type":32,"tag":175,"props":2940,"children":2941},{"emptyLinePlaceholder":265},[2942],{"type":45,"value":268},{"type":32,"tag":175,"props":2944,"children":2946},{"class":177,"line":2945},81,[2947],{"type":32,"tag":175,"props":2948,"children":2949},{"style":300},[2950],{"type":45,"value":2951},"    // Then postcode prefix match\n",{"type":32,"tag":175,"props":2953,"children":2955},{"class":177,"line":2954},82,[2956],{"type":32,"tag":175,"props":2957,"children":2958},{"style":300},[2959],{"type":45,"value":2960},"    // Agent might provide \"E1 6AN\", we match if our location has \"E1\"\n",{"type":32,"tag":175,"props":2962,"children":2964},{"class":177,"line":2963},83,[2965,2969],{"type":32,"tag":175,"props":2966,"children":2967},{"style":182},[2968],{"type":45,"value":950},{"type":32,"tag":175,"props":2970,"children":2971},{"style":188},[2972],{"type":45,"value":2973}," (postcode) {\n",{"type":32,"tag":175,"props":2975,"children":2977},{"class":177,"line":2976},84,[2978,2982,2987,2991,2996,3000,3004,3009],{"type":32,"tag":175,"props":2979,"children":2980},{"style":280},[2981],{"type":45,"value":1004},{"type":32,"tag":175,"props":2983,"children":2984},{"style":188},[2985],{"type":45,"value":2986}," cleanPostcode ",{"type":32,"tag":175,"props":2988,"children":2989},{"style":182},[2990],{"type":45,"value":854},{"type":32,"tag":175,"props":2992,"children":2993},{"style":188},[2994],{"type":45,"value":2995}," postcode.",{"type":32,"tag":175,"props":2997,"children":2998},{"style":391},[2999],{"type":45,"value":1650},{"type":32,"tag":175,"props":3001,"children":3002},{"style":188},[3003],{"type":45,"value":2811},{"type":32,"tag":175,"props":3005,"children":3006},{"style":391},[3007],{"type":45,"value":3008},"toUpperCase",{"type":32,"tag":175,"props":3010,"children":3011},{"style":188},[3012],{"type":45,"value":1711},{"type":32,"tag":175,"props":3014,"children":3016},{"class":177,"line":3015},85,[3017],{"type":32,"tag":175,"props":3018,"children":3019},{"emptyLinePlaceholder":265},[3020],{"type":45,"value":268},{"type":32,"tag":175,"props":3022,"children":3024},{"class":177,"line":3023},86,[3025,3029,3034,3038,3042,3046,3050,3054,3058,3062],{"type":32,"tag":175,"props":3026,"children":3027},{"style":280},[3028],{"type":45,"value":1004},{"type":32,"tag":175,"props":3030,"children":3031},{"style":188},[3032],{"type":45,"value":3033}," matchedByPostcode ",{"type":32,"tag":175,"props":3035,"children":3036},{"style":182},[3037],{"type":45,"value":854},{"type":32,"tag":175,"props":3039,"children":3040},{"style":917},[3041],{"type":45,"value":920},{"type":32,"tag":175,"props":3043,"children":3044},{"style":188},[3045],{"type":45,"value":2450},{"type":32,"tag":175,"props":3047,"children":3048},{"style":391},[3049],{"type":45,"value":2455},{"type":32,"tag":175,"props":3051,"children":3052},{"style":188},[3053],{"type":45,"value":1244},{"type":32,"tag":175,"props":3055,"children":3056},{"style":406},[3057],{"type":45,"value":2472},{"type":32,"tag":175,"props":3059,"children":3060},{"style":188},[3061],{"type":45,"value":1254},{"type":32,"tag":175,"props":3063,"children":3064},{"style":280},[3065],{"type":45,"value":3066},"=>\n",{"type":32,"tag":175,"props":3068,"children":3070},{"class":177,"line":3069},87,[3071,3076,3081,3085,3089,3093,3098,3103],{"type":32,"tag":175,"props":3072,"children":3073},{"style":188},[3074],{"type":45,"value":3075},"        loc.postcodes.",{"type":32,"tag":175,"props":3077,"children":3078},{"style":391},[3079],{"type":45,"value":3080},"some",{"type":32,"tag":175,"props":3082,"children":3083},{"style":188},[3084],{"type":45,"value":1327},{"type":32,"tag":175,"props":3086,"children":3087},{"style":406},[3088],{"type":45,"value":33},{"type":32,"tag":175,"props":3090,"children":3091},{"style":280},[3092],{"type":45,"value":1630},{"type":32,"tag":175,"props":3094,"children":3095},{"style":188},[3096],{"type":45,"value":3097}," cleanPostcode.",{"type":32,"tag":175,"props":3099,"children":3100},{"style":391},[3101],{"type":45,"value":3102},"startsWith",{"type":32,"tag":175,"props":3104,"children":3105},{"style":188},[3106],{"type":45,"value":3107},"(p)),\n",{"type":32,"tag":175,"props":3109,"children":3111},{"class":177,"line":3110},88,[3112],{"type":32,"tag":175,"props":3113,"children":3114},{"style":188},[3115],{"type":45,"value":2503},{"type":32,"tag":175,"props":3117,"children":3119},{"class":177,"line":3118},89,[3120],{"type":32,"tag":175,"props":3121,"children":3122},{"emptyLinePlaceholder":265},[3123],{"type":45,"value":268},{"type":32,"tag":175,"props":3125,"children":3127},{"class":177,"line":3126},90,[3128,3132,3137,3141],{"type":32,"tag":175,"props":3129,"children":3130},{"style":182},[3131],{"type":45,"value":1085},{"type":32,"tag":175,"props":3133,"children":3134},{"style":188},[3135],{"type":45,"value":3136}," (matchedByPostcode) ",{"type":32,"tag":175,"props":3138,"children":3139},{"style":182},[3140],{"type":45,"value":1105},{"type":32,"tag":175,"props":3142,"children":3143},{"style":188},[3144],{"type":45,"value":3145}," matchedByPostcode\n",{"type":32,"tag":175,"props":3147,"children":3149},{"class":177,"line":3148},91,[3150],{"type":32,"tag":175,"props":3151,"children":3152},{"style":188},[3153],{"type":45,"value":1363},{"type":32,"tag":175,"props":3155,"children":3157},{"class":177,"line":3156},92,[3158],{"type":32,"tag":175,"props":3159,"children":3160},{"emptyLinePlaceholder":265},[3161],{"type":45,"value":268},{"type":32,"tag":175,"props":3163,"children":3165},{"class":177,"line":3164},93,[3166,3170],{"type":32,"tag":175,"props":3167,"children":3168},{"style":182},[3169],{"type":45,"value":1598},{"type":32,"tag":175,"props":3171,"children":3172},{"style":857},[3173],{"type":45,"value":2569},{"type":32,"tag":175,"props":3175,"children":3177},{"class":177,"line":3176},94,[3178],{"type":32,"tag":175,"props":3179,"children":3180},{"style":188},[3181],{"type":45,"value":1372},{"type":32,"tag":175,"props":3183,"children":3185},{"class":177,"line":3184},95,[3186],{"type":32,"tag":175,"props":3187,"children":3188},{"emptyLinePlaceholder":265},[3189],{"type":45,"value":268},{"type":32,"tag":175,"props":3191,"children":3193},{"class":177,"line":3192},96,[3194],{"type":32,"tag":175,"props":3195,"children":3196},{"style":300},[3197],{"type":45,"value":303},{"type":32,"tag":175,"props":3199,"children":3201},{"class":177,"line":3200},97,[3202],{"type":32,"tag":175,"props":3203,"children":3204},{"style":300},[3205],{"type":45,"value":3206},"   * Picks an auto-link target from the given candidates\n",{"type":32,"tag":175,"props":3208,"children":3210},{"class":177,"line":3209},98,[3211],{"type":32,"tag":175,"props":3212,"children":3213},{"style":300},[3214],{"type":45,"value":3215},"   * based on configured thresholds.\n",{"type":32,"tag":175,"props":3217,"children":3219},{"class":177,"line":3218},99,[3220],{"type":32,"tag":175,"props":3221,"children":3222},{"style":300},[3223],{"type":45,"value":321},{"type":32,"tag":175,"props":3225,"children":3227},{"class":177,"line":3226},100,[3228,3232,3236],{"type":32,"tag":175,"props":3229,"children":3230},{"style":300},[3231],{"type":45,"value":330},{"type":32,"tag":175,"props":3233,"children":3234},{"style":280},[3235],{"type":45,"value":353},{"type":32,"tag":175,"props":3237,"children":3238},{"style":188},[3239],{"type":45,"value":3240}," candidates\n",{"type":32,"tag":175,"props":3242,"children":3244},{"class":177,"line":3243},101,[3245,3249,3253],{"type":32,"tag":175,"props":3246,"children":3247},{"style":300},[3248],{"type":45,"value":330},{"type":32,"tag":175,"props":3250,"children":3251},{"style":280},[3252],{"type":45,"value":335},{"type":32,"tag":175,"props":3254,"children":3255},{"style":300},[3256],{"type":45,"value":3257}," The picked AI match or null if no suitable match is found.\n",{"type":32,"tag":175,"props":3259,"children":3261},{"class":177,"line":3260},102,[3262],{"type":32,"tag":175,"props":3263,"children":3264},{"style":300},[3265],{"type":45,"value":384},{"type":32,"tag":175,"props":3267,"children":3269},{"class":177,"line":3268},103,[3270,3274,3279],{"type":32,"tag":175,"props":3271,"children":3272},{"style":182},[3273],{"type":45,"value":1981},{"type":32,"tag":175,"props":3275,"children":3276},{"style":391},[3277],{"type":45,"value":3278}," pickAutoLinkTarget",{"type":32,"tag":175,"props":3280,"children":3281},{"style":188},[3282],{"type":45,"value":399},{"type":32,"tag":175,"props":3284,"children":3286},{"class":177,"line":3285},104,[3287,3292,3296,3300],{"type":32,"tag":175,"props":3288,"children":3289},{"style":406},[3290],{"type":45,"value":3291},"    candidates",{"type":32,"tag":175,"props":3293,"children":3294},{"style":182},[3295],{"type":45,"value":68},{"type":32,"tag":175,"props":3297,"children":3298},{"style":286},[3299],{"type":45,"value":515},{"type":32,"tag":175,"props":3301,"children":3302},{"style":188},[3303],{"type":45,"value":2022},{"type":32,"tag":175,"props":3305,"children":3307},{"class":177,"line":3306},105,[3308,3312,3316,3320,3324,3328],{"type":32,"tag":175,"props":3309,"children":3310},{"style":188},[3311],{"type":45,"value":447},{"type":32,"tag":175,"props":3313,"children":3314},{"style":182},[3315],{"type":45,"value":68},{"type":32,"tag":175,"props":3317,"children":3318},{"style":286},[3319],{"type":45,"value":515},{"type":32,"tag":175,"props":3321,"children":3322},{"style":182},[3323],{"type":45,"value":2165},{"type":32,"tag":175,"props":3325,"children":3326},{"style":280},[3327],{"type":45,"value":2170},{"type":32,"tag":175,"props":3329,"children":3330},{"style":188},[3331],{"type":45,"value":191},{"type":32,"tag":175,"props":3333,"children":3335},{"class":177,"line":3334},106,[3336,3340,3345,3349,3354],{"type":32,"tag":175,"props":3337,"children":3338},{"style":280},[3339],{"type":45,"value":1471},{"type":32,"tag":175,"props":3341,"children":3342},{"style":188},[3343],{"type":45,"value":3344}," config ",{"type":32,"tag":175,"props":3346,"children":3347},{"style":182},[3348],{"type":45,"value":854},{"type":32,"tag":175,"props":3350,"children":3351},{"style":391},[3352],{"type":45,"value":3353}," useRuntimeConfig",{"type":32,"tag":175,"props":3355,"children":3356},{"style":188},[3357],{"type":45,"value":1711},{"type":32,"tag":175,"props":3359,"children":3361},{"class":177,"line":3360},107,[3362],{"type":32,"tag":175,"props":3363,"children":3364},{"emptyLinePlaceholder":265},[3365],{"type":45,"value":268},{"type":32,"tag":175,"props":3367,"children":3369},{"class":177,"line":3368},108,[3370],{"type":32,"tag":175,"props":3371,"children":3372},{"style":300},[3373],{"type":45,"value":3374},"    // The strict minimum score to accept\n",{"type":32,"tag":175,"props":3376,"children":3378},{"class":177,"line":3377},109,[3379,3383,3388,3392,3397,3402,3406,3411],{"type":32,"tag":175,"props":3380,"children":3381},{"style":280},[3382],{"type":45,"value":1471},{"type":32,"tag":175,"props":3384,"children":3385},{"style":188},[3386],{"type":45,"value":3387}," strictMin ",{"type":32,"tag":175,"props":3389,"children":3390},{"style":182},[3391],{"type":45,"value":854},{"type":32,"tag":175,"props":3393,"children":3394},{"style":391},[3395],{"type":45,"value":3396}," Number",{"type":32,"tag":175,"props":3398,"children":3399},{"style":188},[3400],{"type":45,"value":3401},"(config.aiMatcher?.minScore ",{"type":32,"tag":175,"props":3403,"children":3404},{"style":182},[3405],{"type":45,"value":1521},{"type":32,"tag":175,"props":3407,"children":3408},{"style":857},[3409],{"type":45,"value":3410}," 0.40",{"type":32,"tag":175,"props":3412,"children":3413},{"style":188},[3414],{"type":45,"value":1345},{"type":32,"tag":175,"props":3416,"children":3418},{"class":177,"line":3417},110,[3419],{"type":32,"tag":175,"props":3420,"children":3421},{"emptyLinePlaceholder":265},[3422],{"type":45,"value":268},{"type":32,"tag":175,"props":3424,"children":3426},{"class":177,"line":3425},111,[3427],{"type":32,"tag":175,"props":3428,"children":3429},{"style":300},[3430],{"type":45,"value":3431},"    // The strict margin over the second-best candidate\n",{"type":32,"tag":175,"props":3433,"children":3435},{"class":177,"line":3434},112,[3436,3440,3445,3449,3453,3458,3462,3467],{"type":32,"tag":175,"props":3437,"children":3438},{"style":280},[3439],{"type":45,"value":1471},{"type":32,"tag":175,"props":3441,"children":3442},{"style":188},[3443],{"type":45,"value":3444}," strictMargin ",{"type":32,"tag":175,"props":3446,"children":3447},{"style":182},[3448],{"type":45,"value":854},{"type":32,"tag":175,"props":3450,"children":3451},{"style":391},[3452],{"type":45,"value":3396},{"type":32,"tag":175,"props":3454,"children":3455},{"style":188},[3456],{"type":45,"value":3457},"(config.aiMatcher?.margin ",{"type":32,"tag":175,"props":3459,"children":3460},{"style":182},[3461],{"type":45,"value":1521},{"type":32,"tag":175,"props":3463,"children":3464},{"style":857},[3465],{"type":45,"value":3466}," 0.05",{"type":32,"tag":175,"props":3468,"children":3469},{"style":188},[3470],{"type":45,"value":1345},{"type":32,"tag":175,"props":3472,"children":3474},{"class":177,"line":3473},113,[3475],{"type":32,"tag":175,"props":3476,"children":3477},{"emptyLinePlaceholder":265},[3478],{"type":45,"value":268},{"type":32,"tag":175,"props":3480,"children":3482},{"class":177,"line":3481},114,[3483,3487,3491,3495],{"type":32,"tag":175,"props":3484,"children":3485},{"style":182},[3486],{"type":45,"value":950},{"type":32,"tag":175,"props":3488,"children":3489},{"style":188},[3490],{"type":45,"value":1090},{"type":32,"tag":175,"props":3492,"children":3493},{"style":182},[3494],{"type":45,"value":1095},{"type":32,"tag":175,"props":3496,"children":3497},{"style":188},[3498],{"type":45,"value":3499},"candidates.length) {\n",{"type":32,"tag":175,"props":3501,"children":3503},{"class":177,"line":3502},115,[3504,3508],{"type":32,"tag":175,"props":3505,"children":3506},{"style":182},[3507],{"type":45,"value":1229},{"type":32,"tag":175,"props":3509,"children":3510},{"style":857},[3511],{"type":45,"value":2569},{"type":32,"tag":175,"props":3513,"children":3515},{"class":177,"line":3514},116,[3516],{"type":32,"tag":175,"props":3517,"children":3518},{"style":188},[3519],{"type":45,"value":1363},{"type":32,"tag":175,"props":3521,"children":3523},{"class":177,"line":3522},117,[3524],{"type":32,"tag":175,"props":3525,"children":3526},{"emptyLinePlaceholder":265},[3527],{"type":45,"value":268},{"type":32,"tag":175,"props":3529,"children":3531},{"class":177,"line":3530},118,[3532,3536,3541,3545,3550,3554],{"type":32,"tag":175,"props":3533,"children":3534},{"style":280},[3535],{"type":45,"value":1471},{"type":32,"tag":175,"props":3537,"children":3538},{"style":188},[3539],{"type":45,"value":3540}," best ",{"type":32,"tag":175,"props":3542,"children":3543},{"style":182},[3544],{"type":45,"value":854},{"type":32,"tag":175,"props":3546,"children":3547},{"style":188},[3548],{"type":45,"value":3549}," candidates[",{"type":32,"tag":175,"props":3551,"children":3552},{"style":857},[3553],{"type":45,"value":1063},{"type":32,"tag":175,"props":3555,"children":3556},{"style":188},[3557],{"type":45,"value":1068},{"type":32,"tag":175,"props":3559,"children":3561},{"class":177,"line":3560},119,[3562,3566,3570,3574],{"type":32,"tag":175,"props":3563,"children":3564},{"style":182},[3565],{"type":45,"value":950},{"type":32,"tag":175,"props":3567,"children":3568},{"style":188},[3569],{"type":45,"value":1090},{"type":32,"tag":175,"props":3571,"children":3572},{"style":182},[3573],{"type":45,"value":1095},{"type":32,"tag":175,"props":3575,"children":3576},{"style":188},[3577],{"type":45,"value":3578},"best) {\n",{"type":32,"tag":175,"props":3580,"children":3582},{"class":177,"line":3581},120,[3583,3587],{"type":32,"tag":175,"props":3584,"children":3585},{"style":182},[3586],{"type":45,"value":1229},{"type":32,"tag":175,"props":3588,"children":3589},{"style":857},[3590],{"type":45,"value":2569},{"type":32,"tag":175,"props":3592,"children":3594},{"class":177,"line":3593},121,[3595],{"type":32,"tag":175,"props":3596,"children":3597},{"style":188},[3598],{"type":45,"value":1363},{"type":32,"tag":175,"props":3600,"children":3602},{"class":177,"line":3601},122,[3603],{"type":32,"tag":175,"props":3604,"children":3605},{"emptyLinePlaceholder":265},[3606],{"type":45,"value":268},{"type":32,"tag":175,"props":3608,"children":3610},{"class":177,"line":3609},123,[3611,3615,3620,3624,3629,3633,3638,3643,3647,3652,3657,3661],{"type":32,"tag":175,"props":3612,"children":3613},{"style":280},[3614],{"type":45,"value":1471},{"type":32,"tag":175,"props":3616,"children":3617},{"style":188},[3618],{"type":45,"value":3619}," second ",{"type":32,"tag":175,"props":3621,"children":3622},{"style":182},[3623],{"type":45,"value":854},{"type":32,"tag":175,"props":3625,"children":3626},{"style":188},[3627],{"type":45,"value":3628}," candidates.length ",{"type":32,"tag":175,"props":3630,"children":3631},{"style":182},[3632],{"type":45,"value":891},{"type":32,"tag":175,"props":3634,"children":3635},{"style":857},[3636],{"type":45,"value":3637}," 1",{"type":32,"tag":175,"props":3639,"children":3640},{"style":182},[3641],{"type":45,"value":3642}," ?",{"type":32,"tag":175,"props":3644,"children":3645},{"style":188},[3646],{"type":45,"value":3549},{"type":32,"tag":175,"props":3648,"children":3649},{"style":857},[3650],{"type":45,"value":3651},"1",{"type":32,"tag":175,"props":3653,"children":3654},{"style":188},[3655],{"type":45,"value":3656},"] ",{"type":32,"tag":175,"props":3658,"children":3659},{"style":182},[3660],{"type":45,"value":68},{"type":32,"tag":175,"props":3662,"children":3663},{"style":857},[3664],{"type":45,"value":3665}," undefined\n",{"type":32,"tag":175,"props":3667,"children":3669},{"class":177,"line":3668},124,[3670],{"type":32,"tag":175,"props":3671,"children":3672},{"emptyLinePlaceholder":265},[3673],{"type":45,"value":268},{"type":32,"tag":175,"props":3675,"children":3677},{"class":177,"line":3676},125,[3678],{"type":32,"tag":175,"props":3679,"children":3680},{"style":300},[3681],{"type":45,"value":3682},"    // Must meet minimum confidence score\n",{"type":32,"tag":175,"props":3684,"children":3686},{"class":177,"line":3685},126,[3687,3691,3696,3700,3705,3710],{"type":32,"tag":175,"props":3688,"children":3689},{"style":280},[3690],{"type":45,"value":1471},{"type":32,"tag":175,"props":3692,"children":3693},{"style":188},[3694],{"type":45,"value":3695}," passesMin ",{"type":32,"tag":175,"props":3697,"children":3698},{"style":182},[3699],{"type":45,"value":854},{"type":32,"tag":175,"props":3701,"children":3702},{"style":188},[3703],{"type":45,"value":3704}," best.score ",{"type":32,"tag":175,"props":3706,"children":3707},{"style":182},[3708],{"type":45,"value":3709},">=",{"type":32,"tag":175,"props":3711,"children":3712},{"style":188},[3713],{"type":45,"value":3714}," strictMin\n",{"type":32,"tag":175,"props":3716,"children":3718},{"class":177,"line":3717},127,[3719],{"type":32,"tag":175,"props":3720,"children":3721},{"emptyLinePlaceholder":265},[3722],{"type":45,"value":268},{"type":32,"tag":175,"props":3724,"children":3726},{"class":177,"line":3725},128,[3727],{"type":32,"tag":175,"props":3728,"children":3729},{"style":300},[3730],{"type":45,"value":3731},"    // Must be \"significantly\" better than the runner-up\n",{"type":32,"tag":175,"props":3733,"children":3735},{"class":177,"line":3734},129,[3736,3740,3745,3749,3754,3759,3764,3769,3774,3779,3783],{"type":32,"tag":175,"props":3737,"children":3738},{"style":280},[3739],{"type":45,"value":1471},{"type":32,"tag":175,"props":3741,"children":3742},{"style":188},[3743],{"type":45,"value":3744}," passesMargin ",{"type":32,"tag":175,"props":3746,"children":3747},{"style":182},[3748],{"type":45,"value":854},{"type":32,"tag":175,"props":3750,"children":3751},{"style":182},[3752],{"type":45,"value":3753}," !",{"type":32,"tag":175,"props":3755,"children":3756},{"style":188},[3757],{"type":45,"value":3758},"second ",{"type":32,"tag":175,"props":3760,"children":3761},{"style":182},[3762],{"type":45,"value":3763},"||",{"type":32,"tag":175,"props":3765,"children":3766},{"style":188},[3767],{"type":45,"value":3768}," (best.score ",{"type":32,"tag":175,"props":3770,"children":3771},{"style":182},[3772],{"type":45,"value":3773},"-",{"type":32,"tag":175,"props":3775,"children":3776},{"style":188},[3777],{"type":45,"value":3778}," second.score ",{"type":32,"tag":175,"props":3780,"children":3781},{"style":182},[3782],{"type":45,"value":3709},{"type":32,"tag":175,"props":3784,"children":3785},{"style":188},[3786],{"type":45,"value":3787}," strictMargin)\n",{"type":32,"tag":175,"props":3789,"children":3791},{"class":177,"line":3790},130,[3792],{"type":32,"tag":175,"props":3793,"children":3794},{"emptyLinePlaceholder":265},[3795],{"type":45,"value":268},{"type":32,"tag":175,"props":3797,"children":3799},{"class":177,"line":3798},131,[3800,3804,3808,3812,3817,3821,3825],{"type":32,"tag":175,"props":3801,"children":3802},{"style":182},[3803],{"type":45,"value":950},{"type":32,"tag":175,"props":3805,"children":3806},{"style":188},[3807],{"type":45,"value":1090},{"type":32,"tag":175,"props":3809,"children":3810},{"style":182},[3811],{"type":45,"value":1095},{"type":32,"tag":175,"props":3813,"children":3814},{"style":188},[3815],{"type":45,"value":3816},"passesMin ",{"type":32,"tag":175,"props":3818,"children":3819},{"style":182},[3820],{"type":45,"value":3763},{"type":32,"tag":175,"props":3822,"children":3823},{"style":182},[3824],{"type":45,"value":3753},{"type":32,"tag":175,"props":3826,"children":3827},{"style":188},[3828],{"type":45,"value":3829},"passesMargin) {\n",{"type":32,"tag":175,"props":3831,"children":3833},{"class":177,"line":3832},132,[3834,3838],{"type":32,"tag":175,"props":3835,"children":3836},{"style":182},[3837],{"type":45,"value":1229},{"type":32,"tag":175,"props":3839,"children":3840},{"style":857},[3841],{"type":45,"value":2569},{"type":32,"tag":175,"props":3843,"children":3845},{"class":177,"line":3844},133,[3846],{"type":32,"tag":175,"props":3847,"children":3848},{"style":188},[3849],{"type":45,"value":1363},{"type":32,"tag":175,"props":3851,"children":3853},{"class":177,"line":3852},134,[3854],{"type":32,"tag":175,"props":3855,"children":3856},{"emptyLinePlaceholder":265},[3857],{"type":45,"value":268},{"type":32,"tag":175,"props":3859,"children":3861},{"class":177,"line":3860},135,[3862,3866],{"type":32,"tag":175,"props":3863,"children":3864},{"style":182},[3865],{"type":45,"value":1598},{"type":32,"tag":175,"props":3867,"children":3868},{"style":188},[3869],{"type":45,"value":3870}," best\n",{"type":32,"tag":175,"props":3872,"children":3874},{"class":177,"line":3873},136,[3875],{"type":32,"tag":175,"props":3876,"children":3877},{"style":188},[3878],{"type":45,"value":1372},{"type":32,"tag":175,"props":3880,"children":3882},{"class":177,"line":3881},137,[3883],{"type":32,"tag":175,"props":3884,"children":3885},{"style":188},[3886],{"type":45,"value":480},{"type":32,"tag":33,"props":3888,"children":3889},{},[3890,3892,3897],{"type":45,"value":3891},"The helper depends on a list of canonical locations, i.e. our internal locations and the location matcher repository. The match method attempts to resolve the agent’s property location using simple text match against our locations. Failing the deterministic approach, it calls the ",{"type":32,"tag":155,"props":3893,"children":3895},{"className":3894},[],[3896],{"type":45,"value":711},{"type":45,"value":3898}," on the repository and applies minimum-similarity-score and margin-threshold rules before returning a single qualifying semantic match.",{"type":32,"tag":33,"props":3900,"children":3901},{},[3902],{"type":45,"value":3903},"When working with semantic matching, you'll find that the definition of a good match isn't static. As your vector store grows in density, the margin between a correct match and a close-but-wrong alternative often shrinks. Hence, I highly recommend using config variables rather than hard-coded values. Making the minimum score and next-match margin configurable lets you easily adjust your minimum similarity scores and safety margins as your real-world data evolves.",{"type":32,"tag":3905,"props":3906,"children":3907},"newsletter-form",{},[],{"type":32,"tag":143,"props":3909,"children":3911},{"id":3910},"semantic-matching-process-with-nuxt",[3912],{"type":45,"value":3913},"Semantic matching process with Nuxt",{"type":32,"tag":33,"props":3915,"children":3916},{},[3917],{"type":45,"value":3918},"With the repository implemented and the location matcher helper in place, we can finally build our service class to glue the per-agent property sync process together.",{"type":32,"tag":33,"props":3920,"children":3921},{},[3922,3924,3931,3933,3939],{"type":45,"value":3923},"First, we need to mimic the agents’ feeds. To do this, we’ll create a dummy API endpoint and a few dummy JSON files representing agents’ listings. Go ahead and copy the ",{"type":32,"tag":48,"props":3925,"children":3928},{"href":3926,"rel":3927,"target":124},"https://github.com/keithmifsud/nuxt-data-sync-pipeline-with-cloudflare-cron-queues-and-ai-vectorize-demo/tree/main/server/assets/agents",[123],[3929],{"type":45,"value":3930},"three JSON files",{"type":45,"value":3932}," to ",{"type":32,"tag":155,"props":3934,"children":3936},{"className":3935},[],[3937],{"type":45,"value":3938},"/server/assets/agents/",{"type":45,"value":925},{"type":32,"tag":33,"props":3941,"children":3942},{},[3943,3945,3951],{"type":45,"value":3944},"You'll notice that the ",{"type":32,"tag":155,"props":3946,"children":3948},{"className":3947},[],[3949],{"type":45,"value":3950},"marketer.json",{"type":45,"value":3952}," file contains some intentionally messy location data to simulate real-world scenarios. Our semantic matching logic will help us correctly associate these properties with our internal locations. Eventually, the service will successfully match all three agents' property locations and add the properties to our database.",{"type":32,"tag":33,"props":3954,"children":3955},{},[3956,3958,3964],{"type":45,"value":3957},"Now create ",{"type":32,"tag":155,"props":3959,"children":3961},{"className":3960},[],[3962],{"type":45,"value":3963},"/server/api/agents/[agent].get.ts",{"type":45,"value":3965}," endpoint with:",{"type":32,"tag":164,"props":3967,"children":3969},{"className":166,"code":3968,"language":168,"meta":169,"style":169},"import formalist from '~~/server/assets/agents/formalist.json'\nimport traditionalist from '~~/server/assets/agents/traditionalist.json'\nimport marketer from '~~/server/assets/agents/marketer.json'\n\nexport default defineEventHandler(async (event) => {\n\n  const agentSlug = getRouterParam(event, 'agent')\n\n  if (!agentSlug) {\n    throw createError({ statusCode: 400, message: 'Agent slug required' })\n  }\n\n  // Map slugs to data sources\n  const feeds: Record\u003Cstring, any[]> = {\n    'formalist': formalist,\n    'traditionalist': traditionalist,\n    'marketer': marketer\n  }\n\n  const data = feeds[agentSlug]\n\n  // Handle 404s (mimic a real API)\n  if (!data) {\n    throw createError({ statusCode: 404, message: `Agent feed '${agentSlug}' not found` })\n  }\n\n  return data\n})\n\n",[3970],{"type":32,"tag":155,"props":3971,"children":3972},{"__ignoreMap":169},[3973,3994,4015,4036,4043,4090,4097,4133,4140,4161,4199,4206,4213,4221,4273,4286,4299,4312,4319,4326,4347,4354,4362,4382,4435,4442,4449,4462],{"type":32,"tag":175,"props":3974,"children":3975},{"class":177,"line":178},[3976,3980,3985,3989],{"type":32,"tag":175,"props":3977,"children":3978},{"style":182},[3979],{"type":45,"value":185},{"type":32,"tag":175,"props":3981,"children":3982},{"style":188},[3983],{"type":45,"value":3984}," formalist ",{"type":32,"tag":175,"props":3986,"children":3987},{"style":182},[3988],{"type":45,"value":214},{"type":32,"tag":175,"props":3990,"children":3991},{"style":217},[3992],{"type":45,"value":3993}," '~~/server/assets/agents/formalist.json'\n",{"type":32,"tag":175,"props":3995,"children":3996},{"class":177,"line":194},[3997,4001,4006,4010],{"type":32,"tag":175,"props":3998,"children":3999},{"style":182},[4000],{"type":45,"value":185},{"type":32,"tag":175,"props":4002,"children":4003},{"style":188},[4004],{"type":45,"value":4005}," traditionalist ",{"type":32,"tag":175,"props":4007,"children":4008},{"style":182},[4009],{"type":45,"value":214},{"type":32,"tag":175,"props":4011,"children":4012},{"style":217},[4013],{"type":45,"value":4014}," '~~/server/assets/agents/traditionalist.json'\n",{"type":32,"tag":175,"props":4016,"children":4017},{"class":177,"line":203},[4018,4022,4027,4031],{"type":32,"tag":175,"props":4019,"children":4020},{"style":182},[4021],{"type":45,"value":185},{"type":32,"tag":175,"props":4023,"children":4024},{"style":188},[4025],{"type":45,"value":4026}," marketer ",{"type":32,"tag":175,"props":4028,"children":4029},{"style":182},[4030],{"type":45,"value":214},{"type":32,"tag":175,"props":4032,"children":4033},{"style":217},[4034],{"type":45,"value":4035}," '~~/server/assets/agents/marketer.json'\n",{"type":32,"tag":175,"props":4037,"children":4038},{"class":177,"line":223},[4039],{"type":32,"tag":175,"props":4040,"children":4041},{"emptyLinePlaceholder":265},[4042],{"type":45,"value":268},{"type":32,"tag":175,"props":4044,"children":4045},{"class":177,"line":235},[4046,4050,4055,4060,4064,4069,4073,4078,4082,4086],{"type":32,"tag":175,"props":4047,"children":4048},{"style":182},[4049],{"type":45,"value":277},{"type":32,"tag":175,"props":4051,"children":4052},{"style":182},[4053],{"type":45,"value":4054}," default",{"type":32,"tag":175,"props":4056,"children":4057},{"style":391},[4058],{"type":45,"value":4059}," defineEventHandler",{"type":32,"tag":175,"props":4061,"children":4062},{"style":188},[4063],{"type":45,"value":1327},{"type":32,"tag":175,"props":4065,"children":4066},{"style":182},[4067],{"type":45,"value":4068},"async",{"type":32,"tag":175,"props":4070,"children":4071},{"style":188},[4072],{"type":45,"value":1090},{"type":32,"tag":175,"props":4074,"children":4075},{"style":406},[4076],{"type":45,"value":4077},"event",{"type":32,"tag":175,"props":4079,"children":4080},{"style":188},[4081],{"type":45,"value":1254},{"type":32,"tag":175,"props":4083,"children":4084},{"style":280},[4085],{"type":45,"value":1259},{"type":32,"tag":175,"props":4087,"children":4088},{"style":188},[4089],{"type":45,"value":191},{"type":32,"tag":175,"props":4091,"children":4092},{"class":177,"line":244},[4093],{"type":32,"tag":175,"props":4094,"children":4095},{"emptyLinePlaceholder":265},[4096],{"type":45,"value":268},{"type":32,"tag":175,"props":4098,"children":4099},{"class":177,"line":261},[4100,4105,4110,4114,4119,4124,4129],{"type":32,"tag":175,"props":4101,"children":4102},{"style":280},[4103],{"type":45,"value":4104},"  const",{"type":32,"tag":175,"props":4106,"children":4107},{"style":188},[4108],{"type":45,"value":4109}," agentSlug ",{"type":32,"tag":175,"props":4111,"children":4112},{"style":182},[4113],{"type":45,"value":854},{"type":32,"tag":175,"props":4115,"children":4116},{"style":391},[4117],{"type":45,"value":4118}," getRouterParam",{"type":32,"tag":175,"props":4120,"children":4121},{"style":188},[4122],{"type":45,"value":4123},"(event, ",{"type":32,"tag":175,"props":4125,"children":4126},{"style":217},[4127],{"type":45,"value":4128},"'agent'",{"type":32,"tag":175,"props":4130,"children":4131},{"style":188},[4132],{"type":45,"value":1345},{"type":32,"tag":175,"props":4134,"children":4135},{"class":177,"line":271},[4136],{"type":32,"tag":175,"props":4137,"children":4138},{"emptyLinePlaceholder":265},[4139],{"type":45,"value":268},{"type":32,"tag":175,"props":4141,"children":4142},{"class":177,"line":296},[4143,4148,4152,4156],{"type":32,"tag":175,"props":4144,"children":4145},{"style":182},[4146],{"type":45,"value":4147},"  if",{"type":32,"tag":175,"props":4149,"children":4150},{"style":188},[4151],{"type":45,"value":1090},{"type":32,"tag":175,"props":4153,"children":4154},{"style":182},[4155],{"type":45,"value":1095},{"type":32,"tag":175,"props":4157,"children":4158},{"style":188},[4159],{"type":45,"value":4160},"agentSlug) {\n",{"type":32,"tag":175,"props":4162,"children":4163},{"class":177,"line":306},[4164,4169,4174,4179,4184,4189,4194],{"type":32,"tag":175,"props":4165,"children":4166},{"style":182},[4167],{"type":45,"value":4168},"    throw",{"type":32,"tag":175,"props":4170,"children":4171},{"style":391},[4172],{"type":45,"value":4173}," createError",{"type":32,"tag":175,"props":4175,"children":4176},{"style":188},[4177],{"type":45,"value":4178},"({ statusCode: ",{"type":32,"tag":175,"props":4180,"children":4181},{"style":857},[4182],{"type":45,"value":4183},"400",{"type":32,"tag":175,"props":4185,"children":4186},{"style":188},[4187],{"type":45,"value":4188},", message: ",{"type":32,"tag":175,"props":4190,"children":4191},{"style":217},[4192],{"type":45,"value":4193},"'Agent slug required'",{"type":32,"tag":175,"props":4195,"children":4196},{"style":188},[4197],{"type":45,"value":4198}," })\n",{"type":32,"tag":175,"props":4200,"children":4201},{"class":177,"line":315},[4202],{"type":32,"tag":175,"props":4203,"children":4204},{"style":188},[4205],{"type":45,"value":1372},{"type":32,"tag":175,"props":4207,"children":4208},{"class":177,"line":324},[4209],{"type":32,"tag":175,"props":4210,"children":4211},{"emptyLinePlaceholder":265},[4212],{"type":45,"value":268},{"type":32,"tag":175,"props":4214,"children":4215},{"class":177,"line":343},[4216],{"type":32,"tag":175,"props":4217,"children":4218},{"style":300},[4219],{"type":45,"value":4220},"  // Map slugs to data sources\n",{"type":32,"tag":175,"props":4222,"children":4223},{"class":177,"line":361},[4224,4228,4233,4237,4242,4246,4251,4255,4260,4265,4269],{"type":32,"tag":175,"props":4225,"children":4226},{"style":280},[4227],{"type":45,"value":4104},{"type":32,"tag":175,"props":4229,"children":4230},{"style":188},[4231],{"type":45,"value":4232}," feeds",{"type":32,"tag":175,"props":4234,"children":4235},{"style":182},[4236],{"type":45,"value":68},{"type":32,"tag":175,"props":4238,"children":4239},{"style":286},[4240],{"type":45,"value":4241}," Record",{"type":32,"tag":175,"props":4243,"children":4244},{"style":188},[4245],{"type":45,"value":461},{"type":32,"tag":175,"props":4247,"children":4248},{"style":280},[4249],{"type":45,"value":4250},"string",{"type":32,"tag":175,"props":4252,"children":4253},{"style":188},[4254],{"type":45,"value":423},{"type":32,"tag":175,"props":4256,"children":4257},{"style":280},[4258],{"type":45,"value":4259},"any",{"type":32,"tag":175,"props":4261,"children":4262},{"style":188},[4263],{"type":45,"value":4264},"[]> ",{"type":32,"tag":175,"props":4266,"children":4267},{"style":182},[4268],{"type":45,"value":854},{"type":32,"tag":175,"props":4270,"children":4271},{"style":188},[4272],{"type":45,"value":191},{"type":32,"tag":175,"props":4274,"children":4275},{"class":177,"line":378},[4276,4281],{"type":32,"tag":175,"props":4277,"children":4278},{"style":217},[4279],{"type":45,"value":4280},"    'formalist'",{"type":32,"tag":175,"props":4282,"children":4283},{"style":188},[4284],{"type":45,"value":4285},": formalist,\n",{"type":32,"tag":175,"props":4287,"children":4288},{"class":177,"line":387},[4289,4294],{"type":32,"tag":175,"props":4290,"children":4291},{"style":217},[4292],{"type":45,"value":4293},"    'traditionalist'",{"type":32,"tag":175,"props":4295,"children":4296},{"style":188},[4297],{"type":45,"value":4298},": traditionalist,\n",{"type":32,"tag":175,"props":4300,"children":4301},{"class":177,"line":402},[4302,4307],{"type":32,"tag":175,"props":4303,"children":4304},{"style":217},[4305],{"type":45,"value":4306},"    'marketer'",{"type":32,"tag":175,"props":4308,"children":4309},{"style":188},[4310],{"type":45,"value":4311},": marketer\n",{"type":32,"tag":175,"props":4313,"children":4314},{"class":177,"line":441},[4315],{"type":32,"tag":175,"props":4316,"children":4317},{"style":188},[4318],{"type":45,"value":1372},{"type":32,"tag":175,"props":4320,"children":4321},{"class":177,"line":474},[4322],{"type":32,"tag":175,"props":4323,"children":4324},{"emptyLinePlaceholder":265},[4325],{"type":45,"value":268},{"type":32,"tag":175,"props":4327,"children":4328},{"class":177,"line":1039},[4329,4333,4338,4342],{"type":32,"tag":175,"props":4330,"children":4331},{"style":280},[4332],{"type":45,"value":4104},{"type":32,"tag":175,"props":4334,"children":4335},{"style":188},[4336],{"type":45,"value":4337}," data ",{"type":32,"tag":175,"props":4339,"children":4340},{"style":182},[4341],{"type":45,"value":854},{"type":32,"tag":175,"props":4343,"children":4344},{"style":188},[4345],{"type":45,"value":4346}," feeds[agentSlug]\n",{"type":32,"tag":175,"props":4348,"children":4349},{"class":177,"line":1071},[4350],{"type":32,"tag":175,"props":4351,"children":4352},{"emptyLinePlaceholder":265},[4353],{"type":45,"value":268},{"type":32,"tag":175,"props":4355,"children":4356},{"class":177,"line":1079},[4357],{"type":32,"tag":175,"props":4358,"children":4359},{"style":300},[4360],{"type":45,"value":4361},"  // Handle 404s (mimic a real API)\n",{"type":32,"tag":175,"props":4363,"children":4364},{"class":177,"line":1113},[4365,4369,4373,4377],{"type":32,"tag":175,"props":4366,"children":4367},{"style":182},[4368],{"type":45,"value":4147},{"type":32,"tag":175,"props":4370,"children":4371},{"style":188},[4372],{"type":45,"value":1090},{"type":32,"tag":175,"props":4374,"children":4375},{"style":182},[4376],{"type":45,"value":1095},{"type":32,"tag":175,"props":4378,"children":4379},{"style":188},[4380],{"type":45,"value":4381},"data) {\n",{"type":32,"tag":175,"props":4383,"children":4384},{"class":177,"line":1121},[4385,4389,4393,4397,4402,4406,4411,4416,4421,4426,4431],{"type":32,"tag":175,"props":4386,"children":4387},{"style":182},[4388],{"type":45,"value":4168},{"type":32,"tag":175,"props":4390,"children":4391},{"style":391},[4392],{"type":45,"value":4173},{"type":32,"tag":175,"props":4394,"children":4395},{"style":188},[4396],{"type":45,"value":4178},{"type":32,"tag":175,"props":4398,"children":4399},{"style":857},[4400],{"type":45,"value":4401},"404",{"type":32,"tag":175,"props":4403,"children":4404},{"style":188},[4405],{"type":45,"value":4188},{"type":32,"tag":175,"props":4407,"children":4408},{"style":217},[4409],{"type":45,"value":4410},"`Agent feed '",{"type":32,"tag":175,"props":4412,"children":4413},{"style":182},[4414],{"type":45,"value":4415},"${",{"type":32,"tag":175,"props":4417,"children":4418},{"style":188},[4419],{"type":45,"value":4420},"agentSlug",{"type":32,"tag":175,"props":4422,"children":4423},{"style":182},[4424],{"type":45,"value":4425},"}",{"type":32,"tag":175,"props":4427,"children":4428},{"style":217},[4429],{"type":45,"value":4430},"' not found`",{"type":32,"tag":175,"props":4432,"children":4433},{"style":188},[4434],{"type":45,"value":4198},{"type":32,"tag":175,"props":4436,"children":4437},{"class":177,"line":1130},[4438],{"type":32,"tag":175,"props":4439,"children":4440},{"style":188},[4441],{"type":45,"value":1372},{"type":32,"tag":175,"props":4443,"children":4444},{"class":177,"line":1170},[4445],{"type":32,"tag":175,"props":4446,"children":4447},{"emptyLinePlaceholder":265},[4448],{"type":45,"value":268},{"type":32,"tag":175,"props":4450,"children":4451},{"class":177,"line":1179},[4452,4457],{"type":32,"tag":175,"props":4453,"children":4454},{"style":182},[4455],{"type":45,"value":4456},"  return",{"type":32,"tag":175,"props":4458,"children":4459},{"style":188},[4460],{"type":45,"value":4461}," data\n",{"type":32,"tag":175,"props":4463,"children":4464},{"class":177,"line":1197},[4465],{"type":32,"tag":175,"props":4466,"children":4467},{"style":188},[4468],{"type":45,"value":4469},"})\n",{"type":32,"tag":33,"props":4471,"children":4472},{},[4473,4475,4481],{"type":45,"value":4474},"Now we create: ",{"type":32,"tag":155,"props":4476,"children":4478},{"className":4477},[],[4479],{"type":45,"value":4480},"/server/utils/services/propertySync/SyncAgentPropertiesService.ts",{"type":45,"value":162},{"type":32,"tag":164,"props":4483,"children":4485},{"className":166,"code":4484,"language":168,"meta":169,"style":169},"import {\n  AILocationMatcherRepository,\n} from '~~/server/utils/services/propertySync/repositories/AILocationMatcherRepository'\nimport {\n  AgentWithProperties,\n  Location, Property,\n} from '~~/server/database/types'\nimport { AgentProperty } from './AgentProperty'\nimport {\n  LocationMatcher,\n} from '~~/server/utils/services/propertySync/helpers/LocationMatcher'\nimport { drizzle } from 'drizzle-orm/d1'\nimport * as schema from '~~/server/database/schema'\nimport type { D1Database } from '@cloudflare/workers-types'\n\nexport class SyncAgentPropertiesService {\n\n  private readonly db: ReturnType\u003Ctypeof drizzle\u003Ctypeof schema>>\n\n  public constructor (\n    private readonly aiLocationMatcherRepository: AILocationMatcherRepository,\n    private readonly locations: Location[],\n    database: D1Database,\n  ) {\n\n    this.db = drizzle(database, { schema })\n  }\n\n  /**\n   * Executes the property synchronization for the given agent.\n   *\n   * @param agent\n   */\n  public async execute (\n    agent: AgentWithProperties,\n  ): Promise\u003Cvoid> {\n\n    if (!agent.apiRoute) {\n      throw new Error(\n        `[Sync Service] Agent \"${agent.name}\" - \"${agent.id}\" has no API route configured.`,\n      )\n    }\n\n    const agentFeedProperties = await $fetch\u003CAgentProperty[]>(\n      agent.apiRoute,\n    )\n\n    const locationMatcher = new LocationMatcher(\n      this.locations,\n      this.aiLocationMatcherRepository,\n    )\n\n    for (const agentProperty of agentFeedProperties) {\n      const existingProperty = agent.properties?.find(\n        (prop: Property) => prop.externalRef === agentProperty.propertyId,\n      )\n      // if property already added, skip\n      if (existingProperty) {\n        continue\n      }\n\n      // try to find matching location\n      const matchedLocation = await locationMatcher.match(\n        agentProperty,\n      )\n\n      if (matchedLocation) {\n        await this.db.insert(schema.properties).values({\n          externalRef: agentProperty.propertyId,\n          title: agentProperty.title,\n          locationId: matchedLocation.id,\n          originalLocation: agentProperty.location || '',\n          agentId: agent.id,\n        })\n      } else {\n        console.log(`[Sync Service] Skipped (No Match): \"${agentProperty.title}\"`)\n      }\n    }\n  }\n\n}\n\n",[4486],{"type":32,"tag":155,"props":4487,"children":4488},{"__ignoreMap":169},[4489,4500,4507,4522,4533,4541,4549,4564,4585,4596,4604,4620,4641,4672,4697,4704,4724,4731,4779,4786,4801,4828,4856,4877,4885,4892,4919,4926,4933,4940,4948,4955,4971,4978,4998,5019,5047,5054,5074,5096,5144,5151,5158,5165,5204,5212,5219,5226,5254,5267,5279,5286,5293,5325,5354,5397,5404,5412,5424,5432,5439,5446,5454,5486,5494,5501,5508,5519,5556,5564,5572,5580,5600,5608,5616,5633,5677,5684,5691,5698,5705],{"type":32,"tag":175,"props":4490,"children":4491},{"class":177,"line":178},[4492,4496],{"type":32,"tag":175,"props":4493,"children":4494},{"style":182},[4495],{"type":45,"value":185},{"type":32,"tag":175,"props":4497,"children":4498},{"style":188},[4499],{"type":45,"value":191},{"type":32,"tag":175,"props":4501,"children":4502},{"class":177,"line":194},[4503],{"type":32,"tag":175,"props":4504,"children":4505},{"style":188},[4506],{"type":45,"value":1839},{"type":32,"tag":175,"props":4508,"children":4509},{"class":177,"line":203},[4510,4514,4518],{"type":32,"tag":175,"props":4511,"children":4512},{"style":188},[4513],{"type":45,"value":209},{"type":32,"tag":175,"props":4515,"children":4516},{"style":182},[4517],{"type":45,"value":214},{"type":32,"tag":175,"props":4519,"children":4520},{"style":217},[4521],{"type":45,"value":1855},{"type":32,"tag":175,"props":4523,"children":4524},{"class":177,"line":223},[4525,4529],{"type":32,"tag":175,"props":4526,"children":4527},{"style":182},[4528],{"type":45,"value":185},{"type":32,"tag":175,"props":4530,"children":4531},{"style":188},[4532],{"type":45,"value":191},{"type":32,"tag":175,"props":4534,"children":4535},{"class":177,"line":235},[4536],{"type":32,"tag":175,"props":4537,"children":4538},{"style":188},[4539],{"type":45,"value":4540},"  AgentWithProperties,\n",{"type":32,"tag":175,"props":4542,"children":4543},{"class":177,"line":244},[4544],{"type":32,"tag":175,"props":4545,"children":4546},{"style":188},[4547],{"type":45,"value":4548},"  Location, Property,\n",{"type":32,"tag":175,"props":4550,"children":4551},{"class":177,"line":261},[4552,4556,4560],{"type":32,"tag":175,"props":4553,"children":4554},{"style":188},[4555],{"type":45,"value":209},{"type":32,"tag":175,"props":4557,"children":4558},{"style":182},[4559],{"type":45,"value":214},{"type":32,"tag":175,"props":4561,"children":4562},{"style":217},[4563],{"type":45,"value":1816},{"type":32,"tag":175,"props":4565,"children":4566},{"class":177,"line":271},[4567,4571,4576,4580],{"type":32,"tag":175,"props":4568,"children":4569},{"style":182},[4570],{"type":45,"value":185},{"type":32,"tag":175,"props":4572,"children":4573},{"style":188},[4574],{"type":45,"value":4575}," { AgentProperty } ",{"type":32,"tag":175,"props":4577,"children":4578},{"style":182},[4579],{"type":45,"value":214},{"type":32,"tag":175,"props":4581,"children":4582},{"style":217},[4583],{"type":45,"value":4584}," './AgentProperty'\n",{"type":32,"tag":175,"props":4586,"children":4587},{"class":177,"line":296},[4588,4592],{"type":32,"tag":175,"props":4589,"children":4590},{"style":182},[4591],{"type":45,"value":185},{"type":32,"tag":175,"props":4593,"children":4594},{"style":188},[4595],{"type":45,"value":191},{"type":32,"tag":175,"props":4597,"children":4598},{"class":177,"line":306},[4599],{"type":32,"tag":175,"props":4600,"children":4601},{"style":188},[4602],{"type":45,"value":4603},"  LocationMatcher,\n",{"type":32,"tag":175,"props":4605,"children":4606},{"class":177,"line":315},[4607,4611,4615],{"type":32,"tag":175,"props":4608,"children":4609},{"style":188},[4610],{"type":45,"value":209},{"type":32,"tag":175,"props":4612,"children":4613},{"style":182},[4614],{"type":45,"value":214},{"type":32,"tag":175,"props":4616,"children":4617},{"style":217},[4618],{"type":45,"value":4619}," '~~/server/utils/services/propertySync/helpers/LocationMatcher'\n",{"type":32,"tag":175,"props":4621,"children":4622},{"class":177,"line":324},[4623,4627,4632,4636],{"type":32,"tag":175,"props":4624,"children":4625},{"style":182},[4626],{"type":45,"value":185},{"type":32,"tag":175,"props":4628,"children":4629},{"style":188},[4630],{"type":45,"value":4631}," { drizzle } ",{"type":32,"tag":175,"props":4633,"children":4634},{"style":182},[4635],{"type":45,"value":214},{"type":32,"tag":175,"props":4637,"children":4638},{"style":217},[4639],{"type":45,"value":4640}," 'drizzle-orm/d1'\n",{"type":32,"tag":175,"props":4642,"children":4643},{"class":177,"line":343},[4644,4648,4653,4658,4663,4667],{"type":32,"tag":175,"props":4645,"children":4646},{"style":182},[4647],{"type":45,"value":185},{"type":32,"tag":175,"props":4649,"children":4650},{"style":857},[4651],{"type":45,"value":4652}," *",{"type":32,"tag":175,"props":4654,"children":4655},{"style":182},[4656],{"type":45,"value":4657}," as",{"type":32,"tag":175,"props":4659,"children":4660},{"style":188},[4661],{"type":45,"value":4662}," schema ",{"type":32,"tag":175,"props":4664,"children":4665},{"style":182},[4666],{"type":45,"value":214},{"type":32,"tag":175,"props":4668,"children":4669},{"style":217},[4670],{"type":45,"value":4671}," '~~/server/database/schema'\n",{"type":32,"tag":175,"props":4673,"children":4674},{"class":177,"line":361},[4675,4679,4683,4688,4692],{"type":32,"tag":175,"props":4676,"children":4677},{"style":182},[4678],{"type":45,"value":185},{"type":32,"tag":175,"props":4680,"children":4681},{"style":182},[4682],{"type":45,"value":1802},{"type":32,"tag":175,"props":4684,"children":4685},{"style":188},[4686],{"type":45,"value":4687}," { D1Database } ",{"type":32,"tag":175,"props":4689,"children":4690},{"style":182},[4691],{"type":45,"value":214},{"type":32,"tag":175,"props":4693,"children":4694},{"style":217},[4695],{"type":45,"value":4696}," '@cloudflare/workers-types'\n",{"type":32,"tag":175,"props":4698,"children":4699},{"class":177,"line":378},[4700],{"type":32,"tag":175,"props":4701,"children":4702},{"emptyLinePlaceholder":265},[4703],{"type":45,"value":268},{"type":32,"tag":175,"props":4705,"children":4706},{"class":177,"line":387},[4707,4711,4715,4720],{"type":32,"tag":175,"props":4708,"children":4709},{"style":182},[4710],{"type":45,"value":277},{"type":32,"tag":175,"props":4712,"children":4713},{"style":280},[4714],{"type":45,"value":1964},{"type":32,"tag":175,"props":4716,"children":4717},{"style":286},[4718],{"type":45,"value":4719}," SyncAgentPropertiesService",{"type":32,"tag":175,"props":4721,"children":4722},{"style":188},[4723],{"type":45,"value":191},{"type":32,"tag":175,"props":4725,"children":4726},{"class":177,"line":402},[4727],{"type":32,"tag":175,"props":4728,"children":4729},{"emptyLinePlaceholder":265},[4730],{"type":45,"value":268},{"type":32,"tag":175,"props":4732,"children":4733},{"class":177,"line":441},[4734,4738,4742,4747,4751,4756,4760,4765,4770,4774],{"type":32,"tag":175,"props":4735,"children":4736},{"style":182},[4737],{"type":45,"value":2679},{"type":32,"tag":175,"props":4739,"children":4740},{"style":182},[4741],{"type":45,"value":2003},{"type":32,"tag":175,"props":4743,"children":4744},{"style":188},[4745],{"type":45,"value":4746}," db",{"type":32,"tag":175,"props":4748,"children":4749},{"style":182},[4750],{"type":45,"value":68},{"type":32,"tag":175,"props":4752,"children":4753},{"style":286},[4754],{"type":45,"value":4755}," ReturnType",{"type":32,"tag":175,"props":4757,"children":4758},{"style":188},[4759],{"type":45,"value":461},{"type":32,"tag":175,"props":4761,"children":4762},{"style":182},[4763],{"type":45,"value":4764},"typeof",{"type":32,"tag":175,"props":4766,"children":4767},{"style":188},[4768],{"type":45,"value":4769}," drizzle\u003C",{"type":32,"tag":175,"props":4771,"children":4772},{"style":182},[4773],{"type":45,"value":4764},{"type":32,"tag":175,"props":4775,"children":4776},{"style":188},[4777],{"type":45,"value":4778}," schema>>\n",{"type":32,"tag":175,"props":4780,"children":4781},{"class":177,"line":474},[4782],{"type":32,"tag":175,"props":4783,"children":4784},{"emptyLinePlaceholder":265},[4785],{"type":45,"value":268},{"type":32,"tag":175,"props":4787,"children":4788},{"class":177,"line":1039},[4789,4793,4797],{"type":32,"tag":175,"props":4790,"children":4791},{"style":182},[4792],{"type":45,"value":1981},{"type":32,"tag":175,"props":4794,"children":4795},{"style":280},[4796],{"type":45,"value":1986},{"type":32,"tag":175,"props":4798,"children":4799},{"style":188},[4800],{"type":45,"value":399},{"type":32,"tag":175,"props":4802,"children":4803},{"class":177,"line":1071},[4804,4808,4812,4816,4820,4824],{"type":32,"tag":175,"props":4805,"children":4806},{"style":182},[4807],{"type":45,"value":1998},{"type":32,"tag":175,"props":4809,"children":4810},{"style":182},[4811],{"type":45,"value":2003},{"type":32,"tag":175,"props":4813,"children":4814},{"style":406},[4815],{"type":45,"value":2038},{"type":32,"tag":175,"props":4817,"children":4818},{"style":182},[4819],{"type":45,"value":68},{"type":32,"tag":175,"props":4821,"children":4822},{"style":286},[4823],{"type":45,"value":289},{"type":32,"tag":175,"props":4825,"children":4826},{"style":188},[4827],{"type":45,"value":673},{"type":32,"tag":175,"props":4829,"children":4830},{"class":177,"line":1079},[4831,4835,4839,4844,4848,4852],{"type":32,"tag":175,"props":4832,"children":4833},{"style":182},[4834],{"type":45,"value":1998},{"type":32,"tag":175,"props":4836,"children":4837},{"style":182},[4838],{"type":45,"value":2003},{"type":32,"tag":175,"props":4840,"children":4841},{"style":406},[4842],{"type":45,"value":4843}," locations",{"type":32,"tag":175,"props":4845,"children":4846},{"style":182},[4847],{"type":45,"value":68},{"type":32,"tag":175,"props":4849,"children":4850},{"style":286},[4851],{"type":45,"value":2017},{"type":32,"tag":175,"props":4853,"children":4854},{"style":188},[4855],{"type":45,"value":2022},{"type":32,"tag":175,"props":4857,"children":4858},{"class":177,"line":1113},[4859,4864,4868,4873],{"type":32,"tag":175,"props":4860,"children":4861},{"style":406},[4862],{"type":45,"value":4863},"    database",{"type":32,"tag":175,"props":4865,"children":4866},{"style":182},[4867],{"type":45,"value":68},{"type":32,"tag":175,"props":4869,"children":4870},{"style":286},[4871],{"type":45,"value":4872}," D1Database",{"type":32,"tag":175,"props":4874,"children":4875},{"style":188},[4876],{"type":45,"value":673},{"type":32,"tag":175,"props":4878,"children":4879},{"class":177,"line":1121},[4880],{"type":32,"tag":175,"props":4881,"children":4882},{"style":188},[4883],{"type":45,"value":4884},"  ) {\n",{"type":32,"tag":175,"props":4886,"children":4887},{"class":177,"line":1130},[4888],{"type":32,"tag":175,"props":4889,"children":4890},{"emptyLinePlaceholder":265},[4891],{"type":45,"value":268},{"type":32,"tag":175,"props":4893,"children":4894},{"class":177,"line":1170},[4895,4900,4905,4909,4914],{"type":32,"tag":175,"props":4896,"children":4897},{"style":917},[4898],{"type":45,"value":4899},"    this",{"type":32,"tag":175,"props":4901,"children":4902},{"style":188},[4903],{"type":45,"value":4904},".db ",{"type":32,"tag":175,"props":4906,"children":4907},{"style":182},[4908],{"type":45,"value":854},{"type":32,"tag":175,"props":4910,"children":4911},{"style":391},[4912],{"type":45,"value":4913}," drizzle",{"type":32,"tag":175,"props":4915,"children":4916},{"style":188},[4917],{"type":45,"value":4918},"(database, { schema })\n",{"type":32,"tag":175,"props":4920,"children":4921},{"class":177,"line":1179},[4922],{"type":32,"tag":175,"props":4923,"children":4924},{"style":188},[4925],{"type":45,"value":1372},{"type":32,"tag":175,"props":4927,"children":4928},{"class":177,"line":1197},[4929],{"type":32,"tag":175,"props":4930,"children":4931},{"emptyLinePlaceholder":265},[4932],{"type":45,"value":268},{"type":32,"tag":175,"props":4934,"children":4935},{"class":177,"line":1206},[4936],{"type":32,"tag":175,"props":4937,"children":4938},{"style":300},[4939],{"type":45,"value":303},{"type":32,"tag":175,"props":4941,"children":4942},{"class":177,"line":1214},[4943],{"type":32,"tag":175,"props":4944,"children":4945},{"style":300},[4946],{"type":45,"value":4947},"   * Executes the property synchronization for the given agent.\n",{"type":32,"tag":175,"props":4949,"children":4950},{"class":177,"line":1223},[4951],{"type":32,"tag":175,"props":4952,"children":4953},{"style":300},[4954],{"type":45,"value":321},{"type":32,"tag":175,"props":4956,"children":4957},{"class":177,"line":1267},[4958,4962,4966],{"type":32,"tag":175,"props":4959,"children":4960},{"style":300},[4961],{"type":45,"value":330},{"type":32,"tag":175,"props":4963,"children":4964},{"style":280},[4965],{"type":45,"value":353},{"type":32,"tag":175,"props":4967,"children":4968},{"style":188},[4969],{"type":45,"value":4970}," agent\n",{"type":32,"tag":175,"props":4972,"children":4973},{"class":177,"line":1276},[4974],{"type":32,"tag":175,"props":4975,"children":4976},{"style":300},[4977],{"type":45,"value":384},{"type":32,"tag":175,"props":4979,"children":4980},{"class":177,"line":1285},[4981,4985,4989,4994],{"type":32,"tag":175,"props":4982,"children":4983},{"style":182},[4984],{"type":45,"value":1981},{"type":32,"tag":175,"props":4986,"children":4987},{"style":182},[4988],{"type":45,"value":2107},{"type":32,"tag":175,"props":4990,"children":4991},{"style":391},[4992],{"type":45,"value":4993}," execute",{"type":32,"tag":175,"props":4995,"children":4996},{"style":188},[4997],{"type":45,"value":399},{"type":32,"tag":175,"props":4999,"children":5000},{"class":177,"line":1294},[5001,5006,5010,5015],{"type":32,"tag":175,"props":5002,"children":5003},{"style":406},[5004],{"type":45,"value":5005},"    agent",{"type":32,"tag":175,"props":5007,"children":5008},{"style":182},[5009],{"type":45,"value":68},{"type":32,"tag":175,"props":5011,"children":5012},{"style":286},[5013],{"type":45,"value":5014}," AgentWithProperties",{"type":32,"tag":175,"props":5016,"children":5017},{"style":188},[5018],{"type":45,"value":673},{"type":32,"tag":175,"props":5020,"children":5021},{"class":177,"line":1302},[5022,5026,5030,5034,5038,5043],{"type":32,"tag":175,"props":5023,"children":5024},{"style":188},[5025],{"type":45,"value":447},{"type":32,"tag":175,"props":5027,"children":5028},{"style":182},[5029],{"type":45,"value":68},{"type":32,"tag":175,"props":5031,"children":5032},{"style":286},[5033],{"type":45,"value":456},{"type":32,"tag":175,"props":5035,"children":5036},{"style":188},[5037],{"type":45,"value":461},{"type":32,"tag":175,"props":5039,"children":5040},{"style":280},[5041],{"type":45,"value":5042},"void",{"type":32,"tag":175,"props":5044,"children":5045},{"style":188},[5046],{"type":45,"value":2175},{"type":32,"tag":175,"props":5048,"children":5049},{"class":177,"line":1311},[5050],{"type":32,"tag":175,"props":5051,"children":5052},{"emptyLinePlaceholder":265},[5053],{"type":45,"value":268},{"type":32,"tag":175,"props":5055,"children":5056},{"class":177,"line":1348},[5057,5061,5065,5069],{"type":32,"tag":175,"props":5058,"children":5059},{"style":182},[5060],{"type":45,"value":950},{"type":32,"tag":175,"props":5062,"children":5063},{"style":188},[5064],{"type":45,"value":1090},{"type":32,"tag":175,"props":5066,"children":5067},{"style":182},[5068],{"type":45,"value":1095},{"type":32,"tag":175,"props":5070,"children":5071},{"style":188},[5072],{"type":45,"value":5073},"agent.apiRoute) {\n",{"type":32,"tag":175,"props":5075,"children":5076},{"class":177,"line":1357},[5077,5082,5087,5092],{"type":32,"tag":175,"props":5078,"children":5079},{"style":182},[5080],{"type":45,"value":5081},"      throw",{"type":32,"tag":175,"props":5083,"children":5084},{"style":182},[5085],{"type":45,"value":5086}," new",{"type":32,"tag":175,"props":5088,"children":5089},{"style":391},[5090],{"type":45,"value":5091}," Error",{"type":32,"tag":175,"props":5093,"children":5094},{"style":188},[5095],{"type":45,"value":2224},{"type":32,"tag":175,"props":5097,"children":5098},{"class":177,"line":1366},[5099,5104,5108,5113,5117,5122,5126,5131,5135,5140],{"type":32,"tag":175,"props":5100,"children":5101},{"style":217},[5102],{"type":45,"value":5103},"        `[Sync Service] Agent \"",{"type":32,"tag":175,"props":5105,"children":5106},{"style":182},[5107],{"type":45,"value":4415},{"type":32,"tag":175,"props":5109,"children":5110},{"style":188},[5111],{"type":45,"value":5112},"agent.name",{"type":32,"tag":175,"props":5114,"children":5115},{"style":182},[5116],{"type":45,"value":4425},{"type":32,"tag":175,"props":5118,"children":5119},{"style":217},[5120],{"type":45,"value":5121},"\" - \"",{"type":32,"tag":175,"props":5123,"children":5124},{"style":182},[5125],{"type":45,"value":4415},{"type":32,"tag":175,"props":5127,"children":5128},{"style":188},[5129],{"type":45,"value":5130},"agent.id",{"type":32,"tag":175,"props":5132,"children":5133},{"style":182},[5134],{"type":45,"value":4425},{"type":32,"tag":175,"props":5136,"children":5137},{"style":217},[5138],{"type":45,"value":5139},"\" has no API route configured.`",{"type":32,"tag":175,"props":5141,"children":5142},{"style":188},[5143],{"type":45,"value":673},{"type":32,"tag":175,"props":5145,"children":5146},{"class":177,"line":1375},[5147],{"type":32,"tag":175,"props":5148,"children":5149},{"style":188},[5150],{"type":45,"value":2503},{"type":32,"tag":175,"props":5152,"children":5153},{"class":177,"line":1384},[5154],{"type":32,"tag":175,"props":5155,"children":5156},{"style":188},[5157],{"type":45,"value":1363},{"type":32,"tag":175,"props":5159,"children":5160},{"class":177,"line":1393},[5161],{"type":32,"tag":175,"props":5162,"children":5163},{"emptyLinePlaceholder":265},[5164],{"type":45,"value":268},{"type":32,"tag":175,"props":5166,"children":5167},{"class":177,"line":1402},[5168,5172,5177,5181,5185,5190,5194,5199],{"type":32,"tag":175,"props":5169,"children":5170},{"style":280},[5171],{"type":45,"value":1471},{"type":32,"tag":175,"props":5173,"children":5174},{"style":188},[5175],{"type":45,"value":5176}," agentFeedProperties ",{"type":32,"tag":175,"props":5178,"children":5179},{"style":182},[5180],{"type":45,"value":854},{"type":32,"tag":175,"props":5182,"children":5183},{"style":182},[5184],{"type":45,"value":1018},{"type":32,"tag":175,"props":5186,"children":5187},{"style":391},[5188],{"type":45,"value":5189}," $fetch",{"type":32,"tag":175,"props":5191,"children":5192},{"style":188},[5193],{"type":45,"value":461},{"type":32,"tag":175,"props":5195,"children":5196},{"style":286},[5197],{"type":45,"value":5198},"AgentProperty",{"type":32,"tag":175,"props":5200,"children":5201},{"style":188},[5202],{"type":45,"value":5203},"[]>(\n",{"type":32,"tag":175,"props":5205,"children":5206},{"class":177,"line":1410},[5207],{"type":32,"tag":175,"props":5208,"children":5209},{"style":188},[5210],{"type":45,"value":5211},"      agent.apiRoute,\n",{"type":32,"tag":175,"props":5213,"children":5214},{"class":177,"line":1426},[5215],{"type":32,"tag":175,"props":5216,"children":5217},{"style":188},[5218],{"type":45,"value":2248},{"type":32,"tag":175,"props":5220,"children":5221},{"class":177,"line":1439},[5222],{"type":32,"tag":175,"props":5223,"children":5224},{"emptyLinePlaceholder":265},[5225],{"type":45,"value":268},{"type":32,"tag":175,"props":5227,"children":5228},{"class":177,"line":1447},[5229,5233,5238,5242,5246,5250],{"type":32,"tag":175,"props":5230,"children":5231},{"style":280},[5232],{"type":45,"value":1471},{"type":32,"tag":175,"props":5234,"children":5235},{"style":188},[5236],{"type":45,"value":5237}," locationMatcher ",{"type":32,"tag":175,"props":5239,"children":5240},{"style":182},[5241],{"type":45,"value":854},{"type":32,"tag":175,"props":5243,"children":5244},{"style":182},[5245],{"type":45,"value":5086},{"type":32,"tag":175,"props":5247,"children":5248},{"style":391},[5249],{"type":45,"value":1969},{"type":32,"tag":175,"props":5251,"children":5252},{"style":188},[5253],{"type":45,"value":2224},{"type":32,"tag":175,"props":5255,"children":5256},{"class":177,"line":1465},[5257,5262],{"type":32,"tag":175,"props":5258,"children":5259},{"style":917},[5260],{"type":45,"value":5261},"      this",{"type":32,"tag":175,"props":5263,"children":5264},{"style":188},[5265],{"type":45,"value":5266},".locations,\n",{"type":32,"tag":175,"props":5268,"children":5269},{"class":177,"line":1501},[5270,5274],{"type":32,"tag":175,"props":5271,"children":5272},{"style":917},[5273],{"type":45,"value":5261},{"type":32,"tag":175,"props":5275,"children":5276},{"style":188},[5277],{"type":45,"value":5278},".aiLocationMatcherRepository,\n",{"type":32,"tag":175,"props":5280,"children":5281},{"class":177,"line":1510},[5282],{"type":32,"tag":175,"props":5283,"children":5284},{"style":188},[5285],{"type":45,"value":2248},{"type":32,"tag":175,"props":5287,"children":5288},{"class":177,"line":1533},[5289],{"type":32,"tag":175,"props":5290,"children":5291},{"emptyLinePlaceholder":265},[5292],{"type":45,"value":268},{"type":32,"tag":175,"props":5294,"children":5295},{"class":177,"line":1554},[5296,5301,5305,5310,5315,5320],{"type":32,"tag":175,"props":5297,"children":5298},{"style":182},[5299],{"type":45,"value":5300},"    for",{"type":32,"tag":175,"props":5302,"children":5303},{"style":188},[5304],{"type":45,"value":1090},{"type":32,"tag":175,"props":5306,"children":5307},{"style":280},[5308],{"type":45,"value":5309},"const",{"type":32,"tag":175,"props":5311,"children":5312},{"style":188},[5313],{"type":45,"value":5314}," agentProperty ",{"type":32,"tag":175,"props":5316,"children":5317},{"style":182},[5318],{"type":45,"value":5319},"of",{"type":32,"tag":175,"props":5321,"children":5322},{"style":188},[5323],{"type":45,"value":5324}," agentFeedProperties) {\n",{"type":32,"tag":175,"props":5326,"children":5327},{"class":177,"line":1575},[5328,5332,5337,5341,5346,5350],{"type":32,"tag":175,"props":5329,"children":5330},{"style":280},[5331],{"type":45,"value":1004},{"type":32,"tag":175,"props":5333,"children":5334},{"style":188},[5335],{"type":45,"value":5336}," existingProperty ",{"type":32,"tag":175,"props":5338,"children":5339},{"style":182},[5340],{"type":45,"value":854},{"type":32,"tag":175,"props":5342,"children":5343},{"style":188},[5344],{"type":45,"value":5345}," agent.properties?.",{"type":32,"tag":175,"props":5347,"children":5348},{"style":391},[5349],{"type":45,"value":2455},{"type":32,"tag":175,"props":5351,"children":5352},{"style":188},[5353],{"type":45,"value":2224},{"type":32,"tag":175,"props":5355,"children":5356},{"class":177,"line":1584},[5357,5361,5366,5370,5375,5379,5383,5388,5392],{"type":32,"tag":175,"props":5358,"children":5359},{"style":188},[5360],{"type":45,"value":2467},{"type":32,"tag":175,"props":5362,"children":5363},{"style":406},[5364],{"type":45,"value":5365},"prop",{"type":32,"tag":175,"props":5367,"children":5368},{"style":182},[5369],{"type":45,"value":68},{"type":32,"tag":175,"props":5371,"children":5372},{"style":286},[5373],{"type":45,"value":5374}," Property",{"type":32,"tag":175,"props":5376,"children":5377},{"style":188},[5378],{"type":45,"value":1254},{"type":32,"tag":175,"props":5380,"children":5381},{"style":280},[5382],{"type":45,"value":1259},{"type":32,"tag":175,"props":5384,"children":5385},{"style":188},[5386],{"type":45,"value":5387}," prop.externalRef ",{"type":32,"tag":175,"props":5389,"children":5390},{"style":182},[5391],{"type":45,"value":2490},{"type":32,"tag":175,"props":5393,"children":5394},{"style":188},[5395],{"type":45,"value":5396}," agentProperty.propertyId,\n",{"type":32,"tag":175,"props":5398,"children":5399},{"class":177,"line":1592},[5400],{"type":32,"tag":175,"props":5401,"children":5402},{"style":188},[5403],{"type":45,"value":2503},{"type":32,"tag":175,"props":5405,"children":5406},{"class":177,"line":1606},[5407],{"type":32,"tag":175,"props":5408,"children":5409},{"style":300},[5410],{"type":45,"value":5411},"      // if property already added, skip\n",{"type":32,"tag":175,"props":5413,"children":5414},{"class":177,"line":1671},[5415,5419],{"type":32,"tag":175,"props":5416,"children":5417},{"style":182},[5418],{"type":45,"value":1085},{"type":32,"tag":175,"props":5420,"children":5421},{"style":188},[5422],{"type":45,"value":5423}," (existingProperty) {\n",{"type":32,"tag":175,"props":5425,"children":5426},{"class":177,"line":1697},[5427],{"type":32,"tag":175,"props":5428,"children":5429},{"style":182},[5430],{"type":45,"value":5431},"        continue\n",{"type":32,"tag":175,"props":5433,"children":5434},{"class":177,"line":1714},[5435],{"type":32,"tag":175,"props":5436,"children":5437},{"style":188},[5438],{"type":45,"value":2543},{"type":32,"tag":175,"props":5440,"children":5441},{"class":177,"line":2593},[5442],{"type":32,"tag":175,"props":5443,"children":5444},{"emptyLinePlaceholder":265},[5445],{"type":45,"value":268},{"type":32,"tag":175,"props":5447,"children":5448},{"class":177,"line":2602},[5449],{"type":32,"tag":175,"props":5450,"children":5451},{"style":300},[5452],{"type":45,"value":5453},"      // try to find matching location\n",{"type":32,"tag":175,"props":5455,"children":5456},{"class":177,"line":2611},[5457,5461,5465,5469,5473,5478,5482],{"type":32,"tag":175,"props":5458,"children":5459},{"style":280},[5460],{"type":45,"value":1004},{"type":32,"tag":175,"props":5462,"children":5463},{"style":188},[5464],{"type":45,"value":2437},{"type":32,"tag":175,"props":5466,"children":5467},{"style":182},[5468],{"type":45,"value":854},{"type":32,"tag":175,"props":5470,"children":5471},{"style":182},[5472],{"type":45,"value":1018},{"type":32,"tag":175,"props":5474,"children":5475},{"style":188},[5476],{"type":45,"value":5477}," locationMatcher.",{"type":32,"tag":175,"props":5479,"children":5480},{"style":391},[5481],{"type":45,"value":1249},{"type":32,"tag":175,"props":5483,"children":5484},{"style":188},[5485],{"type":45,"value":2224},{"type":32,"tag":175,"props":5487,"children":5488},{"class":177,"line":2619},[5489],{"type":32,"tag":175,"props":5490,"children":5491},{"style":188},[5492],{"type":45,"value":5493},"        agentProperty,\n",{"type":32,"tag":175,"props":5495,"children":5496},{"class":177,"line":2631},[5497],{"type":32,"tag":175,"props":5498,"children":5499},{"style":188},[5500],{"type":45,"value":2503},{"type":32,"tag":175,"props":5502,"children":5503},{"class":177,"line":2648},[5504],{"type":32,"tag":175,"props":5505,"children":5506},{"emptyLinePlaceholder":265},[5507],{"type":45,"value":268},{"type":32,"tag":175,"props":5509,"children":5510},{"class":177,"line":2665},[5511,5515],{"type":32,"tag":175,"props":5512,"children":5513},{"style":182},[5514],{"type":45,"value":1085},{"type":32,"tag":175,"props":5516,"children":5517},{"style":188},[5518],{"type":45,"value":2522},{"type":32,"tag":175,"props":5520,"children":5521},{"class":177,"line":2673},[5522,5527,5531,5536,5541,5546,5551],{"type":32,"tag":175,"props":5523,"children":5524},{"style":182},[5525],{"type":45,"value":5526},"        await",{"type":32,"tag":175,"props":5528,"children":5529},{"style":917},[5530],{"type":45,"value":920},{"type":32,"tag":175,"props":5532,"children":5533},{"style":188},[5534],{"type":45,"value":5535},".db.",{"type":32,"tag":175,"props":5537,"children":5538},{"style":391},[5539],{"type":45,"value":5540},"insert",{"type":32,"tag":175,"props":5542,"children":5543},{"style":188},[5544],{"type":45,"value":5545},"(schema.properties).",{"type":32,"tag":175,"props":5547,"children":5548},{"style":391},[5549],{"type":45,"value":5550},"values",{"type":32,"tag":175,"props":5552,"children":5553},{"style":188},[5554],{"type":45,"value":5555},"({\n",{"type":32,"tag":175,"props":5557,"children":5558},{"class":177,"line":2691},[5559],{"type":32,"tag":175,"props":5560,"children":5561},{"style":188},[5562],{"type":45,"value":5563},"          externalRef: agentProperty.propertyId,\n",{"type":32,"tag":175,"props":5565,"children":5566},{"class":177,"line":2712},[5567],{"type":32,"tag":175,"props":5568,"children":5569},{"style":188},[5570],{"type":45,"value":5571},"          title: agentProperty.title,\n",{"type":32,"tag":175,"props":5573,"children":5574},{"class":177,"line":2733},[5575],{"type":32,"tag":175,"props":5576,"children":5577},{"style":188},[5578],{"type":45,"value":5579},"          locationId: matchedLocation.id,\n",{"type":32,"tag":175,"props":5581,"children":5582},{"class":177,"line":2761},[5583,5588,5592,5596],{"type":32,"tag":175,"props":5584,"children":5585},{"style":188},[5586],{"type":45,"value":5587},"          originalLocation: agentProperty.location ",{"type":32,"tag":175,"props":5589,"children":5590},{"style":182},[5591],{"type":45,"value":3763},{"type":32,"tag":175,"props":5593,"children":5594},{"style":217},[5595],{"type":45,"value":1526},{"type":32,"tag":175,"props":5597,"children":5598},{"style":188},[5599],{"type":45,"value":673},{"type":32,"tag":175,"props":5601,"children":5602},{"class":177,"line":2770},[5603],{"type":32,"tag":175,"props":5604,"children":5605},{"style":188},[5606],{"type":45,"value":5607},"          agentId: agent.id,\n",{"type":32,"tag":175,"props":5609,"children":5610},{"class":177,"line":2783},[5611],{"type":32,"tag":175,"props":5612,"children":5613},{"style":188},[5614],{"type":45,"value":5615},"        })\n",{"type":32,"tag":175,"props":5617,"children":5618},{"class":177,"line":2823},[5619,5624,5629],{"type":32,"tag":175,"props":5620,"children":5621},{"style":188},[5622],{"type":45,"value":5623},"      } ",{"type":32,"tag":175,"props":5625,"children":5626},{"style":182},[5627],{"type":45,"value":5628},"else",{"type":32,"tag":175,"props":5630,"children":5631},{"style":188},[5632],{"type":45,"value":191},{"type":32,"tag":175,"props":5634,"children":5635},{"class":177,"line":2856},[5636,5641,5646,5650,5655,5659,5664,5668,5673],{"type":32,"tag":175,"props":5637,"children":5638},{"style":188},[5639],{"type":45,"value":5640},"        console.",{"type":32,"tag":175,"props":5642,"children":5643},{"style":391},[5644],{"type":45,"value":5645},"log",{"type":32,"tag":175,"props":5647,"children":5648},{"style":188},[5649],{"type":45,"value":1327},{"type":32,"tag":175,"props":5651,"children":5652},{"style":217},[5653],{"type":45,"value":5654},"`[Sync Service] Skipped (No Match): \"",{"type":32,"tag":175,"props":5656,"children":5657},{"style":182},[5658],{"type":45,"value":4415},{"type":32,"tag":175,"props":5660,"children":5661},{"style":188},[5662],{"type":45,"value":5663},"agentProperty.title",{"type":32,"tag":175,"props":5665,"children":5666},{"style":182},[5667],{"type":45,"value":4425},{"type":32,"tag":175,"props":5669,"children":5670},{"style":217},[5671],{"type":45,"value":5672},"\"`",{"type":32,"tag":175,"props":5674,"children":5675},{"style":188},[5676],{"type":45,"value":1345},{"type":32,"tag":175,"props":5678,"children":5679},{"class":177,"line":2899},[5680],{"type":32,"tag":175,"props":5681,"children":5682},{"style":188},[5683],{"type":45,"value":2543},{"type":32,"tag":175,"props":5685,"children":5686},{"class":177,"line":2907},[5687],{"type":32,"tag":175,"props":5688,"children":5689},{"style":188},[5690],{"type":45,"value":1363},{"type":32,"tag":175,"props":5692,"children":5693},{"class":177,"line":2929},[5694],{"type":32,"tag":175,"props":5695,"children":5696},{"style":188},[5697],{"type":45,"value":1372},{"type":32,"tag":175,"props":5699,"children":5700},{"class":177,"line":2937},[5701],{"type":32,"tag":175,"props":5702,"children":5703},{"emptyLinePlaceholder":265},[5704],{"type":45,"value":268},{"type":32,"tag":175,"props":5706,"children":5707},{"class":177,"line":2945},[5708],{"type":32,"tag":175,"props":5709,"children":5710},{"style":188},[5711],{"type":45,"value":480},{"type":32,"tag":33,"props":5713,"children":5714},{},[5715,5717,5723],{"type":45,"value":5716},"The service will retrieve the dummy listings using the API endpoint we just created, and check whether the given agent's property is already in our internal property database. If it is, it ignores it and proceeds to add new ones. Since we need to match each agent property with our locations before we can save the properties, the service will use the ",{"type":32,"tag":155,"props":5718,"children":5720},{"className":5719},[],[5721],{"type":45,"value":5722},"LocationMatcher",{"type":45,"value":5724}," helper class. If a location is not matched, the service won't add the property.",{"type":32,"tag":33,"props":5726,"children":5727},{},[5728,5730,5736],{"type":45,"value":5729},"Now we need to create a Nitro Task and a Queued process so we can schedule it, and, for immediate feedback, we’ll add an endpoint to test without waiting for the CRON trigger. I’ve covered ",{"type":32,"tag":48,"props":5731,"children":5733},{"href":5732},"/blog/nuxt-cloudflare-queues-and-vectorize-data-sync-pipeline/#how-to-dispatch-and-handle-cloudflare-queues-in-nuxt",[5734],{"type":45,"value":5735},"Nuxt Queues in detail in the previous article",{"type":45,"value":5737},", so that we can move through this part efficiently.",{"type":32,"tag":33,"props":5739,"children":5740},{},[5741],{"type":45,"value":5742},"Create a queue for syncing agent properties on Cloudflare:",{"type":32,"tag":164,"props":5744,"children":5748},{"className":5745,"code":5746,"language":5747,"meta":169,"style":169},"language-shell shiki shiki-themes monokai","npx wrangler queues create agents-properties-sync-queue\n","shell",[5749],{"type":32,"tag":155,"props":5750,"children":5751},{"__ignoreMap":169},[5752],{"type":32,"tag":175,"props":5753,"children":5754},{"class":177,"line":178},[5755,5760,5765,5770,5775],{"type":32,"tag":175,"props":5756,"children":5757},{"style":391},[5758],{"type":45,"value":5759},"npx",{"type":32,"tag":175,"props":5761,"children":5762},{"style":217},[5763],{"type":45,"value":5764}," wrangler",{"type":32,"tag":175,"props":5766,"children":5767},{"style":217},[5768],{"type":45,"value":5769}," queues",{"type":32,"tag":175,"props":5771,"children":5772},{"style":217},[5773],{"type":45,"value":5774}," create",{"type":32,"tag":175,"props":5776,"children":5777},{"style":217},[5778],{"type":45,"value":5779}," agents-properties-sync-queue\n",{"type":32,"tag":33,"props":5781,"children":5782},{},[5783,5785],{"type":45,"value":5784},"Add the bindings to ",{"type":32,"tag":155,"props":5786,"children":5788},{"className":5787},[],[5789],{"type":45,"value":5790},"/wrangler.toml",{"type":32,"tag":164,"props":5792,"children":5796},{"className":5793,"code":5794,"language":5795,"meta":169,"style":169},"language-toml shiki shiki-themes monokai","[[queues.producers]]\nqueue = \"agents-properties-sync-queue\"\nbinding = \"AGENTS_PROPERTIES_SYNC_QUEUE\"\n\n[[queues.consumers]]\nqueue = \"agents-properties-sync-queue\"\nmax_batch_size = 5     # Process 5 messages at a time\nmax_batch_timeout = 10  # Wait up to 10s to fill a batch\nmax_retries = 0 # Intentionally set to 0 since the scheduler will repeatedly run the task\n","toml",[5797],{"type":32,"tag":155,"props":5798,"children":5799},{"__ignoreMap":169},[5800,5808,5821,5834,5841,5849,5860,5878,5896],{"type":32,"tag":175,"props":5801,"children":5802},{"class":177,"line":178},[5803],{"type":32,"tag":175,"props":5804,"children":5805},{"style":188},[5806],{"type":45,"value":5807},"[[queues.producers]]\n",{"type":32,"tag":175,"props":5809,"children":5810},{"class":177,"line":194},[5811,5816],{"type":32,"tag":175,"props":5812,"children":5813},{"style":188},[5814],{"type":45,"value":5815},"queue = ",{"type":32,"tag":175,"props":5817,"children":5818},{"style":217},[5819],{"type":45,"value":5820},"\"agents-properties-sync-queue\"\n",{"type":32,"tag":175,"props":5822,"children":5823},{"class":177,"line":203},[5824,5829],{"type":32,"tag":175,"props":5825,"children":5826},{"style":188},[5827],{"type":45,"value":5828},"binding = ",{"type":32,"tag":175,"props":5830,"children":5831},{"style":217},[5832],{"type":45,"value":5833},"\"AGENTS_PROPERTIES_SYNC_QUEUE\"\n",{"type":32,"tag":175,"props":5835,"children":5836},{"class":177,"line":223},[5837],{"type":32,"tag":175,"props":5838,"children":5839},{"emptyLinePlaceholder":265},[5840],{"type":45,"value":268},{"type":32,"tag":175,"props":5842,"children":5843},{"class":177,"line":235},[5844],{"type":32,"tag":175,"props":5845,"children":5846},{"style":188},[5847],{"type":45,"value":5848},"[[queues.consumers]]\n",{"type":32,"tag":175,"props":5850,"children":5851},{"class":177,"line":244},[5852,5856],{"type":32,"tag":175,"props":5853,"children":5854},{"style":188},[5855],{"type":45,"value":5815},{"type":32,"tag":175,"props":5857,"children":5858},{"style":217},[5859],{"type":45,"value":5820},{"type":32,"tag":175,"props":5861,"children":5862},{"class":177,"line":261},[5863,5868,5873],{"type":32,"tag":175,"props":5864,"children":5865},{"style":188},[5866],{"type":45,"value":5867},"max_batch_size = ",{"type":32,"tag":175,"props":5869,"children":5870},{"style":857},[5871],{"type":45,"value":5872},"5",{"type":32,"tag":175,"props":5874,"children":5875},{"style":300},[5876],{"type":45,"value":5877},"     # Process 5 messages at a time\n",{"type":32,"tag":175,"props":5879,"children":5880},{"class":177,"line":271},[5881,5886,5891],{"type":32,"tag":175,"props":5882,"children":5883},{"style":188},[5884],{"type":45,"value":5885},"max_batch_timeout = ",{"type":32,"tag":175,"props":5887,"children":5888},{"style":857},[5889],{"type":45,"value":5890},"10",{"type":32,"tag":175,"props":5892,"children":5893},{"style":300},[5894],{"type":45,"value":5895},"  # Wait up to 10s to fill a batch\n",{"type":32,"tag":175,"props":5897,"children":5898},{"class":177,"line":296},[5899,5904,5908],{"type":32,"tag":175,"props":5900,"children":5901},{"style":188},[5902],{"type":45,"value":5903},"max_retries = ",{"type":32,"tag":175,"props":5905,"children":5906},{"style":857},[5907],{"type":45,"value":1063},{"type":32,"tag":175,"props":5909,"children":5910},{"style":300},[5911],{"type":45,"value":5912}," # Intentionally set to 0 since the scheduler will repeatedly run the task\n",{"type":32,"tag":33,"props":5914,"children":5915},{},[5916,5918],{"type":45,"value":5917},"Add the queue message body type to: ",{"type":32,"tag":155,"props":5919,"children":5921},{"className":5920},[],[5922],{"type":45,"value":5923},"/server/types/queues.ts",{"type":32,"tag":164,"props":5925,"children":5927},{"className":166,"code":5926,"language":168,"meta":169,"style":169},"export interface AgentsPropertiesSyncQueueMessageBody {\n  agentId: string;\n}\n",[5928],{"type":32,"tag":155,"props":5929,"children":5930},{"__ignoreMap":169},[5931,5951,5971],{"type":32,"tag":175,"props":5932,"children":5933},{"class":177,"line":178},[5934,5938,5942,5947],{"type":32,"tag":175,"props":5935,"children":5936},{"style":182},[5937],{"type":45,"value":277},{"type":32,"tag":175,"props":5939,"children":5940},{"style":280},[5941],{"type":45,"value":283},{"type":32,"tag":175,"props":5943,"children":5944},{"style":286},[5945],{"type":45,"value":5946}," AgentsPropertiesSyncQueueMessageBody",{"type":32,"tag":175,"props":5948,"children":5949},{"style":188},[5950],{"type":45,"value":191},{"type":32,"tag":175,"props":5952,"children":5953},{"class":177,"line":194},[5954,5959,5963,5967],{"type":32,"tag":175,"props":5955,"children":5956},{"style":188},[5957],{"type":45,"value":5958},"  agentId",{"type":32,"tag":175,"props":5960,"children":5961},{"style":182},[5962],{"type":45,"value":68},{"type":32,"tag":175,"props":5964,"children":5965},{"style":280},[5966],{"type":45,"value":607},{"type":32,"tag":175,"props":5968,"children":5969},{"style":188},[5970],{"type":45,"value":612},{"type":32,"tag":175,"props":5972,"children":5973},{"class":177,"line":203},[5974],{"type":32,"tag":175,"props":5975,"children":5976},{"style":188},[5977],{"type":45,"value":480},{"type":32,"tag":33,"props":5979,"children":5980},{},[5981,5983,5989],{"type":45,"value":5982},"Create the ",{"type":32,"tag":155,"props":5984,"children":5986},{"className":5985},[],[5987],{"type":45,"value":5988},"/server/tasks/agents-properties-sync.ts",{"type":45,"value":5990},"  Nitro task with:",{"type":32,"tag":164,"props":5992,"children":5994},{"className":166,"code":5993,"language":168,"meta":169,"style":169},"import { CloudflareTaskContext } from '~~/server/types/queues'\nimport { drizzle } from 'drizzle-orm/d1'\nimport * as schema from '~~/server/database/schema'\nimport type { D1Database } from '@cloudflare/workers-types' // \u003C--- Removed 'Queue'\nimport { isNotNull } from 'drizzle-orm'\nimport { agents } from '~~/server/database/schema'\n\nexport default defineTask({\n  meta: {\n    name: 'agents-properties-sync',\n    description: 'Queues all agents to sync their properties from external systems',\n  },\n  async run (event) {\n    const context = event.context as CloudflareTaskContext\n    const env = context.cloudflare?.env\n\n    if (!env?.DB) {\n      return { error: 'DB binding not found.' }\n    }\n\n    // TypeScript knows this is a Queue because of your CloudflareEnv interface\n    const queue = env.AGENTS_PROPERTIES_SYNC_QUEUE\n\n    if (!queue) {\n      return { error: 'Queue binding (AGENTS_PROPERTIES_SYNC_QUEUE) not found.' }\n    }\n\n    const db = drizzle(env.DB as D1Database, { schema })\n\n    try {\n      const allAgents = await db.query.agents.findMany({\n        where: isNotNull(agents.apiRoute),\n        columns: { id: true },\n      })\n\n      if (allAgents.length === 0) {\n        return { result: 'No agents with apiRoute found in DB.' }\n      }\n\n      const total = allAgents.length\n      console.log(`[Task] Found ${total} agents. Dispatching to queue...`)\n\n      const messages = allAgents.map((agent) => ({\n        body: { agentId: agent.id },\n      }))\n\n      const CHUNK_SIZE = 10\n      for (let i = 0; i \u003C messages.length; i += CHUNK_SIZE) {\n        const batch = messages.slice(i, i + CHUNK_SIZE)\n        await queue.sendBatch(batch)\n      }\n\n      return {\n        result: `Dispatched ${total} agents to AGENTS_PROPERTIES_SYNC_QUEUE.`,\n      }\n    } catch (error: any) {\n      console.error('[Task] Error during queue dispatch:', error)\n      return { error: error.message || 'Unknown error occurred.' }\n    }\n  },\n})\n\n",[5995],{"type":32,"tag":155,"props":5996,"children":5997},{"__ignoreMap":169},[5998,6019,6038,6065,6094,6115,6135,6142,6162,6170,6187,6204,6212,6238,6269,6290,6297,6317,6339,6346,6353,6361,6382,6389,6409,6429,6436,6443,6481,6488,6500,6534,6552,6570,6577,6584,6608,6629,6636,6643,6664,6706,6713,6759,6767,6774,6781,6802,6856,6898,6920,6927,6934,6945,6979,6986,7020,7045,7070,7077,7084],{"type":32,"tag":175,"props":5999,"children":6000},{"class":177,"line":178},[6001,6005,6010,6014],{"type":32,"tag":175,"props":6002,"children":6003},{"style":182},[6004],{"type":45,"value":185},{"type":32,"tag":175,"props":6006,"children":6007},{"style":188},[6008],{"type":45,"value":6009}," { CloudflareTaskContext } ",{"type":32,"tag":175,"props":6011,"children":6012},{"style":182},[6013],{"type":45,"value":214},{"type":32,"tag":175,"props":6015,"children":6016},{"style":217},[6017],{"type":45,"value":6018}," '~~/server/types/queues'\n",{"type":32,"tag":175,"props":6020,"children":6021},{"class":177,"line":194},[6022,6026,6030,6034],{"type":32,"tag":175,"props":6023,"children":6024},{"style":182},[6025],{"type":45,"value":185},{"type":32,"tag":175,"props":6027,"children":6028},{"style":188},[6029],{"type":45,"value":4631},{"type":32,"tag":175,"props":6031,"children":6032},{"style":182},[6033],{"type":45,"value":214},{"type":32,"tag":175,"props":6035,"children":6036},{"style":217},[6037],{"type":45,"value":4640},{"type":32,"tag":175,"props":6039,"children":6040},{"class":177,"line":203},[6041,6045,6049,6053,6057,6061],{"type":32,"tag":175,"props":6042,"children":6043},{"style":182},[6044],{"type":45,"value":185},{"type":32,"tag":175,"props":6046,"children":6047},{"style":857},[6048],{"type":45,"value":4652},{"type":32,"tag":175,"props":6050,"children":6051},{"style":182},[6052],{"type":45,"value":4657},{"type":32,"tag":175,"props":6054,"children":6055},{"style":188},[6056],{"type":45,"value":4662},{"type":32,"tag":175,"props":6058,"children":6059},{"style":182},[6060],{"type":45,"value":214},{"type":32,"tag":175,"props":6062,"children":6063},{"style":217},[6064],{"type":45,"value":4671},{"type":32,"tag":175,"props":6066,"children":6067},{"class":177,"line":223},[6068,6072,6076,6080,6084,6089],{"type":32,"tag":175,"props":6069,"children":6070},{"style":182},[6071],{"type":45,"value":185},{"type":32,"tag":175,"props":6073,"children":6074},{"style":182},[6075],{"type":45,"value":1802},{"type":32,"tag":175,"props":6077,"children":6078},{"style":188},[6079],{"type":45,"value":4687},{"type":32,"tag":175,"props":6081,"children":6082},{"style":182},[6083],{"type":45,"value":214},{"type":32,"tag":175,"props":6085,"children":6086},{"style":217},[6087],{"type":45,"value":6088}," '@cloudflare/workers-types'",{"type":32,"tag":175,"props":6090,"children":6091},{"style":300},[6092],{"type":45,"value":6093}," // \u003C--- Removed 'Queue'\n",{"type":32,"tag":175,"props":6095,"children":6096},{"class":177,"line":235},[6097,6101,6106,6110],{"type":32,"tag":175,"props":6098,"children":6099},{"style":182},[6100],{"type":45,"value":185},{"type":32,"tag":175,"props":6102,"children":6103},{"style":188},[6104],{"type":45,"value":6105}," { isNotNull } ",{"type":32,"tag":175,"props":6107,"children":6108},{"style":182},[6109],{"type":45,"value":214},{"type":32,"tag":175,"props":6111,"children":6112},{"style":217},[6113],{"type":45,"value":6114}," 'drizzle-orm'\n",{"type":32,"tag":175,"props":6116,"children":6117},{"class":177,"line":244},[6118,6122,6127,6131],{"type":32,"tag":175,"props":6119,"children":6120},{"style":182},[6121],{"type":45,"value":185},{"type":32,"tag":175,"props":6123,"children":6124},{"style":188},[6125],{"type":45,"value":6126}," { agents } ",{"type":32,"tag":175,"props":6128,"children":6129},{"style":182},[6130],{"type":45,"value":214},{"type":32,"tag":175,"props":6132,"children":6133},{"style":217},[6134],{"type":45,"value":4671},{"type":32,"tag":175,"props":6136,"children":6137},{"class":177,"line":261},[6138],{"type":32,"tag":175,"props":6139,"children":6140},{"emptyLinePlaceholder":265},[6141],{"type":45,"value":268},{"type":32,"tag":175,"props":6143,"children":6144},{"class":177,"line":271},[6145,6149,6153,6158],{"type":32,"tag":175,"props":6146,"children":6147},{"style":182},[6148],{"type":45,"value":277},{"type":32,"tag":175,"props":6150,"children":6151},{"style":182},[6152],{"type":45,"value":4054},{"type":32,"tag":175,"props":6154,"children":6155},{"style":391},[6156],{"type":45,"value":6157}," defineTask",{"type":32,"tag":175,"props":6159,"children":6160},{"style":188},[6161],{"type":45,"value":5555},{"type":32,"tag":175,"props":6163,"children":6164},{"class":177,"line":296},[6165],{"type":32,"tag":175,"props":6166,"children":6167},{"style":188},[6168],{"type":45,"value":6169},"  meta: {\n",{"type":32,"tag":175,"props":6171,"children":6172},{"class":177,"line":306},[6173,6178,6183],{"type":32,"tag":175,"props":6174,"children":6175},{"style":188},[6176],{"type":45,"value":6177},"    name: ",{"type":32,"tag":175,"props":6179,"children":6180},{"style":217},[6181],{"type":45,"value":6182},"'agents-properties-sync'",{"type":32,"tag":175,"props":6184,"children":6185},{"style":188},[6186],{"type":45,"value":673},{"type":32,"tag":175,"props":6188,"children":6189},{"class":177,"line":315},[6190,6195,6200],{"type":32,"tag":175,"props":6191,"children":6192},{"style":188},[6193],{"type":45,"value":6194},"    description: ",{"type":32,"tag":175,"props":6196,"children":6197},{"style":217},[6198],{"type":45,"value":6199},"'Queues all agents to sync their properties from external systems'",{"type":32,"tag":175,"props":6201,"children":6202},{"style":188},[6203],{"type":45,"value":673},{"type":32,"tag":175,"props":6205,"children":6206},{"class":177,"line":324},[6207],{"type":32,"tag":175,"props":6208,"children":6209},{"style":188},[6210],{"type":45,"value":6211},"  },\n",{"type":32,"tag":175,"props":6213,"children":6214},{"class":177,"line":343},[6215,6220,6225,6229,6233],{"type":32,"tag":175,"props":6216,"children":6217},{"style":182},[6218],{"type":45,"value":6219},"  async",{"type":32,"tag":175,"props":6221,"children":6222},{"style":391},[6223],{"type":45,"value":6224}," run",{"type":32,"tag":175,"props":6226,"children":6227},{"style":188},[6228],{"type":45,"value":1090},{"type":32,"tag":175,"props":6230,"children":6231},{"style":406},[6232],{"type":45,"value":4077},{"type":32,"tag":175,"props":6234,"children":6235},{"style":188},[6236],{"type":45,"value":6237},") {\n",{"type":32,"tag":175,"props":6239,"children":6240},{"class":177,"line":361},[6241,6245,6250,6254,6259,6264],{"type":32,"tag":175,"props":6242,"children":6243},{"style":280},[6244],{"type":45,"value":1471},{"type":32,"tag":175,"props":6246,"children":6247},{"style":188},[6248],{"type":45,"value":6249}," context ",{"type":32,"tag":175,"props":6251,"children":6252},{"style":182},[6253],{"type":45,"value":854},{"type":32,"tag":175,"props":6255,"children":6256},{"style":188},[6257],{"type":45,"value":6258}," event.context ",{"type":32,"tag":175,"props":6260,"children":6261},{"style":182},[6262],{"type":45,"value":6263},"as",{"type":32,"tag":175,"props":6265,"children":6266},{"style":286},[6267],{"type":45,"value":6268}," CloudflareTaskContext\n",{"type":32,"tag":175,"props":6270,"children":6271},{"class":177,"line":378},[6272,6276,6281,6285],{"type":32,"tag":175,"props":6273,"children":6274},{"style":280},[6275],{"type":45,"value":1471},{"type":32,"tag":175,"props":6277,"children":6278},{"style":188},[6279],{"type":45,"value":6280}," env ",{"type":32,"tag":175,"props":6282,"children":6283},{"style":182},[6284],{"type":45,"value":854},{"type":32,"tag":175,"props":6286,"children":6287},{"style":188},[6288],{"type":45,"value":6289}," context.cloudflare?.env\n",{"type":32,"tag":175,"props":6291,"children":6292},{"class":177,"line":387},[6293],{"type":32,"tag":175,"props":6294,"children":6295},{"emptyLinePlaceholder":265},[6296],{"type":45,"value":268},{"type":32,"tag":175,"props":6298,"children":6299},{"class":177,"line":402},[6300,6304,6308,6312],{"type":32,"tag":175,"props":6301,"children":6302},{"style":182},[6303],{"type":45,"value":950},{"type":32,"tag":175,"props":6305,"children":6306},{"style":188},[6307],{"type":45,"value":1090},{"type":32,"tag":175,"props":6309,"children":6310},{"style":182},[6311],{"type":45,"value":1095},{"type":32,"tag":175,"props":6313,"children":6314},{"style":188},[6315],{"type":45,"value":6316},"env?.DB) {\n",{"type":32,"tag":175,"props":6318,"children":6319},{"class":177,"line":441},[6320,6324,6329,6334],{"type":32,"tag":175,"props":6321,"children":6322},{"style":182},[6323],{"type":45,"value":1229},{"type":32,"tag":175,"props":6325,"children":6326},{"style":188},[6327],{"type":45,"value":6328}," { error: ",{"type":32,"tag":175,"props":6330,"children":6331},{"style":217},[6332],{"type":45,"value":6333},"'DB binding not found.'",{"type":32,"tag":175,"props":6335,"children":6336},{"style":188},[6337],{"type":45,"value":6338}," }\n",{"type":32,"tag":175,"props":6340,"children":6341},{"class":177,"line":474},[6342],{"type":32,"tag":175,"props":6343,"children":6344},{"style":188},[6345],{"type":45,"value":1363},{"type":32,"tag":175,"props":6347,"children":6348},{"class":177,"line":1039},[6349],{"type":32,"tag":175,"props":6350,"children":6351},{"emptyLinePlaceholder":265},[6352],{"type":45,"value":268},{"type":32,"tag":175,"props":6354,"children":6355},{"class":177,"line":1071},[6356],{"type":32,"tag":175,"props":6357,"children":6358},{"style":300},[6359],{"type":45,"value":6360},"    // TypeScript knows this is a Queue because of your CloudflareEnv interface\n",{"type":32,"tag":175,"props":6362,"children":6363},{"class":177,"line":1079},[6364,6368,6373,6377],{"type":32,"tag":175,"props":6365,"children":6366},{"style":280},[6367],{"type":45,"value":1471},{"type":32,"tag":175,"props":6369,"children":6370},{"style":188},[6371],{"type":45,"value":6372}," queue ",{"type":32,"tag":175,"props":6374,"children":6375},{"style":182},[6376],{"type":45,"value":854},{"type":32,"tag":175,"props":6378,"children":6379},{"style":188},[6380],{"type":45,"value":6381}," env.AGENTS_PROPERTIES_SYNC_QUEUE\n",{"type":32,"tag":175,"props":6383,"children":6384},{"class":177,"line":1113},[6385],{"type":32,"tag":175,"props":6386,"children":6387},{"emptyLinePlaceholder":265},[6388],{"type":45,"value":268},{"type":32,"tag":175,"props":6390,"children":6391},{"class":177,"line":1121},[6392,6396,6400,6404],{"type":32,"tag":175,"props":6393,"children":6394},{"style":182},[6395],{"type":45,"value":950},{"type":32,"tag":175,"props":6397,"children":6398},{"style":188},[6399],{"type":45,"value":1090},{"type":32,"tag":175,"props":6401,"children":6402},{"style":182},[6403],{"type":45,"value":1095},{"type":32,"tag":175,"props":6405,"children":6406},{"style":188},[6407],{"type":45,"value":6408},"queue) {\n",{"type":32,"tag":175,"props":6410,"children":6411},{"class":177,"line":1130},[6412,6416,6420,6425],{"type":32,"tag":175,"props":6413,"children":6414},{"style":182},[6415],{"type":45,"value":1229},{"type":32,"tag":175,"props":6417,"children":6418},{"style":188},[6419],{"type":45,"value":6328},{"type":32,"tag":175,"props":6421,"children":6422},{"style":217},[6423],{"type":45,"value":6424},"'Queue binding (AGENTS_PROPERTIES_SYNC_QUEUE) not found.'",{"type":32,"tag":175,"props":6426,"children":6427},{"style":188},[6428],{"type":45,"value":6338},{"type":32,"tag":175,"props":6430,"children":6431},{"class":177,"line":1170},[6432],{"type":32,"tag":175,"props":6433,"children":6434},{"style":188},[6435],{"type":45,"value":1363},{"type":32,"tag":175,"props":6437,"children":6438},{"class":177,"line":1179},[6439],{"type":32,"tag":175,"props":6440,"children":6441},{"emptyLinePlaceholder":265},[6442],{"type":45,"value":268},{"type":32,"tag":175,"props":6444,"children":6445},{"class":177,"line":1197},[6446,6450,6455,6459,6463,6468,6472,6476],{"type":32,"tag":175,"props":6447,"children":6448},{"style":280},[6449],{"type":45,"value":1471},{"type":32,"tag":175,"props":6451,"children":6452},{"style":188},[6453],{"type":45,"value":6454}," db ",{"type":32,"tag":175,"props":6456,"children":6457},{"style":182},[6458],{"type":45,"value":854},{"type":32,"tag":175,"props":6460,"children":6461},{"style":391},[6462],{"type":45,"value":4913},{"type":32,"tag":175,"props":6464,"children":6465},{"style":188},[6466],{"type":45,"value":6467},"(env.DB ",{"type":32,"tag":175,"props":6469,"children":6470},{"style":182},[6471],{"type":45,"value":6263},{"type":32,"tag":175,"props":6473,"children":6474},{"style":286},[6475],{"type":45,"value":4872},{"type":32,"tag":175,"props":6477,"children":6478},{"style":188},[6479],{"type":45,"value":6480},", { schema })\n",{"type":32,"tag":175,"props":6482,"children":6483},{"class":177,"line":1206},[6484],{"type":32,"tag":175,"props":6485,"children":6486},{"emptyLinePlaceholder":265},[6487],{"type":45,"value":268},{"type":32,"tag":175,"props":6489,"children":6490},{"class":177,"line":1214},[6491,6496],{"type":32,"tag":175,"props":6492,"children":6493},{"style":182},[6494],{"type":45,"value":6495},"    try",{"type":32,"tag":175,"props":6497,"children":6498},{"style":188},[6499],{"type":45,"value":191},{"type":32,"tag":175,"props":6501,"children":6502},{"class":177,"line":1223},[6503,6507,6512,6516,6520,6525,6530],{"type":32,"tag":175,"props":6504,"children":6505},{"style":280},[6506],{"type":45,"value":1004},{"type":32,"tag":175,"props":6508,"children":6509},{"style":188},[6510],{"type":45,"value":6511}," allAgents ",{"type":32,"tag":175,"props":6513,"children":6514},{"style":182},[6515],{"type":45,"value":854},{"type":32,"tag":175,"props":6517,"children":6518},{"style":182},[6519],{"type":45,"value":1018},{"type":32,"tag":175,"props":6521,"children":6522},{"style":188},[6523],{"type":45,"value":6524}," db.query.agents.",{"type":32,"tag":175,"props":6526,"children":6527},{"style":391},[6528],{"type":45,"value":6529},"findMany",{"type":32,"tag":175,"props":6531,"children":6532},{"style":188},[6533],{"type":45,"value":5555},{"type":32,"tag":175,"props":6535,"children":6536},{"class":177,"line":1267},[6537,6542,6547],{"type":32,"tag":175,"props":6538,"children":6539},{"style":188},[6540],{"type":45,"value":6541},"        where: ",{"type":32,"tag":175,"props":6543,"children":6544},{"style":391},[6545],{"type":45,"value":6546},"isNotNull",{"type":32,"tag":175,"props":6548,"children":6549},{"style":188},[6550],{"type":45,"value":6551},"(agents.apiRoute),\n",{"type":32,"tag":175,"props":6553,"children":6554},{"class":177,"line":1276},[6555,6560,6565],{"type":32,"tag":175,"props":6556,"children":6557},{"style":188},[6558],{"type":45,"value":6559},"        columns: { id: ",{"type":32,"tag":175,"props":6561,"children":6562},{"style":857},[6563],{"type":45,"value":6564},"true",{"type":32,"tag":175,"props":6566,"children":6567},{"style":188},[6568],{"type":45,"value":6569}," },\n",{"type":32,"tag":175,"props":6571,"children":6572},{"class":177,"line":1285},[6573],{"type":32,"tag":175,"props":6574,"children":6575},{"style":188},[6576],{"type":45,"value":1203},{"type":32,"tag":175,"props":6578,"children":6579},{"class":177,"line":1294},[6580],{"type":32,"tag":175,"props":6581,"children":6582},{"emptyLinePlaceholder":265},[6583],{"type":45,"value":268},{"type":32,"tag":175,"props":6585,"children":6586},{"class":177,"line":1302},[6587,6591,6596,6600,6604],{"type":32,"tag":175,"props":6588,"children":6589},{"style":182},[6590],{"type":45,"value":1085},{"type":32,"tag":175,"props":6592,"children":6593},{"style":188},[6594],{"type":45,"value":6595}," (allAgents.length ",{"type":32,"tag":175,"props":6597,"children":6598},{"style":182},[6599],{"type":45,"value":2490},{"type":32,"tag":175,"props":6601,"children":6602},{"style":857},[6603],{"type":45,"value":1664},{"type":32,"tag":175,"props":6605,"children":6606},{"style":188},[6607],{"type":45,"value":6237},{"type":32,"tag":175,"props":6609,"children":6610},{"class":177,"line":1311},[6611,6615,6620,6625],{"type":32,"tag":175,"props":6612,"children":6613},{"style":182},[6614],{"type":45,"value":2530},{"type":32,"tag":175,"props":6616,"children":6617},{"style":188},[6618],{"type":45,"value":6619}," { result: ",{"type":32,"tag":175,"props":6621,"children":6622},{"style":217},[6623],{"type":45,"value":6624},"'No agents with apiRoute found in DB.'",{"type":32,"tag":175,"props":6626,"children":6627},{"style":188},[6628],{"type":45,"value":6338},{"type":32,"tag":175,"props":6630,"children":6631},{"class":177,"line":1348},[6632],{"type":32,"tag":175,"props":6633,"children":6634},{"style":188},[6635],{"type":45,"value":2543},{"type":32,"tag":175,"props":6637,"children":6638},{"class":177,"line":1357},[6639],{"type":32,"tag":175,"props":6640,"children":6641},{"emptyLinePlaceholder":265},[6642],{"type":45,"value":268},{"type":32,"tag":175,"props":6644,"children":6645},{"class":177,"line":1366},[6646,6650,6655,6659],{"type":32,"tag":175,"props":6647,"children":6648},{"style":280},[6649],{"type":45,"value":1004},{"type":32,"tag":175,"props":6651,"children":6652},{"style":188},[6653],{"type":45,"value":6654}," total ",{"type":32,"tag":175,"props":6656,"children":6657},{"style":182},[6658],{"type":45,"value":854},{"type":32,"tag":175,"props":6660,"children":6661},{"style":188},[6662],{"type":45,"value":6663}," allAgents.length\n",{"type":32,"tag":175,"props":6665,"children":6666},{"class":177,"line":1375},[6667,6671,6675,6679,6684,6688,6693,6697,6702],{"type":32,"tag":175,"props":6668,"children":6669},{"style":188},[6670],{"type":45,"value":1317},{"type":32,"tag":175,"props":6672,"children":6673},{"style":391},[6674],{"type":45,"value":5645},{"type":32,"tag":175,"props":6676,"children":6677},{"style":188},[6678],{"type":45,"value":1327},{"type":32,"tag":175,"props":6680,"children":6681},{"style":217},[6682],{"type":45,"value":6683},"`[Task] Found ",{"type":32,"tag":175,"props":6685,"children":6686},{"style":182},[6687],{"type":45,"value":4415},{"type":32,"tag":175,"props":6689,"children":6690},{"style":188},[6691],{"type":45,"value":6692},"total",{"type":32,"tag":175,"props":6694,"children":6695},{"style":182},[6696],{"type":45,"value":4425},{"type":32,"tag":175,"props":6698,"children":6699},{"style":217},[6700],{"type":45,"value":6701}," agents. Dispatching to queue...`",{"type":32,"tag":175,"props":6703,"children":6704},{"style":188},[6705],{"type":45,"value":1345},{"type":32,"tag":175,"props":6707,"children":6708},{"class":177,"line":1384},[6709],{"type":32,"tag":175,"props":6710,"children":6711},{"emptyLinePlaceholder":265},[6712],{"type":45,"value":268},{"type":32,"tag":175,"props":6714,"children":6715},{"class":177,"line":1393},[6716,6720,6725,6729,6734,6738,6742,6747,6751,6755],{"type":32,"tag":175,"props":6717,"children":6718},{"style":280},[6719],{"type":45,"value":1004},{"type":32,"tag":175,"props":6721,"children":6722},{"style":188},[6723],{"type":45,"value":6724}," messages ",{"type":32,"tag":175,"props":6726,"children":6727},{"style":182},[6728],{"type":45,"value":854},{"type":32,"tag":175,"props":6730,"children":6731},{"style":188},[6732],{"type":45,"value":6733}," allAgents.",{"type":32,"tag":175,"props":6735,"children":6736},{"style":391},[6737],{"type":45,"value":1239},{"type":32,"tag":175,"props":6739,"children":6740},{"style":188},[6741],{"type":45,"value":1244},{"type":32,"tag":175,"props":6743,"children":6744},{"style":406},[6745],{"type":45,"value":6746},"agent",{"type":32,"tag":175,"props":6748,"children":6749},{"style":188},[6750],{"type":45,"value":1254},{"type":32,"tag":175,"props":6752,"children":6753},{"style":280},[6754],{"type":45,"value":1259},{"type":32,"tag":175,"props":6756,"children":6757},{"style":188},[6758],{"type":45,"value":1264},{"type":32,"tag":175,"props":6760,"children":6761},{"class":177,"line":1402},[6762],{"type":32,"tag":175,"props":6763,"children":6764},{"style":188},[6765],{"type":45,"value":6766},"        body: { agentId: agent.id },\n",{"type":32,"tag":175,"props":6768,"children":6769},{"class":177,"line":1410},[6770],{"type":32,"tag":175,"props":6771,"children":6772},{"style":188},[6773],{"type":45,"value":1291},{"type":32,"tag":175,"props":6775,"children":6776},{"class":177,"line":1426},[6777],{"type":32,"tag":175,"props":6778,"children":6779},{"emptyLinePlaceholder":265},[6780],{"type":45,"value":268},{"type":32,"tag":175,"props":6782,"children":6783},{"class":177,"line":1439},[6784,6788,6793,6797],{"type":32,"tag":175,"props":6785,"children":6786},{"style":280},[6787],{"type":45,"value":1004},{"type":32,"tag":175,"props":6789,"children":6790},{"style":188},[6791],{"type":45,"value":6792}," CHUNK_SIZE ",{"type":32,"tag":175,"props":6794,"children":6795},{"style":182},[6796],{"type":45,"value":854},{"type":32,"tag":175,"props":6798,"children":6799},{"style":857},[6800],{"type":45,"value":6801}," 10\n",{"type":32,"tag":175,"props":6803,"children":6804},{"class":177,"line":1447},[6805,6810,6814,6819,6824,6828,6832,6837,6841,6846,6851],{"type":32,"tag":175,"props":6806,"children":6807},{"style":182},[6808],{"type":45,"value":6809},"      for",{"type":32,"tag":175,"props":6811,"children":6812},{"style":188},[6813],{"type":45,"value":1090},{"type":32,"tag":175,"props":6815,"children":6816},{"style":280},[6817],{"type":45,"value":6818},"let",{"type":32,"tag":175,"props":6820,"children":6821},{"style":188},[6822],{"type":45,"value":6823}," i ",{"type":32,"tag":175,"props":6825,"children":6826},{"style":182},[6827],{"type":45,"value":854},{"type":32,"tag":175,"props":6829,"children":6830},{"style":857},[6831],{"type":45,"value":1664},{"type":32,"tag":175,"props":6833,"children":6834},{"style":188},[6835],{"type":45,"value":6836},"; i ",{"type":32,"tag":175,"props":6838,"children":6839},{"style":182},[6840],{"type":45,"value":461},{"type":32,"tag":175,"props":6842,"children":6843},{"style":188},[6844],{"type":45,"value":6845}," messages.length; i ",{"type":32,"tag":175,"props":6847,"children":6848},{"style":182},[6849],{"type":45,"value":6850},"+=",{"type":32,"tag":175,"props":6852,"children":6853},{"style":188},[6854],{"type":45,"value":6855}," CHUNK_SIZE) {\n",{"type":32,"tag":175,"props":6857,"children":6858},{"class":177,"line":1465},[6859,6864,6869,6873,6878,6883,6888,6893],{"type":32,"tag":175,"props":6860,"children":6861},{"style":280},[6862],{"type":45,"value":6863},"        const",{"type":32,"tag":175,"props":6865,"children":6866},{"style":188},[6867],{"type":45,"value":6868}," batch ",{"type":32,"tag":175,"props":6870,"children":6871},{"style":182},[6872],{"type":45,"value":854},{"type":32,"tag":175,"props":6874,"children":6875},{"style":188},[6876],{"type":45,"value":6877}," messages.",{"type":32,"tag":175,"props":6879,"children":6880},{"style":391},[6881],{"type":45,"value":6882},"slice",{"type":32,"tag":175,"props":6884,"children":6885},{"style":188},[6886],{"type":45,"value":6887},"(i, i ",{"type":32,"tag":175,"props":6889,"children":6890},{"style":182},[6891],{"type":45,"value":6892},"+",{"type":32,"tag":175,"props":6894,"children":6895},{"style":188},[6896],{"type":45,"value":6897}," CHUNK_SIZE)\n",{"type":32,"tag":175,"props":6899,"children":6900},{"class":177,"line":1501},[6901,6905,6910,6915],{"type":32,"tag":175,"props":6902,"children":6903},{"style":182},[6904],{"type":45,"value":5526},{"type":32,"tag":175,"props":6906,"children":6907},{"style":188},[6908],{"type":45,"value":6909}," queue.",{"type":32,"tag":175,"props":6911,"children":6912},{"style":391},[6913],{"type":45,"value":6914},"sendBatch",{"type":32,"tag":175,"props":6916,"children":6917},{"style":188},[6918],{"type":45,"value":6919},"(batch)\n",{"type":32,"tag":175,"props":6921,"children":6922},{"class":177,"line":1510},[6923],{"type":32,"tag":175,"props":6924,"children":6925},{"style":188},[6926],{"type":45,"value":2543},{"type":32,"tag":175,"props":6928,"children":6929},{"class":177,"line":1533},[6930],{"type":32,"tag":175,"props":6931,"children":6932},{"emptyLinePlaceholder":265},[6933],{"type":45,"value":268},{"type":32,"tag":175,"props":6935,"children":6936},{"class":177,"line":1554},[6937,6941],{"type":32,"tag":175,"props":6938,"children":6939},{"style":182},[6940],{"type":45,"value":1229},{"type":32,"tag":175,"props":6942,"children":6943},{"style":188},[6944],{"type":45,"value":191},{"type":32,"tag":175,"props":6946,"children":6947},{"class":177,"line":1575},[6948,6953,6958,6962,6966,6970,6975],{"type":32,"tag":175,"props":6949,"children":6950},{"style":188},[6951],{"type":45,"value":6952},"        result: ",{"type":32,"tag":175,"props":6954,"children":6955},{"style":217},[6956],{"type":45,"value":6957},"`Dispatched ",{"type":32,"tag":175,"props":6959,"children":6960},{"style":182},[6961],{"type":45,"value":4415},{"type":32,"tag":175,"props":6963,"children":6964},{"style":188},[6965],{"type":45,"value":6692},{"type":32,"tag":175,"props":6967,"children":6968},{"style":182},[6969],{"type":45,"value":4425},{"type":32,"tag":175,"props":6971,"children":6972},{"style":217},[6973],{"type":45,"value":6974}," agents to AGENTS_PROPERTIES_SYNC_QUEUE.`",{"type":32,"tag":175,"props":6976,"children":6977},{"style":188},[6978],{"type":45,"value":673},{"type":32,"tag":175,"props":6980,"children":6981},{"class":177,"line":1584},[6982],{"type":32,"tag":175,"props":6983,"children":6984},{"style":188},[6985],{"type":45,"value":2543},{"type":32,"tag":175,"props":6987,"children":6988},{"class":177,"line":1592},[6989,6994,6999,7003,7007,7011,7016],{"type":32,"tag":175,"props":6990,"children":6991},{"style":188},[6992],{"type":45,"value":6993},"    } ",{"type":32,"tag":175,"props":6995,"children":6996},{"style":182},[6997],{"type":45,"value":6998},"catch",{"type":32,"tag":175,"props":7000,"children":7001},{"style":188},[7002],{"type":45,"value":1090},{"type":32,"tag":175,"props":7004,"children":7005},{"style":406},[7006],{"type":45,"value":1322},{"type":32,"tag":175,"props":7008,"children":7009},{"style":182},[7010],{"type":45,"value":68},{"type":32,"tag":175,"props":7012,"children":7013},{"style":280},[7014],{"type":45,"value":7015}," any",{"type":32,"tag":175,"props":7017,"children":7018},{"style":188},[7019],{"type":45,"value":6237},{"type":32,"tag":175,"props":7021,"children":7022},{"class":177,"line":1606},[7023,7027,7031,7035,7040],{"type":32,"tag":175,"props":7024,"children":7025},{"style":188},[7026],{"type":45,"value":1317},{"type":32,"tag":175,"props":7028,"children":7029},{"style":391},[7030],{"type":45,"value":1322},{"type":32,"tag":175,"props":7032,"children":7033},{"style":188},[7034],{"type":45,"value":1327},{"type":32,"tag":175,"props":7036,"children":7037},{"style":217},[7038],{"type":45,"value":7039},"'[Task] Error during queue dispatch:'",{"type":32,"tag":175,"props":7041,"children":7042},{"style":188},[7043],{"type":45,"value":7044},", error)\n",{"type":32,"tag":175,"props":7046,"children":7047},{"class":177,"line":1671},[7048,7052,7057,7061,7066],{"type":32,"tag":175,"props":7049,"children":7050},{"style":182},[7051],{"type":45,"value":1229},{"type":32,"tag":175,"props":7053,"children":7054},{"style":188},[7055],{"type":45,"value":7056}," { error: error.message ",{"type":32,"tag":175,"props":7058,"children":7059},{"style":182},[7060],{"type":45,"value":3763},{"type":32,"tag":175,"props":7062,"children":7063},{"style":217},[7064],{"type":45,"value":7065}," 'Unknown error occurred.'",{"type":32,"tag":175,"props":7067,"children":7068},{"style":188},[7069],{"type":45,"value":6338},{"type":32,"tag":175,"props":7071,"children":7072},{"class":177,"line":1697},[7073],{"type":32,"tag":175,"props":7074,"children":7075},{"style":188},[7076],{"type":45,"value":1363},{"type":32,"tag":175,"props":7078,"children":7079},{"class":177,"line":1714},[7080],{"type":32,"tag":175,"props":7081,"children":7082},{"style":188},[7083],{"type":45,"value":6211},{"type":32,"tag":175,"props":7085,"children":7086},{"class":177,"line":2593},[7087],{"type":32,"tag":175,"props":7088,"children":7089},{"style":188},[7090],{"type":45,"value":4469},{"type":32,"tag":33,"props":7092,"children":7093},{},[7094,7095,7101],{"type":45,"value":5982},{"type":32,"tag":155,"props":7096,"children":7098},{"className":7097},[],[7099],{"type":45,"value":7100},"server/utils/queueHandlers/AgentsPropertiesSyncQueueHandler.ts",{"type":45,"value":7102}," handler class with:",{"type":32,"tag":164,"props":7104,"children":7106},{"className":166,"code":7105,"language":168,"meta":169,"style":169},"import {\n  SyncAgentPropertiesService,\n} from '~~/server/utils/services/propertySync/SyncAgentPropertiesService'\nimport { MessageBatch, D1Database } from '@cloudflare/workers-types'\nimport {\n  AgentsPropertiesSyncQueueMessageBody,\n  CloudflareEnv,\n} from '~~/server/types/queues'\nimport * as schema from '~~/server/database/schema'\nimport { drizzle } from 'drizzle-orm/d1'\nimport { inArray } from 'drizzle-orm'\nimport { AgentWithProperties } from '~~/server/database/types'\n\nexport class AgentsPropertiesSyncQueueHandler {\n\n  public constructor (\n    private readonly syncAgentPropertiesService: SyncAgentPropertiesService,\n  ) {}\n\n  public async handle (\n    batch: MessageBatch\u003CAgentsPropertiesSyncQueueMessageBody>,\n    env: CloudflareEnv,\n  ): Promise\u003Cvoid> {\n\n    const messages = batch.messages\n    const db = drizzle(env.DB as D1Database, { schema })\n\n    const agentIds = new Set\u003Cstring>()\n    for (const message of messages) {\n      if (message.body?.agentId) {\n        agentIds.add(message.body.agentId)\n      }\n    }\n\n    if (agentIds.size === 0) {\n      console.log('[Agents Properties Sync Handler] No valid agentIds found in batch.')\n      return\n    }\n\n    try {\n      const ids = Array.from(agentIds)\n      const agentsToSync: AgentWithProperties[] = await db.query.agents.findMany({\n        where: inArray(schema.agents.id, ids),\n        with: {\n          properties: true,\n        }\n      })\n\n      for (const agent of agentsToSync) {\n        await this.syncAgentPropertiesService.execute(agent)\n\n        console.log(\n          `[Agents Properties Sync Handler] Successfully synced properties for agent \"${agent.id}\".`,\n        )\n      }\n\n    } catch (error: any) {\n      console.error('[Agents Properties Sync Handler] Error:', error.message);\n      throw error;\n    }\n  }\n}\n\n",[7107],{"type":32,"tag":155,"props":7108,"children":7109},{"__ignoreMap":169},[7110,7121,7129,7145,7165,7176,7184,7192,7207,7234,7253,7273,7293,7300,7320,7327,7342,7370,7377,7384,7404,7435,7456,7483,7490,7510,7545,7552,7590,7619,7631,7649,7656,7663,7670,7694,7718,7726,7733,7740,7751,7781,7825,7842,7850,7866,7874,7881,7888,7917,7943,7950,7965,7994,8002,8009,8016,8047,8072,8084,8091,8098],{"type":32,"tag":175,"props":7111,"children":7112},{"class":177,"line":178},[7113,7117],{"type":32,"tag":175,"props":7114,"children":7115},{"style":182},[7116],{"type":45,"value":185},{"type":32,"tag":175,"props":7118,"children":7119},{"style":188},[7120],{"type":45,"value":191},{"type":32,"tag":175,"props":7122,"children":7123},{"class":177,"line":194},[7124],{"type":32,"tag":175,"props":7125,"children":7126},{"style":188},[7127],{"type":45,"value":7128},"  SyncAgentPropertiesService,\n",{"type":32,"tag":175,"props":7130,"children":7131},{"class":177,"line":203},[7132,7136,7140],{"type":32,"tag":175,"props":7133,"children":7134},{"style":188},[7135],{"type":45,"value":209},{"type":32,"tag":175,"props":7137,"children":7138},{"style":182},[7139],{"type":45,"value":214},{"type":32,"tag":175,"props":7141,"children":7142},{"style":217},[7143],{"type":45,"value":7144}," '~~/server/utils/services/propertySync/SyncAgentPropertiesService'\n",{"type":32,"tag":175,"props":7146,"children":7147},{"class":177,"line":223},[7148,7152,7157,7161],{"type":32,"tag":175,"props":7149,"children":7150},{"style":182},[7151],{"type":45,"value":185},{"type":32,"tag":175,"props":7153,"children":7154},{"style":188},[7155],{"type":45,"value":7156}," { MessageBatch, D1Database } ",{"type":32,"tag":175,"props":7158,"children":7159},{"style":182},[7160],{"type":45,"value":214},{"type":32,"tag":175,"props":7162,"children":7163},{"style":217},[7164],{"type":45,"value":4696},{"type":32,"tag":175,"props":7166,"children":7167},{"class":177,"line":235},[7168,7172],{"type":32,"tag":175,"props":7169,"children":7170},{"style":182},[7171],{"type":45,"value":185},{"type":32,"tag":175,"props":7173,"children":7174},{"style":188},[7175],{"type":45,"value":191},{"type":32,"tag":175,"props":7177,"children":7178},{"class":177,"line":244},[7179],{"type":32,"tag":175,"props":7180,"children":7181},{"style":188},[7182],{"type":45,"value":7183},"  AgentsPropertiesSyncQueueMessageBody,\n",{"type":32,"tag":175,"props":7185,"children":7186},{"class":177,"line":261},[7187],{"type":32,"tag":175,"props":7188,"children":7189},{"style":188},[7190],{"type":45,"value":7191},"  CloudflareEnv,\n",{"type":32,"tag":175,"props":7193,"children":7194},{"class":177,"line":271},[7195,7199,7203],{"type":32,"tag":175,"props":7196,"children":7197},{"style":188},[7198],{"type":45,"value":209},{"type":32,"tag":175,"props":7200,"children":7201},{"style":182},[7202],{"type":45,"value":214},{"type":32,"tag":175,"props":7204,"children":7205},{"style":217},[7206],{"type":45,"value":6018},{"type":32,"tag":175,"props":7208,"children":7209},{"class":177,"line":296},[7210,7214,7218,7222,7226,7230],{"type":32,"tag":175,"props":7211,"children":7212},{"style":182},[7213],{"type":45,"value":185},{"type":32,"tag":175,"props":7215,"children":7216},{"style":857},[7217],{"type":45,"value":4652},{"type":32,"tag":175,"props":7219,"children":7220},{"style":182},[7221],{"type":45,"value":4657},{"type":32,"tag":175,"props":7223,"children":7224},{"style":188},[7225],{"type":45,"value":4662},{"type":32,"tag":175,"props":7227,"children":7228},{"style":182},[7229],{"type":45,"value":214},{"type":32,"tag":175,"props":7231,"children":7232},{"style":217},[7233],{"type":45,"value":4671},{"type":32,"tag":175,"props":7235,"children":7236},{"class":177,"line":306},[7237,7241,7245,7249],{"type":32,"tag":175,"props":7238,"children":7239},{"style":182},[7240],{"type":45,"value":185},{"type":32,"tag":175,"props":7242,"children":7243},{"style":188},[7244],{"type":45,"value":4631},{"type":32,"tag":175,"props":7246,"children":7247},{"style":182},[7248],{"type":45,"value":214},{"type":32,"tag":175,"props":7250,"children":7251},{"style":217},[7252],{"type":45,"value":4640},{"type":32,"tag":175,"props":7254,"children":7255},{"class":177,"line":315},[7256,7260,7265,7269],{"type":32,"tag":175,"props":7257,"children":7258},{"style":182},[7259],{"type":45,"value":185},{"type":32,"tag":175,"props":7261,"children":7262},{"style":188},[7263],{"type":45,"value":7264}," { inArray } ",{"type":32,"tag":175,"props":7266,"children":7267},{"style":182},[7268],{"type":45,"value":214},{"type":32,"tag":175,"props":7270,"children":7271},{"style":217},[7272],{"type":45,"value":6114},{"type":32,"tag":175,"props":7274,"children":7275},{"class":177,"line":324},[7276,7280,7285,7289],{"type":32,"tag":175,"props":7277,"children":7278},{"style":182},[7279],{"type":45,"value":185},{"type":32,"tag":175,"props":7281,"children":7282},{"style":188},[7283],{"type":45,"value":7284}," { AgentWithProperties } ",{"type":32,"tag":175,"props":7286,"children":7287},{"style":182},[7288],{"type":45,"value":214},{"type":32,"tag":175,"props":7290,"children":7291},{"style":217},[7292],{"type":45,"value":1816},{"type":32,"tag":175,"props":7294,"children":7295},{"class":177,"line":343},[7296],{"type":32,"tag":175,"props":7297,"children":7298},{"emptyLinePlaceholder":265},[7299],{"type":45,"value":268},{"type":32,"tag":175,"props":7301,"children":7302},{"class":177,"line":361},[7303,7307,7311,7316],{"type":32,"tag":175,"props":7304,"children":7305},{"style":182},[7306],{"type":45,"value":277},{"type":32,"tag":175,"props":7308,"children":7309},{"style":280},[7310],{"type":45,"value":1964},{"type":32,"tag":175,"props":7312,"children":7313},{"style":286},[7314],{"type":45,"value":7315}," AgentsPropertiesSyncQueueHandler",{"type":32,"tag":175,"props":7317,"children":7318},{"style":188},[7319],{"type":45,"value":191},{"type":32,"tag":175,"props":7321,"children":7322},{"class":177,"line":378},[7323],{"type":32,"tag":175,"props":7324,"children":7325},{"emptyLinePlaceholder":265},[7326],{"type":45,"value":268},{"type":32,"tag":175,"props":7328,"children":7329},{"class":177,"line":387},[7330,7334,7338],{"type":32,"tag":175,"props":7331,"children":7332},{"style":182},[7333],{"type":45,"value":1981},{"type":32,"tag":175,"props":7335,"children":7336},{"style":280},[7337],{"type":45,"value":1986},{"type":32,"tag":175,"props":7339,"children":7340},{"style":188},[7341],{"type":45,"value":399},{"type":32,"tag":175,"props":7343,"children":7344},{"class":177,"line":402},[7345,7349,7353,7358,7362,7366],{"type":32,"tag":175,"props":7346,"children":7347},{"style":182},[7348],{"type":45,"value":1998},{"type":32,"tag":175,"props":7350,"children":7351},{"style":182},[7352],{"type":45,"value":2003},{"type":32,"tag":175,"props":7354,"children":7355},{"style":406},[7356],{"type":45,"value":7357}," syncAgentPropertiesService",{"type":32,"tag":175,"props":7359,"children":7360},{"style":182},[7361],{"type":45,"value":68},{"type":32,"tag":175,"props":7363,"children":7364},{"style":286},[7365],{"type":45,"value":4719},{"type":32,"tag":175,"props":7367,"children":7368},{"style":188},[7369],{"type":45,"value":673},{"type":32,"tag":175,"props":7371,"children":7372},{"class":177,"line":441},[7373],{"type":32,"tag":175,"props":7374,"children":7375},{"style":188},[7376],{"type":45,"value":2058},{"type":32,"tag":175,"props":7378,"children":7379},{"class":177,"line":474},[7380],{"type":32,"tag":175,"props":7381,"children":7382},{"emptyLinePlaceholder":265},[7383],{"type":45,"value":268},{"type":32,"tag":175,"props":7385,"children":7386},{"class":177,"line":1039},[7387,7391,7395,7400],{"type":32,"tag":175,"props":7388,"children":7389},{"style":182},[7390],{"type":45,"value":1981},{"type":32,"tag":175,"props":7392,"children":7393},{"style":182},[7394],{"type":45,"value":2107},{"type":32,"tag":175,"props":7396,"children":7397},{"style":391},[7398],{"type":45,"value":7399}," handle",{"type":32,"tag":175,"props":7401,"children":7402},{"style":188},[7403],{"type":45,"value":399},{"type":32,"tag":175,"props":7405,"children":7406},{"class":177,"line":1071},[7407,7412,7416,7421,7425,7430],{"type":32,"tag":175,"props":7408,"children":7409},{"style":406},[7410],{"type":45,"value":7411},"    batch",{"type":32,"tag":175,"props":7413,"children":7414},{"style":182},[7415],{"type":45,"value":68},{"type":32,"tag":175,"props":7417,"children":7418},{"style":286},[7419],{"type":45,"value":7420}," MessageBatch",{"type":32,"tag":175,"props":7422,"children":7423},{"style":188},[7424],{"type":45,"value":461},{"type":32,"tag":175,"props":7426,"children":7427},{"style":286},[7428],{"type":45,"value":7429},"AgentsPropertiesSyncQueueMessageBody",{"type":32,"tag":175,"props":7431,"children":7432},{"style":188},[7433],{"type":45,"value":7434},">,\n",{"type":32,"tag":175,"props":7436,"children":7437},{"class":177,"line":1079},[7438,7443,7447,7452],{"type":32,"tag":175,"props":7439,"children":7440},{"style":406},[7441],{"type":45,"value":7442},"    env",{"type":32,"tag":175,"props":7444,"children":7445},{"style":182},[7446],{"type":45,"value":68},{"type":32,"tag":175,"props":7448,"children":7449},{"style":286},[7450],{"type":45,"value":7451}," CloudflareEnv",{"type":32,"tag":175,"props":7453,"children":7454},{"style":188},[7455],{"type":45,"value":673},{"type":32,"tag":175,"props":7457,"children":7458},{"class":177,"line":1113},[7459,7463,7467,7471,7475,7479],{"type":32,"tag":175,"props":7460,"children":7461},{"style":188},[7462],{"type":45,"value":447},{"type":32,"tag":175,"props":7464,"children":7465},{"style":182},[7466],{"type":45,"value":68},{"type":32,"tag":175,"props":7468,"children":7469},{"style":286},[7470],{"type":45,"value":456},{"type":32,"tag":175,"props":7472,"children":7473},{"style":188},[7474],{"type":45,"value":461},{"type":32,"tag":175,"props":7476,"children":7477},{"style":280},[7478],{"type":45,"value":5042},{"type":32,"tag":175,"props":7480,"children":7481},{"style":188},[7482],{"type":45,"value":2175},{"type":32,"tag":175,"props":7484,"children":7485},{"class":177,"line":1121},[7486],{"type":32,"tag":175,"props":7487,"children":7488},{"emptyLinePlaceholder":265},[7489],{"type":45,"value":268},{"type":32,"tag":175,"props":7491,"children":7492},{"class":177,"line":1130},[7493,7497,7501,7505],{"type":32,"tag":175,"props":7494,"children":7495},{"style":280},[7496],{"type":45,"value":1471},{"type":32,"tag":175,"props":7498,"children":7499},{"style":188},[7500],{"type":45,"value":6724},{"type":32,"tag":175,"props":7502,"children":7503},{"style":182},[7504],{"type":45,"value":854},{"type":32,"tag":175,"props":7506,"children":7507},{"style":188},[7508],{"type":45,"value":7509}," batch.messages\n",{"type":32,"tag":175,"props":7511,"children":7512},{"class":177,"line":1170},[7513,7517,7521,7525,7529,7533,7537,7541],{"type":32,"tag":175,"props":7514,"children":7515},{"style":280},[7516],{"type":45,"value":1471},{"type":32,"tag":175,"props":7518,"children":7519},{"style":188},[7520],{"type":45,"value":6454},{"type":32,"tag":175,"props":7522,"children":7523},{"style":182},[7524],{"type":45,"value":854},{"type":32,"tag":175,"props":7526,"children":7527},{"style":391},[7528],{"type":45,"value":4913},{"type":32,"tag":175,"props":7530,"children":7531},{"style":188},[7532],{"type":45,"value":6467},{"type":32,"tag":175,"props":7534,"children":7535},{"style":182},[7536],{"type":45,"value":6263},{"type":32,"tag":175,"props":7538,"children":7539},{"style":286},[7540],{"type":45,"value":4872},{"type":32,"tag":175,"props":7542,"children":7543},{"style":188},[7544],{"type":45,"value":6480},{"type":32,"tag":175,"props":7546,"children":7547},{"class":177,"line":1179},[7548],{"type":32,"tag":175,"props":7549,"children":7550},{"emptyLinePlaceholder":265},[7551],{"type":45,"value":268},{"type":32,"tag":175,"props":7553,"children":7554},{"class":177,"line":1197},[7555,7559,7564,7568,7572,7577,7581,7585],{"type":32,"tag":175,"props":7556,"children":7557},{"style":280},[7558],{"type":45,"value":1471},{"type":32,"tag":175,"props":7560,"children":7561},{"style":188},[7562],{"type":45,"value":7563}," agentIds ",{"type":32,"tag":175,"props":7565,"children":7566},{"style":182},[7567],{"type":45,"value":854},{"type":32,"tag":175,"props":7569,"children":7570},{"style":182},[7571],{"type":45,"value":5086},{"type":32,"tag":175,"props":7573,"children":7574},{"style":391},[7575],{"type":45,"value":7576}," Set",{"type":32,"tag":175,"props":7578,"children":7579},{"style":188},[7580],{"type":45,"value":461},{"type":32,"tag":175,"props":7582,"children":7583},{"style":280},[7584],{"type":45,"value":4250},{"type":32,"tag":175,"props":7586,"children":7587},{"style":188},[7588],{"type":45,"value":7589},">()\n",{"type":32,"tag":175,"props":7591,"children":7592},{"class":177,"line":1206},[7593,7597,7601,7605,7610,7614],{"type":32,"tag":175,"props":7594,"children":7595},{"style":182},[7596],{"type":45,"value":5300},{"type":32,"tag":175,"props":7598,"children":7599},{"style":188},[7600],{"type":45,"value":1090},{"type":32,"tag":175,"props":7602,"children":7603},{"style":280},[7604],{"type":45,"value":5309},{"type":32,"tag":175,"props":7606,"children":7607},{"style":188},[7608],{"type":45,"value":7609}," message ",{"type":32,"tag":175,"props":7611,"children":7612},{"style":182},[7613],{"type":45,"value":5319},{"type":32,"tag":175,"props":7615,"children":7616},{"style":188},[7617],{"type":45,"value":7618}," messages) {\n",{"type":32,"tag":175,"props":7620,"children":7621},{"class":177,"line":1214},[7622,7626],{"type":32,"tag":175,"props":7623,"children":7624},{"style":182},[7625],{"type":45,"value":1085},{"type":32,"tag":175,"props":7627,"children":7628},{"style":188},[7629],{"type":45,"value":7630}," (message.body?.agentId) {\n",{"type":32,"tag":175,"props":7632,"children":7633},{"class":177,"line":1223},[7634,7639,7644],{"type":32,"tag":175,"props":7635,"children":7636},{"style":188},[7637],{"type":45,"value":7638},"        agentIds.",{"type":32,"tag":175,"props":7640,"children":7641},{"style":391},[7642],{"type":45,"value":7643},"add",{"type":32,"tag":175,"props":7645,"children":7646},{"style":188},[7647],{"type":45,"value":7648},"(message.body.agentId)\n",{"type":32,"tag":175,"props":7650,"children":7651},{"class":177,"line":1267},[7652],{"type":32,"tag":175,"props":7653,"children":7654},{"style":188},[7655],{"type":45,"value":2543},{"type":32,"tag":175,"props":7657,"children":7658},{"class":177,"line":1276},[7659],{"type":32,"tag":175,"props":7660,"children":7661},{"style":188},[7662],{"type":45,"value":1363},{"type":32,"tag":175,"props":7664,"children":7665},{"class":177,"line":1285},[7666],{"type":32,"tag":175,"props":7667,"children":7668},{"emptyLinePlaceholder":265},[7669],{"type":45,"value":268},{"type":32,"tag":175,"props":7671,"children":7672},{"class":177,"line":1294},[7673,7677,7682,7686,7690],{"type":32,"tag":175,"props":7674,"children":7675},{"style":182},[7676],{"type":45,"value":950},{"type":32,"tag":175,"props":7678,"children":7679},{"style":188},[7680],{"type":45,"value":7681}," (agentIds.size ",{"type":32,"tag":175,"props":7683,"children":7684},{"style":182},[7685],{"type":45,"value":2490},{"type":32,"tag":175,"props":7687,"children":7688},{"style":857},[7689],{"type":45,"value":1664},{"type":32,"tag":175,"props":7691,"children":7692},{"style":188},[7693],{"type":45,"value":6237},{"type":32,"tag":175,"props":7695,"children":7696},{"class":177,"line":1302},[7697,7701,7705,7709,7714],{"type":32,"tag":175,"props":7698,"children":7699},{"style":188},[7700],{"type":45,"value":1317},{"type":32,"tag":175,"props":7702,"children":7703},{"style":391},[7704],{"type":45,"value":5645},{"type":32,"tag":175,"props":7706,"children":7707},{"style":188},[7708],{"type":45,"value":1327},{"type":32,"tag":175,"props":7710,"children":7711},{"style":217},[7712],{"type":45,"value":7713},"'[Agents Properties Sync Handler] No valid agentIds found in batch.'",{"type":32,"tag":175,"props":7715,"children":7716},{"style":188},[7717],{"type":45,"value":1345},{"type":32,"tag":175,"props":7719,"children":7720},{"class":177,"line":1311},[7721],{"type":32,"tag":175,"props":7722,"children":7723},{"style":182},[7724],{"type":45,"value":7725},"      return\n",{"type":32,"tag":175,"props":7727,"children":7728},{"class":177,"line":1348},[7729],{"type":32,"tag":175,"props":7730,"children":7731},{"style":188},[7732],{"type":45,"value":1363},{"type":32,"tag":175,"props":7734,"children":7735},{"class":177,"line":1357},[7736],{"type":32,"tag":175,"props":7737,"children":7738},{"emptyLinePlaceholder":265},[7739],{"type":45,"value":268},{"type":32,"tag":175,"props":7741,"children":7742},{"class":177,"line":1366},[7743,7747],{"type":32,"tag":175,"props":7744,"children":7745},{"style":182},[7746],{"type":45,"value":6495},{"type":32,"tag":175,"props":7748,"children":7749},{"style":188},[7750],{"type":45,"value":191},{"type":32,"tag":175,"props":7752,"children":7753},{"class":177,"line":1375},[7754,7758,7763,7767,7772,7776],{"type":32,"tag":175,"props":7755,"children":7756},{"style":280},[7757],{"type":45,"value":1004},{"type":32,"tag":175,"props":7759,"children":7760},{"style":188},[7761],{"type":45,"value":7762}," ids ",{"type":32,"tag":175,"props":7764,"children":7765},{"style":182},[7766],{"type":45,"value":854},{"type":32,"tag":175,"props":7768,"children":7769},{"style":188},[7770],{"type":45,"value":7771}," Array.",{"type":32,"tag":175,"props":7773,"children":7774},{"style":391},[7775],{"type":45,"value":214},{"type":32,"tag":175,"props":7777,"children":7778},{"style":188},[7779],{"type":45,"value":7780},"(agentIds)\n",{"type":32,"tag":175,"props":7782,"children":7783},{"class":177,"line":1384},[7784,7788,7793,7797,7801,7805,7809,7813,7817,7821],{"type":32,"tag":175,"props":7785,"children":7786},{"style":280},[7787],{"type":45,"value":1004},{"type":32,"tag":175,"props":7789,"children":7790},{"style":188},[7791],{"type":45,"value":7792}," agentsToSync",{"type":32,"tag":175,"props":7794,"children":7795},{"style":182},[7796],{"type":45,"value":68},{"type":32,"tag":175,"props":7798,"children":7799},{"style":286},[7800],{"type":45,"value":5014},{"type":32,"tag":175,"props":7802,"children":7803},{"style":188},[7804],{"type":45,"value":1489},{"type":32,"tag":175,"props":7806,"children":7807},{"style":182},[7808],{"type":45,"value":854},{"type":32,"tag":175,"props":7810,"children":7811},{"style":182},[7812],{"type":45,"value":1018},{"type":32,"tag":175,"props":7814,"children":7815},{"style":188},[7816],{"type":45,"value":6524},{"type":32,"tag":175,"props":7818,"children":7819},{"style":391},[7820],{"type":45,"value":6529},{"type":32,"tag":175,"props":7822,"children":7823},{"style":188},[7824],{"type":45,"value":5555},{"type":32,"tag":175,"props":7826,"children":7827},{"class":177,"line":1393},[7828,7832,7837],{"type":32,"tag":175,"props":7829,"children":7830},{"style":188},[7831],{"type":45,"value":6541},{"type":32,"tag":175,"props":7833,"children":7834},{"style":391},[7835],{"type":45,"value":7836},"inArray",{"type":32,"tag":175,"props":7838,"children":7839},{"style":188},[7840],{"type":45,"value":7841},"(schema.agents.id, ids),\n",{"type":32,"tag":175,"props":7843,"children":7844},{"class":177,"line":1402},[7845],{"type":32,"tag":175,"props":7846,"children":7847},{"style":188},[7848],{"type":45,"value":7849},"        with: {\n",{"type":32,"tag":175,"props":7851,"children":7852},{"class":177,"line":1410},[7853,7858,7862],{"type":32,"tag":175,"props":7854,"children":7855},{"style":188},[7856],{"type":45,"value":7857},"          properties: ",{"type":32,"tag":175,"props":7859,"children":7860},{"style":857},[7861],{"type":45,"value":6564},{"type":32,"tag":175,"props":7863,"children":7864},{"style":188},[7865],{"type":45,"value":673},{"type":32,"tag":175,"props":7867,"children":7868},{"class":177,"line":1426},[7869],{"type":32,"tag":175,"props":7870,"children":7871},{"style":188},[7872],{"type":45,"value":7873},"        }\n",{"type":32,"tag":175,"props":7875,"children":7876},{"class":177,"line":1439},[7877],{"type":32,"tag":175,"props":7878,"children":7879},{"style":188},[7880],{"type":45,"value":1203},{"type":32,"tag":175,"props":7882,"children":7883},{"class":177,"line":1447},[7884],{"type":32,"tag":175,"props":7885,"children":7886},{"emptyLinePlaceholder":265},[7887],{"type":45,"value":268},{"type":32,"tag":175,"props":7889,"children":7890},{"class":177,"line":1465},[7891,7895,7899,7903,7908,7912],{"type":32,"tag":175,"props":7892,"children":7893},{"style":182},[7894],{"type":45,"value":6809},{"type":32,"tag":175,"props":7896,"children":7897},{"style":188},[7898],{"type":45,"value":1090},{"type":32,"tag":175,"props":7900,"children":7901},{"style":280},[7902],{"type":45,"value":5309},{"type":32,"tag":175,"props":7904,"children":7905},{"style":188},[7906],{"type":45,"value":7907}," agent ",{"type":32,"tag":175,"props":7909,"children":7910},{"style":182},[7911],{"type":45,"value":5319},{"type":32,"tag":175,"props":7913,"children":7914},{"style":188},[7915],{"type":45,"value":7916}," agentsToSync) {\n",{"type":32,"tag":175,"props":7918,"children":7919},{"class":177,"line":1501},[7920,7924,7928,7933,7938],{"type":32,"tag":175,"props":7921,"children":7922},{"style":182},[7923],{"type":45,"value":5526},{"type":32,"tag":175,"props":7925,"children":7926},{"style":917},[7927],{"type":45,"value":920},{"type":32,"tag":175,"props":7929,"children":7930},{"style":188},[7931],{"type":45,"value":7932},".syncAgentPropertiesService.",{"type":32,"tag":175,"props":7934,"children":7935},{"style":391},[7936],{"type":45,"value":7937},"execute",{"type":32,"tag":175,"props":7939,"children":7940},{"style":188},[7941],{"type":45,"value":7942},"(agent)\n",{"type":32,"tag":175,"props":7944,"children":7945},{"class":177,"line":1510},[7946],{"type":32,"tag":175,"props":7947,"children":7948},{"emptyLinePlaceholder":265},[7949],{"type":45,"value":268},{"type":32,"tag":175,"props":7951,"children":7952},{"class":177,"line":1533},[7953,7957,7961],{"type":32,"tag":175,"props":7954,"children":7955},{"style":188},[7956],{"type":45,"value":5640},{"type":32,"tag":175,"props":7958,"children":7959},{"style":391},[7960],{"type":45,"value":5645},{"type":32,"tag":175,"props":7962,"children":7963},{"style":188},[7964],{"type":45,"value":2224},{"type":32,"tag":175,"props":7966,"children":7967},{"class":177,"line":1554},[7968,7973,7977,7981,7985,7990],{"type":32,"tag":175,"props":7969,"children":7970},{"style":217},[7971],{"type":45,"value":7972},"          `[Agents Properties Sync Handler] Successfully synced properties for agent \"",{"type":32,"tag":175,"props":7974,"children":7975},{"style":182},[7976],{"type":45,"value":4415},{"type":32,"tag":175,"props":7978,"children":7979},{"style":188},[7980],{"type":45,"value":5130},{"type":32,"tag":175,"props":7982,"children":7983},{"style":182},[7984],{"type":45,"value":4425},{"type":32,"tag":175,"props":7986,"children":7987},{"style":217},[7988],{"type":45,"value":7989},"\".`",{"type":32,"tag":175,"props":7991,"children":7992},{"style":188},[7993],{"type":45,"value":673},{"type":32,"tag":175,"props":7995,"children":7996},{"class":177,"line":1575},[7997],{"type":32,"tag":175,"props":7998,"children":7999},{"style":188},[8000],{"type":45,"value":8001},"        )\n",{"type":32,"tag":175,"props":8003,"children":8004},{"class":177,"line":1584},[8005],{"type":32,"tag":175,"props":8006,"children":8007},{"style":188},[8008],{"type":45,"value":2543},{"type":32,"tag":175,"props":8010,"children":8011},{"class":177,"line":1592},[8012],{"type":32,"tag":175,"props":8013,"children":8014},{"emptyLinePlaceholder":265},[8015],{"type":45,"value":268},{"type":32,"tag":175,"props":8017,"children":8018},{"class":177,"line":1606},[8019,8023,8027,8031,8035,8039,8043],{"type":32,"tag":175,"props":8020,"children":8021},{"style":188},[8022],{"type":45,"value":6993},{"type":32,"tag":175,"props":8024,"children":8025},{"style":182},[8026],{"type":45,"value":6998},{"type":32,"tag":175,"props":8028,"children":8029},{"style":188},[8030],{"type":45,"value":1090},{"type":32,"tag":175,"props":8032,"children":8033},{"style":406},[8034],{"type":45,"value":1322},{"type":32,"tag":175,"props":8036,"children":8037},{"style":182},[8038],{"type":45,"value":68},{"type":32,"tag":175,"props":8040,"children":8041},{"style":280},[8042],{"type":45,"value":7015},{"type":32,"tag":175,"props":8044,"children":8045},{"style":188},[8046],{"type":45,"value":6237},{"type":32,"tag":175,"props":8048,"children":8049},{"class":177,"line":1671},[8050,8054,8058,8062,8067],{"type":32,"tag":175,"props":8051,"children":8052},{"style":188},[8053],{"type":45,"value":1317},{"type":32,"tag":175,"props":8055,"children":8056},{"style":391},[8057],{"type":45,"value":1322},{"type":32,"tag":175,"props":8059,"children":8060},{"style":188},[8061],{"type":45,"value":1327},{"type":32,"tag":175,"props":8063,"children":8064},{"style":217},[8065],{"type":45,"value":8066},"'[Agents Properties Sync Handler] Error:'",{"type":32,"tag":175,"props":8068,"children":8069},{"style":188},[8070],{"type":45,"value":8071},", error.message);\n",{"type":32,"tag":175,"props":8073,"children":8074},{"class":177,"line":1697},[8075,8079],{"type":32,"tag":175,"props":8076,"children":8077},{"style":182},[8078],{"type":45,"value":5081},{"type":32,"tag":175,"props":8080,"children":8081},{"style":188},[8082],{"type":45,"value":8083}," error;\n",{"type":32,"tag":175,"props":8085,"children":8086},{"class":177,"line":1714},[8087],{"type":32,"tag":175,"props":8088,"children":8089},{"style":188},[8090],{"type":45,"value":1363},{"type":32,"tag":175,"props":8092,"children":8093},{"class":177,"line":2593},[8094],{"type":32,"tag":175,"props":8095,"children":8096},{"style":188},[8097],{"type":45,"value":1372},{"type":32,"tag":175,"props":8099,"children":8100},{"class":177,"line":2602},[8101],{"type":32,"tag":175,"props":8102,"children":8103},{"style":188},[8104],{"type":45,"value":480},{"type":32,"tag":33,"props":8106,"children":8107},{},[8108,8110,8116],{"type":45,"value":8109},"And trigger it from the Nitro Plugin: ",{"type":32,"tag":155,"props":8111,"children":8113},{"className":8112},[],[8114],{"type":45,"value":8115},"/server/plugins/queue-handler.ts",{"type":45,"value":8117}," that listens to Cloudflare Queues:",{"type":32,"tag":164,"props":8119,"children":8121},{"className":166,"code":8120,"language":168,"meta":169,"style":169},"if (batch.queue === 'agents-properties-sync-queue') {\n  try {\n    const aiLocationMatcherRepository = new CloudflareVectorAIRepository(\n      env.VECTORIZE,\n      env.AI,\n    )\n\n    const database = drizzle(env.DB, { schema })\n\n    const allLocations = await database.query.locations.findMany()\n\n    const syncService = new SyncAgentPropertiesService(\n      aiLocationMatcherRepository,\n      allLocations,\n      env.DB,\n    )\n\n    const handler = new AgentsPropertiesSyncQueueHandler(\n      syncService,\n    )\n\n    await handler.handle(\n      batch as MessageBatch\u003CAgentsPropertiesSyncQueueMessageBody>,\n      env,\n    )\n  } catch (error: any) {\n    console.error('[Queue] Error processing batch:', error)\n    // This will trigger a retry as per the wrangler.toml queue settings\n    throw error\n  }\n}\n",[8122],{"type":32,"tag":155,"props":8123,"children":8124},{"__ignoreMap":169},[8125,8151,8163,8192,8200,8208,8215,8222,8247,8254,8287,8294,8322,8330,8338,8346,8353,8360,8388,8396,8403,8410,8432,8460,8468,8475,8507,8532,8540,8552,8559],{"type":32,"tag":175,"props":8126,"children":8127},{"class":177,"line":178},[8128,8133,8138,8142,8147],{"type":32,"tag":175,"props":8129,"children":8130},{"style":182},[8131],{"type":45,"value":8132},"if",{"type":32,"tag":175,"props":8134,"children":8135},{"style":188},[8136],{"type":45,"value":8137}," (batch.queue ",{"type":32,"tag":175,"props":8139,"children":8140},{"style":182},[8141],{"type":45,"value":2490},{"type":32,"tag":175,"props":8143,"children":8144},{"style":217},[8145],{"type":45,"value":8146}," 'agents-properties-sync-queue'",{"type":32,"tag":175,"props":8148,"children":8149},{"style":188},[8150],{"type":45,"value":6237},{"type":32,"tag":175,"props":8152,"children":8153},{"class":177,"line":194},[8154,8159],{"type":32,"tag":175,"props":8155,"children":8156},{"style":182},[8157],{"type":45,"value":8158},"  try",{"type":32,"tag":175,"props":8160,"children":8161},{"style":188},[8162],{"type":45,"value":191},{"type":32,"tag":175,"props":8164,"children":8165},{"class":177,"line":203},[8166,8170,8175,8179,8183,8188],{"type":32,"tag":175,"props":8167,"children":8168},{"style":280},[8169],{"type":45,"value":1471},{"type":32,"tag":175,"props":8171,"children":8172},{"style":188},[8173],{"type":45,"value":8174}," aiLocationMatcherRepository ",{"type":32,"tag":175,"props":8176,"children":8177},{"style":182},[8178],{"type":45,"value":854},{"type":32,"tag":175,"props":8180,"children":8181},{"style":182},[8182],{"type":45,"value":5086},{"type":32,"tag":175,"props":8184,"children":8185},{"style":391},[8186],{"type":45,"value":8187}," CloudflareVectorAIRepository",{"type":32,"tag":175,"props":8189,"children":8190},{"style":188},[8191],{"type":45,"value":2224},{"type":32,"tag":175,"props":8193,"children":8194},{"class":177,"line":223},[8195],{"type":32,"tag":175,"props":8196,"children":8197},{"style":188},[8198],{"type":45,"value":8199},"      env.VECTORIZE,\n",{"type":32,"tag":175,"props":8201,"children":8202},{"class":177,"line":235},[8203],{"type":32,"tag":175,"props":8204,"children":8205},{"style":188},[8206],{"type":45,"value":8207},"      env.AI,\n",{"type":32,"tag":175,"props":8209,"children":8210},{"class":177,"line":244},[8211],{"type":32,"tag":175,"props":8212,"children":8213},{"style":188},[8214],{"type":45,"value":2248},{"type":32,"tag":175,"props":8216,"children":8217},{"class":177,"line":261},[8218],{"type":32,"tag":175,"props":8219,"children":8220},{"emptyLinePlaceholder":265},[8221],{"type":45,"value":268},{"type":32,"tag":175,"props":8223,"children":8224},{"class":177,"line":271},[8225,8229,8234,8238,8242],{"type":32,"tag":175,"props":8226,"children":8227},{"style":280},[8228],{"type":45,"value":1471},{"type":32,"tag":175,"props":8230,"children":8231},{"style":188},[8232],{"type":45,"value":8233}," database ",{"type":32,"tag":175,"props":8235,"children":8236},{"style":182},[8237],{"type":45,"value":854},{"type":32,"tag":175,"props":8239,"children":8240},{"style":391},[8241],{"type":45,"value":4913},{"type":32,"tag":175,"props":8243,"children":8244},{"style":188},[8245],{"type":45,"value":8246},"(env.DB, { schema })\n",{"type":32,"tag":175,"props":8248,"children":8249},{"class":177,"line":296},[8250],{"type":32,"tag":175,"props":8251,"children":8252},{"emptyLinePlaceholder":265},[8253],{"type":45,"value":268},{"type":32,"tag":175,"props":8255,"children":8256},{"class":177,"line":306},[8257,8261,8266,8270,8274,8279,8283],{"type":32,"tag":175,"props":8258,"children":8259},{"style":280},[8260],{"type":45,"value":1471},{"type":32,"tag":175,"props":8262,"children":8263},{"style":188},[8264],{"type":45,"value":8265}," allLocations ",{"type":32,"tag":175,"props":8267,"children":8268},{"style":182},[8269],{"type":45,"value":854},{"type":32,"tag":175,"props":8271,"children":8272},{"style":182},[8273],{"type":45,"value":1018},{"type":32,"tag":175,"props":8275,"children":8276},{"style":188},[8277],{"type":45,"value":8278}," database.query.locations.",{"type":32,"tag":175,"props":8280,"children":8281},{"style":391},[8282],{"type":45,"value":6529},{"type":32,"tag":175,"props":8284,"children":8285},{"style":188},[8286],{"type":45,"value":1711},{"type":32,"tag":175,"props":8288,"children":8289},{"class":177,"line":315},[8290],{"type":32,"tag":175,"props":8291,"children":8292},{"emptyLinePlaceholder":265},[8293],{"type":45,"value":268},{"type":32,"tag":175,"props":8295,"children":8296},{"class":177,"line":324},[8297,8301,8306,8310,8314,8318],{"type":32,"tag":175,"props":8298,"children":8299},{"style":280},[8300],{"type":45,"value":1471},{"type":32,"tag":175,"props":8302,"children":8303},{"style":188},[8304],{"type":45,"value":8305}," syncService ",{"type":32,"tag":175,"props":8307,"children":8308},{"style":182},[8309],{"type":45,"value":854},{"type":32,"tag":175,"props":8311,"children":8312},{"style":182},[8313],{"type":45,"value":5086},{"type":32,"tag":175,"props":8315,"children":8316},{"style":391},[8317],{"type":45,"value":4719},{"type":32,"tag":175,"props":8319,"children":8320},{"style":188},[8321],{"type":45,"value":2224},{"type":32,"tag":175,"props":8323,"children":8324},{"class":177,"line":343},[8325],{"type":32,"tag":175,"props":8326,"children":8327},{"style":188},[8328],{"type":45,"value":8329},"      aiLocationMatcherRepository,\n",{"type":32,"tag":175,"props":8331,"children":8332},{"class":177,"line":361},[8333],{"type":32,"tag":175,"props":8334,"children":8335},{"style":188},[8336],{"type":45,"value":8337},"      allLocations,\n",{"type":32,"tag":175,"props":8339,"children":8340},{"class":177,"line":378},[8341],{"type":32,"tag":175,"props":8342,"children":8343},{"style":188},[8344],{"type":45,"value":8345},"      env.DB,\n",{"type":32,"tag":175,"props":8347,"children":8348},{"class":177,"line":387},[8349],{"type":32,"tag":175,"props":8350,"children":8351},{"style":188},[8352],{"type":45,"value":2248},{"type":32,"tag":175,"props":8354,"children":8355},{"class":177,"line":402},[8356],{"type":32,"tag":175,"props":8357,"children":8358},{"emptyLinePlaceholder":265},[8359],{"type":45,"value":268},{"type":32,"tag":175,"props":8361,"children":8362},{"class":177,"line":441},[8363,8367,8372,8376,8380,8384],{"type":32,"tag":175,"props":8364,"children":8365},{"style":280},[8366],{"type":45,"value":1471},{"type":32,"tag":175,"props":8368,"children":8369},{"style":188},[8370],{"type":45,"value":8371}," handler ",{"type":32,"tag":175,"props":8373,"children":8374},{"style":182},[8375],{"type":45,"value":854},{"type":32,"tag":175,"props":8377,"children":8378},{"style":182},[8379],{"type":45,"value":5086},{"type":32,"tag":175,"props":8381,"children":8382},{"style":391},[8383],{"type":45,"value":7315},{"type":32,"tag":175,"props":8385,"children":8386},{"style":188},[8387],{"type":45,"value":2224},{"type":32,"tag":175,"props":8389,"children":8390},{"class":177,"line":474},[8391],{"type":32,"tag":175,"props":8392,"children":8393},{"style":188},[8394],{"type":45,"value":8395},"      syncService,\n",{"type":32,"tag":175,"props":8397,"children":8398},{"class":177,"line":1039},[8399],{"type":32,"tag":175,"props":8400,"children":8401},{"style":188},[8402],{"type":45,"value":2248},{"type":32,"tag":175,"props":8404,"children":8405},{"class":177,"line":1071},[8406],{"type":32,"tag":175,"props":8407,"children":8408},{"emptyLinePlaceholder":265},[8409],{"type":45,"value":268},{"type":32,"tag":175,"props":8411,"children":8412},{"class":177,"line":1079},[8413,8418,8423,8428],{"type":32,"tag":175,"props":8414,"children":8415},{"style":182},[8416],{"type":45,"value":8417},"    await",{"type":32,"tag":175,"props":8419,"children":8420},{"style":188},[8421],{"type":45,"value":8422}," handler.",{"type":32,"tag":175,"props":8424,"children":8425},{"style":391},[8426],{"type":45,"value":8427},"handle",{"type":32,"tag":175,"props":8429,"children":8430},{"style":188},[8431],{"type":45,"value":2224},{"type":32,"tag":175,"props":8433,"children":8434},{"class":177,"line":1113},[8435,8440,8444,8448,8452,8456],{"type":32,"tag":175,"props":8436,"children":8437},{"style":188},[8438],{"type":45,"value":8439},"      batch ",{"type":32,"tag":175,"props":8441,"children":8442},{"style":182},[8443],{"type":45,"value":6263},{"type":32,"tag":175,"props":8445,"children":8446},{"style":286},[8447],{"type":45,"value":7420},{"type":32,"tag":175,"props":8449,"children":8450},{"style":188},[8451],{"type":45,"value":461},{"type":32,"tag":175,"props":8453,"children":8454},{"style":286},[8455],{"type":45,"value":7429},{"type":32,"tag":175,"props":8457,"children":8458},{"style":188},[8459],{"type":45,"value":7434},{"type":32,"tag":175,"props":8461,"children":8462},{"class":177,"line":1121},[8463],{"type":32,"tag":175,"props":8464,"children":8465},{"style":188},[8466],{"type":45,"value":8467},"      env,\n",{"type":32,"tag":175,"props":8469,"children":8470},{"class":177,"line":1130},[8471],{"type":32,"tag":175,"props":8472,"children":8473},{"style":188},[8474],{"type":45,"value":2248},{"type":32,"tag":175,"props":8476,"children":8477},{"class":177,"line":1170},[8478,8483,8487,8491,8495,8499,8503],{"type":32,"tag":175,"props":8479,"children":8480},{"style":188},[8481],{"type":45,"value":8482},"  } ",{"type":32,"tag":175,"props":8484,"children":8485},{"style":182},[8486],{"type":45,"value":6998},{"type":32,"tag":175,"props":8488,"children":8489},{"style":188},[8490],{"type":45,"value":1090},{"type":32,"tag":175,"props":8492,"children":8493},{"style":406},[8494],{"type":45,"value":1322},{"type":32,"tag":175,"props":8496,"children":8497},{"style":182},[8498],{"type":45,"value":68},{"type":32,"tag":175,"props":8500,"children":8501},{"style":280},[8502],{"type":45,"value":7015},{"type":32,"tag":175,"props":8504,"children":8505},{"style":188},[8506],{"type":45,"value":6237},{"type":32,"tag":175,"props":8508,"children":8509},{"class":177,"line":1179},[8510,8515,8519,8523,8528],{"type":32,"tag":175,"props":8511,"children":8512},{"style":188},[8513],{"type":45,"value":8514},"    console.",{"type":32,"tag":175,"props":8516,"children":8517},{"style":391},[8518],{"type":45,"value":1322},{"type":32,"tag":175,"props":8520,"children":8521},{"style":188},[8522],{"type":45,"value":1327},{"type":32,"tag":175,"props":8524,"children":8525},{"style":217},[8526],{"type":45,"value":8527},"'[Queue] Error processing batch:'",{"type":32,"tag":175,"props":8529,"children":8530},{"style":188},[8531],{"type":45,"value":7044},{"type":32,"tag":175,"props":8533,"children":8534},{"class":177,"line":1197},[8535],{"type":32,"tag":175,"props":8536,"children":8537},{"style":300},[8538],{"type":45,"value":8539},"    // This will trigger a retry as per the wrangler.toml queue settings\n",{"type":32,"tag":175,"props":8541,"children":8542},{"class":177,"line":1206},[8543,8547],{"type":32,"tag":175,"props":8544,"children":8545},{"style":182},[8546],{"type":45,"value":4168},{"type":32,"tag":175,"props":8548,"children":8549},{"style":188},[8550],{"type":45,"value":8551}," error\n",{"type":32,"tag":175,"props":8553,"children":8554},{"class":177,"line":1214},[8555],{"type":32,"tag":175,"props":8556,"children":8557},{"style":188},[8558],{"type":45,"value":1372},{"type":32,"tag":175,"props":8560,"children":8561},{"class":177,"line":1223},[8562],{"type":32,"tag":175,"props":8563,"children":8564},{"style":188},[8565],{"type":45,"value":480},{"type":32,"tag":33,"props":8567,"children":8568},{},[8569],{"type":45,"value":8570},"Before we hand over control to a scheduler, we need a way to manually trigger the synchronisation process and ensure our pipeline works end-to-end. Let's create a temporary debug endpoint to immediately invoke the Nitro Task.",{"type":32,"tag":33,"props":8572,"children":8573},{},[8574,8576,8582],{"type":45,"value":8575},"Create ",{"type":32,"tag":155,"props":8577,"children":8579},{"className":8578},[],[8580],{"type":45,"value":8581},"/server/api/internals/agents-properties-sync.get.ts",{"type":45,"value":162},{"type":32,"tag":164,"props":8584,"children":8586},{"className":166,"code":8585,"language":168,"meta":169,"style":169},"export default defineEventHandler(async (event) => {\n\n  const config = useRuntimeConfig();\n\n  if (getHeader(event, 'x-secret') !== config.internalApiSecret) {\n    throw createError({ statusCode: 401, statusMessage: 'Unauthorized' });\n  }\n\n  const result = await runTask(\n    'agents-properties-sync',\n    {\n      payload: {},\n      context: {\n        cloudflare: event.context.cloudflare\n      }\n    }\n  );\n\n  return {\n    status: 'Agents Properties Sync Task Triggered',\n    result,\n  }\n});\n\n",[8587],{"type":32,"tag":155,"props":8588,"children":8589},{"__ignoreMap":169},[8590,8633,8640,8664,8671,8710,8745,8752,8759,8787,8799,8807,8815,8823,8831,8838,8845,8853,8860,8871,8888,8896,8903],{"type":32,"tag":175,"props":8591,"children":8592},{"class":177,"line":178},[8593,8597,8601,8605,8609,8613,8617,8621,8625,8629],{"type":32,"tag":175,"props":8594,"children":8595},{"style":182},[8596],{"type":45,"value":277},{"type":32,"tag":175,"props":8598,"children":8599},{"style":182},[8600],{"type":45,"value":4054},{"type":32,"tag":175,"props":8602,"children":8603},{"style":391},[8604],{"type":45,"value":4059},{"type":32,"tag":175,"props":8606,"children":8607},{"style":188},[8608],{"type":45,"value":1327},{"type":32,"tag":175,"props":8610,"children":8611},{"style":182},[8612],{"type":45,"value":4068},{"type":32,"tag":175,"props":8614,"children":8615},{"style":188},[8616],{"type":45,"value":1090},{"type":32,"tag":175,"props":8618,"children":8619},{"style":406},[8620],{"type":45,"value":4077},{"type":32,"tag":175,"props":8622,"children":8623},{"style":188},[8624],{"type":45,"value":1254},{"type":32,"tag":175,"props":8626,"children":8627},{"style":280},[8628],{"type":45,"value":1259},{"type":32,"tag":175,"props":8630,"children":8631},{"style":188},[8632],{"type":45,"value":191},{"type":32,"tag":175,"props":8634,"children":8635},{"class":177,"line":194},[8636],{"type":32,"tag":175,"props":8637,"children":8638},{"emptyLinePlaceholder":265},[8639],{"type":45,"value":268},{"type":32,"tag":175,"props":8641,"children":8642},{"class":177,"line":203},[8643,8647,8651,8655,8659],{"type":32,"tag":175,"props":8644,"children":8645},{"style":280},[8646],{"type":45,"value":4104},{"type":32,"tag":175,"props":8648,"children":8649},{"style":188},[8650],{"type":45,"value":3344},{"type":32,"tag":175,"props":8652,"children":8653},{"style":182},[8654],{"type":45,"value":854},{"type":32,"tag":175,"props":8656,"children":8657},{"style":391},[8658],{"type":45,"value":3353},{"type":32,"tag":175,"props":8660,"children":8661},{"style":188},[8662],{"type":45,"value":8663},"();\n",{"type":32,"tag":175,"props":8665,"children":8666},{"class":177,"line":223},[8667],{"type":32,"tag":175,"props":8668,"children":8669},{"emptyLinePlaceholder":265},[8670],{"type":45,"value":268},{"type":32,"tag":175,"props":8672,"children":8673},{"class":177,"line":235},[8674,8678,8682,8687,8691,8696,8700,8705],{"type":32,"tag":175,"props":8675,"children":8676},{"style":182},[8677],{"type":45,"value":4147},{"type":32,"tag":175,"props":8679,"children":8680},{"style":188},[8681],{"type":45,"value":1090},{"type":32,"tag":175,"props":8683,"children":8684},{"style":391},[8685],{"type":45,"value":8686},"getHeader",{"type":32,"tag":175,"props":8688,"children":8689},{"style":188},[8690],{"type":45,"value":4123},{"type":32,"tag":175,"props":8692,"children":8693},{"style":217},[8694],{"type":45,"value":8695},"'x-secret'",{"type":32,"tag":175,"props":8697,"children":8698},{"style":188},[8699],{"type":45,"value":1254},{"type":32,"tag":175,"props":8701,"children":8702},{"style":182},[8703],{"type":45,"value":8704},"!==",{"type":32,"tag":175,"props":8706,"children":8707},{"style":188},[8708],{"type":45,"value":8709}," config.internalApiSecret) {\n",{"type":32,"tag":175,"props":8711,"children":8712},{"class":177,"line":244},[8713,8717,8721,8725,8730,8735,8740],{"type":32,"tag":175,"props":8714,"children":8715},{"style":182},[8716],{"type":45,"value":4168},{"type":32,"tag":175,"props":8718,"children":8719},{"style":391},[8720],{"type":45,"value":4173},{"type":32,"tag":175,"props":8722,"children":8723},{"style":188},[8724],{"type":45,"value":4178},{"type":32,"tag":175,"props":8726,"children":8727},{"style":857},[8728],{"type":45,"value":8729},"401",{"type":32,"tag":175,"props":8731,"children":8732},{"style":188},[8733],{"type":45,"value":8734},", statusMessage: ",{"type":32,"tag":175,"props":8736,"children":8737},{"style":217},[8738],{"type":45,"value":8739},"'Unauthorized'",{"type":32,"tag":175,"props":8741,"children":8742},{"style":188},[8743],{"type":45,"value":8744}," });\n",{"type":32,"tag":175,"props":8746,"children":8747},{"class":177,"line":261},[8748],{"type":32,"tag":175,"props":8749,"children":8750},{"style":188},[8751],{"type":45,"value":1372},{"type":32,"tag":175,"props":8753,"children":8754},{"class":177,"line":271},[8755],{"type":32,"tag":175,"props":8756,"children":8757},{"emptyLinePlaceholder":265},[8758],{"type":45,"value":268},{"type":32,"tag":175,"props":8760,"children":8761},{"class":177,"line":296},[8762,8766,8770,8774,8778,8783],{"type":32,"tag":175,"props":8763,"children":8764},{"style":280},[8765],{"type":45,"value":4104},{"type":32,"tag":175,"props":8767,"children":8768},{"style":188},[8769],{"type":45,"value":1140},{"type":32,"tag":175,"props":8771,"children":8772},{"style":182},[8773],{"type":45,"value":854},{"type":32,"tag":175,"props":8775,"children":8776},{"style":182},[8777],{"type":45,"value":1018},{"type":32,"tag":175,"props":8779,"children":8780},{"style":391},[8781],{"type":45,"value":8782}," runTask",{"type":32,"tag":175,"props":8784,"children":8785},{"style":188},[8786],{"type":45,"value":2224},{"type":32,"tag":175,"props":8788,"children":8789},{"class":177,"line":306},[8790,8795],{"type":32,"tag":175,"props":8791,"children":8792},{"style":217},[8793],{"type":45,"value":8794},"    'agents-properties-sync'",{"type":32,"tag":175,"props":8796,"children":8797},{"style":188},[8798],{"type":45,"value":673},{"type":32,"tag":175,"props":8800,"children":8801},{"class":177,"line":315},[8802],{"type":32,"tag":175,"props":8803,"children":8804},{"style":188},[8805],{"type":45,"value":8806},"    {\n",{"type":32,"tag":175,"props":8808,"children":8809},{"class":177,"line":324},[8810],{"type":32,"tag":175,"props":8811,"children":8812},{"style":188},[8813],{"type":45,"value":8814},"      payload: {},\n",{"type":32,"tag":175,"props":8816,"children":8817},{"class":177,"line":343},[8818],{"type":32,"tag":175,"props":8819,"children":8820},{"style":188},[8821],{"type":45,"value":8822},"      context: {\n",{"type":32,"tag":175,"props":8824,"children":8825},{"class":177,"line":361},[8826],{"type":32,"tag":175,"props":8827,"children":8828},{"style":188},[8829],{"type":45,"value":8830},"        cloudflare: event.context.cloudflare\n",{"type":32,"tag":175,"props":8832,"children":8833},{"class":177,"line":378},[8834],{"type":32,"tag":175,"props":8835,"children":8836},{"style":188},[8837],{"type":45,"value":2543},{"type":32,"tag":175,"props":8839,"children":8840},{"class":177,"line":387},[8841],{"type":32,"tag":175,"props":8842,"children":8843},{"style":188},[8844],{"type":45,"value":1363},{"type":32,"tag":175,"props":8846,"children":8847},{"class":177,"line":402},[8848],{"type":32,"tag":175,"props":8849,"children":8850},{"style":188},[8851],{"type":45,"value":8852},"  );\n",{"type":32,"tag":175,"props":8854,"children":8855},{"class":177,"line":441},[8856],{"type":32,"tag":175,"props":8857,"children":8858},{"emptyLinePlaceholder":265},[8859],{"type":45,"value":268},{"type":32,"tag":175,"props":8861,"children":8862},{"class":177,"line":474},[8863,8867],{"type":32,"tag":175,"props":8864,"children":8865},{"style":182},[8866],{"type":45,"value":4456},{"type":32,"tag":175,"props":8868,"children":8869},{"style":188},[8870],{"type":45,"value":191},{"type":32,"tag":175,"props":8872,"children":8873},{"class":177,"line":1039},[8874,8879,8884],{"type":32,"tag":175,"props":8875,"children":8876},{"style":188},[8877],{"type":45,"value":8878},"    status: ",{"type":32,"tag":175,"props":8880,"children":8881},{"style":217},[8882],{"type":45,"value":8883},"'Agents Properties Sync Task Triggered'",{"type":32,"tag":175,"props":8885,"children":8886},{"style":188},[8887],{"type":45,"value":673},{"type":32,"tag":175,"props":8889,"children":8890},{"class":177,"line":1071},[8891],{"type":32,"tag":175,"props":8892,"children":8893},{"style":188},[8894],{"type":45,"value":8895},"    result,\n",{"type":32,"tag":175,"props":8897,"children":8898},{"class":177,"line":1079},[8899],{"type":32,"tag":175,"props":8900,"children":8901},{"style":188},[8902],{"type":45,"value":1372},{"type":32,"tag":175,"props":8904,"children":8905},{"class":177,"line":1113},[8906],{"type":32,"tag":175,"props":8907,"children":8908},{"style":188},[8909],{"type":45,"value":8910},"});\n",{"type":32,"tag":33,"props":8912,"children":8913},{},[8914],{"type":45,"value":8915},"Now we can deploy and test the property sync task with semantic matching:",{"type":32,"tag":164,"props":8917,"children":8919},{"className":5745,"code":8918,"language":5747,"meta":169,"style":169},"pnpm run build\n\nnpx wrangler deploy\n\ncurl -H \"x-secret: [YOUR_SECRET]\" \"https://[YOUR_WORKER_URL]/api/internals/tasks/agents-properties-sync\"\n",[8920],{"type":32,"tag":155,"props":8921,"children":8922},{"__ignoreMap":169},[8923,8940,8947,8963,8970],{"type":32,"tag":175,"props":8924,"children":8925},{"class":177,"line":178},[8926,8931,8935],{"type":32,"tag":175,"props":8927,"children":8928},{"style":391},[8929],{"type":45,"value":8930},"pnpm",{"type":32,"tag":175,"props":8932,"children":8933},{"style":217},[8934],{"type":45,"value":6224},{"type":32,"tag":175,"props":8936,"children":8937},{"style":217},[8938],{"type":45,"value":8939}," build\n",{"type":32,"tag":175,"props":8941,"children":8942},{"class":177,"line":194},[8943],{"type":32,"tag":175,"props":8944,"children":8945},{"emptyLinePlaceholder":265},[8946],{"type":45,"value":268},{"type":32,"tag":175,"props":8948,"children":8949},{"class":177,"line":203},[8950,8954,8958],{"type":32,"tag":175,"props":8951,"children":8952},{"style":391},[8953],{"type":45,"value":5759},{"type":32,"tag":175,"props":8955,"children":8956},{"style":217},[8957],{"type":45,"value":5764},{"type":32,"tag":175,"props":8959,"children":8960},{"style":217},[8961],{"type":45,"value":8962}," deploy\n",{"type":32,"tag":175,"props":8964,"children":8965},{"class":177,"line":223},[8966],{"type":32,"tag":175,"props":8967,"children":8968},{"emptyLinePlaceholder":265},[8969],{"type":45,"value":268},{"type":32,"tag":175,"props":8971,"children":8972},{"class":177,"line":235},[8973,8978,8983,8988],{"type":32,"tag":175,"props":8974,"children":8975},{"style":391},[8976],{"type":45,"value":8977},"curl",{"type":32,"tag":175,"props":8979,"children":8980},{"style":857},[8981],{"type":45,"value":8982}," -H",{"type":32,"tag":175,"props":8984,"children":8985},{"style":217},[8986],{"type":45,"value":8987}," \"x-secret: [YOUR_SECRET]\"",{"type":32,"tag":175,"props":8989,"children":8990},{"style":217},[8991],{"type":45,"value":8992}," \"https://[YOUR_WORKER_URL]/api/internals/tasks/agents-properties-sync\"\n",{"type":32,"tag":33,"props":8994,"children":8995},{},[8996,8998,9004],{"type":45,"value":8997},"Once the queue task is completed, you should see eight properties added to the database with the correct ",{"type":32,"tag":155,"props":8999,"children":9001},{"className":9000},[],[9002],{"type":45,"value":9003},"location_id",{"type":45,"value":9005},". 🎉",{"type":32,"tag":1754,"props":9007,"children":9008},{},[9009],{"type":32,"tag":33,"props":9010,"children":9011},{},[9012],{"type":45,"value":9013},"💡Although end-to-end testing using an endpoint is fine for this example, in real-world applications, I encourage you to use Vitest and mock the repositories for automated testing. You can also use a dedicated wrangler config for tests 😉",{"type":32,"tag":1763,"props":9015,"children":9018},{":sub-link":1765,"button-text":1766,"link":1767,"sub-link-text":1768,"text":9016,"title":9017},"Don't let the infrastructure details slow you down. I help your team cut through the complexity and ship a solid, scalable Nuxt application.","Do you need help with Nuxt?",[],{"type":32,"tag":9020,"props":9021,"children":9023},"h3",{"id":9022},"automating-nitro-tasks-with-cloudflare-cron-triggers",[9024],{"type":45,"value":9025},"Automating Nitro Tasks with Cloudflare Cron Triggers",{"type":32,"tag":33,"props":9027,"children":9028},{},[9029],{"type":45,"value":9030},"Now that we know our property sync service and semantic matching work, we can schedule the Nitro task to run periodically.",{"type":32,"tag":33,"props":9032,"children":9033},{},[9034,9036,9043,9045,9050],{"type":45,"value":9035},"We first need to add a ",{"type":32,"tag":48,"props":9037,"children":9040},{"href":9038,"rel":9039,"target":124},"https://developers.cloudflare.com/workers/configuration/cron-triggers/",[123],[9041],{"type":45,"value":9042},"Cron trigger event to Cloudflare",{"type":45,"value":9044}," via the ",{"type":32,"tag":155,"props":9046,"children":9048},{"className":9047},[],[9049],{"type":45,"value":5790},{"type":45,"value":9051}," :",{"type":32,"tag":164,"props":9053,"children":9055},{"className":5793,"code":9054,"language":5795,"meta":169,"style":169},"[triggers]\ncrons = [\"*/5 * * * *\"]\n",[9056],{"type":32,"tag":155,"props":9057,"children":9058},{"__ignoreMap":169},[9059,9067],{"type":32,"tag":175,"props":9060,"children":9061},{"class":177,"line":178},[9062],{"type":32,"tag":175,"props":9063,"children":9064},{"style":188},[9065],{"type":45,"value":9066},"[triggers]\n",{"type":32,"tag":175,"props":9068,"children":9069},{"class":177,"line":194},[9070,9075,9080],{"type":32,"tag":175,"props":9071,"children":9072},{"style":188},[9073],{"type":45,"value":9074},"crons = [",{"type":32,"tag":175,"props":9076,"children":9077},{"style":217},[9078],{"type":45,"value":9079},"\"*/5 * * * *\"",{"type":32,"tag":175,"props":9081,"children":9082},{"style":188},[9083],{"type":45,"value":1068},{"type":32,"tag":33,"props":9085,"children":9086},{},[9087,9089,9095],{"type":45,"value":9088},"And then configure Nuxt to run the sync Nitro Task in ",{"type":32,"tag":155,"props":9090,"children":9092},{"className":9091},[],[9093],{"type":45,"value":9094},"/nuxt-config.ts",{"type":45,"value":9051},{"type":32,"tag":164,"props":9097,"children":9099},{"className":166,"code":9098,"language":168,"meta":169,"style":169},"nitro: {\n  // ...\n  scheduledTasks: {\n  // Runs the 'agents-properties-sync' task every five minutes\n   '*/5 * * * *': ['agents-properties-sync']\n  }\n}\n",[9100],{"type":32,"tag":155,"props":9101,"children":9102},{"__ignoreMap":169},[9103,9111,9119,9127,9135,9156,9163],{"type":32,"tag":175,"props":9104,"children":9105},{"class":177,"line":178},[9106],{"type":32,"tag":175,"props":9107,"children":9108},{"style":188},[9109],{"type":45,"value":9110},"nitro: {\n",{"type":32,"tag":175,"props":9112,"children":9113},{"class":177,"line":194},[9114],{"type":32,"tag":175,"props":9115,"children":9116},{"style":300},[9117],{"type":45,"value":9118},"  // ...\n",{"type":32,"tag":175,"props":9120,"children":9121},{"class":177,"line":203},[9122],{"type":32,"tag":175,"props":9123,"children":9124},{"style":188},[9125],{"type":45,"value":9126},"  scheduledTasks: {\n",{"type":32,"tag":175,"props":9128,"children":9129},{"class":177,"line":223},[9130],{"type":32,"tag":175,"props":9131,"children":9132},{"style":300},[9133],{"type":45,"value":9134},"  // Runs the 'agents-properties-sync' task every five minutes\n",{"type":32,"tag":175,"props":9136,"children":9137},{"class":177,"line":235},[9138,9143,9148,9152],{"type":32,"tag":175,"props":9139,"children":9140},{"style":217},[9141],{"type":45,"value":9142},"   '*/5 * * * *'",{"type":32,"tag":175,"props":9144,"children":9145},{"style":188},[9146],{"type":45,"value":9147},": [",{"type":32,"tag":175,"props":9149,"children":9150},{"style":217},[9151],{"type":45,"value":6182},{"type":32,"tag":175,"props":9153,"children":9154},{"style":188},[9155],{"type":45,"value":1068},{"type":32,"tag":175,"props":9157,"children":9158},{"class":177,"line":244},[9159],{"type":32,"tag":175,"props":9160,"children":9161},{"style":188},[9162],{"type":45,"value":1372},{"type":32,"tag":175,"props":9164,"children":9165},{"class":177,"line":261},[9166],{"type":32,"tag":175,"props":9167,"children":9168},{"style":188},[9169],{"type":45,"value":480},{"type":32,"tag":33,"props":9171,"children":9172},{},[9173],{"type":45,"value":9174},"Once you build and deploy the app, you can see your task running every 5 minutes in Cloudflare’s dashboard, from the worker observability tab.",{"type":32,"tag":143,"props":9176,"children":9178},{"id":9177},"we-built-an-ai-powered-data-pipeline",[9179],{"type":45,"value":9180},"We built an AI-powered data pipeline",{"type":32,"tag":33,"props":9182,"children":9183},{},[9184],{"type":45,"value":9185},"Over this three-part series, we built the backend of our property listing aggregator in Nuxt and covered a lot of Cloudflare’s offerings.",{"type":32,"tag":33,"props":9187,"children":9188},{},[9189],{"type":45,"value":9190},"We successfully:",{"type":32,"tag":9192,"props":9193,"children":9194},"ol",{},[9195,9205,9215],{"type":32,"tag":74,"props":9196,"children":9197},{},[9198,9203],{"type":32,"tag":62,"props":9199,"children":9200},{},[9201],{"type":45,"value":9202},"Structured our Data",{"type":45,"value":9204}," using D1 and Drizzle ORM.",{"type":32,"tag":74,"props":9206,"children":9207},{},[9208,9213],{"type":32,"tag":62,"props":9209,"children":9210},{},[9211],{"type":45,"value":9212},"Decoupled our Logic",{"type":45,"value":9214}," using Cloudflare Queues for background processing.",{"type":32,"tag":74,"props":9216,"children":9217},{},[9218,9223],{"type":32,"tag":62,"props":9219,"children":9220},{},[9221],{"type":45,"value":9222},"Implemented semantic matching",{"type":45,"value":9224}," using Cloudflare Vectorize and Workers AI.",{"type":32,"tag":33,"props":9226,"children":9227},{},[9228],{"type":45,"value":9229},"With this example application, you've gained the foundation to build scalable and resilient Nuxt applications running on Cloudflare infrastructure. Most importantly, you learnt how semantic matching works alongside deterministic string matching and should be able to integrate AI into your future Nuxt projects.",{"type":32,"tag":33,"props":9231,"children":9232},{},[9233,9234,9242],{"type":45,"value":118},{"type":32,"tag":48,"props":9235,"children":9237},{"href":121,"rel":9236,":target":124},[123],[9238],{"type":32,"tag":62,"props":9239,"children":9240},{},[9241],{"type":45,"value":66},{"type":45,"value":9243},", Let me know in the comments if you are building something similar or if you’d like to write more about Nuxt, Cloudflare or AI integrations in general.",{"type":32,"tag":33,"props":9245,"children":9246},{},[9247],{"type":45,"value":9248},"Until next time 💙.",{"type":32,"tag":3905,"props":9250,"children":9253},{"text":9251,"title":9252},"Subscribe to my newsletter for more articles, tutorials, and tips on building with Nuxt and AI.","Stay updated with the latest Nuxt & AI insights",[],{"type":32,"tag":9255,"props":9256,"children":9257},"style",{},[9258],{"type":45,"value":9259},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":169,"searchDepth":194,"depth":194,"links":9261},[9262,9263,9264,9267],{"id":145,"depth":194,"text":148},{"id":1739,"depth":194,"text":1742},{"id":3910,"depth":194,"text":3913,"children":9265},[9266],{"id":9022,"depth":203,"text":9025},{"id":9177,"depth":194,"text":9180},"markdown","content:blog:12.nuxt-cloudflare-vectorize-semantic-matching:index.md","content","blog/12.nuxt-cloudflare-vectorize-semantic-matching/index.md","blog/12.nuxt-cloudflare-vectorize-semantic-matching/index","md",[9275,9280,9285],{"_path":26,"title":103,"date":9276,"preview_image":9277,"featured_image":9278,"_id":9279},"2025-12-20","/nuxt-cloudflare-queues-data-sync-pipeline/nuxt-cloudflare-queues-data-sync-pipeline.webp","/nuxt-cloudflare-queues-data-sync-pipeline/nuxt-cloudflare-queues-data-sync-pipeline_featured.webp","content:blog:11.nuxt-cloudflare-queues-and-vectorize-data-sync-pipeline:index.md",{"_path":25,"title":89,"date":9281,"preview_image":9282,"featured_image":9283,"_id":9284},"2025-12-19","/nuxt-cloudflare-vectorize-d1-drizzle-setup/nuxt-cloudflare-vectorize-d1-drizzle-setup.webp","/nuxt-cloudflare-vectorize-d1-drizzle-setup/nuxt-cloudflare-vectorize-d1-drizzle-setup_featured.webp","content:blog:10.nuxt-and-cloudflare-vectorize-setting-up-d1-drizzle-and-workers-ai:index.md",{"_path":27,"title":9286,"date":9287,"preview_image":9288,"_id":9289},"Build and deploy a static online shop with Nuxt3 using Pinia Store and Stripe Checkout to Firebase","2022-11-13","/build-and-deploy-nuxt3-static-site-with-pinia-and-stripe-checkout-on-firebase/nuxt3-static-shop.png","content:blog:9.build-and-deploy-nuxt3-static-site-with-pinia-and-stripe-checkout-on-firebase:index.md",1776233981200]