[{"data":1,"prerenderedAt":831},["ShallowReactive",2],{"navigation_docs":3,"-guides-multiple-forges":199,"-guides-multiple-forges-surround":826},[4,23,65,87,133,159,177],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":22},"Getting started","i-lucide-rocket","\u002Fgetting-started","1.getting-started",[10,14,18],{"title":11,"path":12,"stem":13},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction",{"title":15,"path":16,"stem":17},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation",{"title":19,"path":20,"stem":21},"Quick start","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F3.quick-start",false,{"title":24,"icon":25,"path":26,"stem":27,"children":28,"page":22},"Guides","i-lucide-compass","\u002Fguides","2.guides",[29,33,37,41,45,49,53,57,61],{"title":30,"path":31,"stem":32},"Authenticate","\u002Fguides\u002Fauthentication","2.guides\u002F1.authentication",{"title":34,"path":35,"stem":36},"Work with several forges","\u002Fguides\u002Fmultiple-forges","2.guides\u002F2.multiple-forges",{"title":38,"path":39,"stem":40},"Configure from the environment","\u002Fguides\u002Fenvironment","2.guides\u002F3.environment",{"title":42,"path":43,"stem":44},"Receive webhooks","\u002Fguides\u002Fwebhooks","2.guides\u002F4.webhooks",{"title":46,"path":47,"stem":48},"Check what a forge supports","\u002Fguides\u002Fcapabilities","2.guides\u002F5.capabilities",{"title":50,"path":51,"stem":52},"Handle errors and rate limits","\u002Fguides\u002Ferrors","2.guides\u002F6.errors",{"title":54,"path":55,"stem":56},"Page through results","\u002Fguides\u002Fpagination","2.guides\u002F7.pagination",{"title":58,"path":59,"stem":60},"Browser bundles","\u002Fguides\u002Fbundling","2.guides\u002F8.bundling",{"title":62,"path":63,"stem":64},"Test your code","\u002Fguides\u002Ftesting","2.guides\u002F9.testing",{"title":66,"icon":67,"path":68,"stem":69,"children":70,"page":22},"Concepts","i-lucide-lightbulb","\u002Fconcepts","3.concepts",[71,75,79,83],{"title":72,"path":73,"stem":74},"Data model","\u002Fconcepts\u002Fdata-model","3.concepts\u002F1.data-model",{"title":76,"path":77,"stem":78},"Capabilities","\u002Fconcepts\u002Fcapabilities","3.concepts\u002F2.capabilities",{"title":80,"path":81,"stem":82},"Providers and factories","\u002Fconcepts\u002Fproviders","3.concepts\u002F3.providers",{"title":84,"path":85,"stem":86},"Events","\u002Fconcepts\u002Fevents","3.concepts\u002F4.events",{"title":88,"icon":89,"path":90,"stem":91,"children":92,"page":22},"Providers","i-lucide-server","\u002Fproviders","4.providers",[93,97,101,105,109,113,117,121,125,129],{"title":94,"path":95,"stem":96},"Azure DevOps","\u002Fproviders\u002Fazure-devops","4.providers\u002Fazure-devops",{"title":98,"path":99,"stem":100},"Bitbucket Cloud","\u002Fproviders\u002Fbitbucket","4.providers\u002Fbitbucket",{"title":102,"path":103,"stem":104},"Cursor Origin","\u002Fproviders\u002Fcursor-origin","4.providers\u002Fcursor-origin",{"title":106,"path":107,"stem":108},"Forgejo and Codeberg","\u002Fproviders\u002Fforgejo","4.providers\u002Fforgejo",{"title":110,"path":111,"stem":112},"Gitea","\u002Fproviders\u002Fgitea","4.providers\u002Fgitea",{"title":114,"path":115,"stem":116},"Gitee","\u002Fproviders\u002Fgitee","4.providers\u002Fgitee",{"title":118,"path":119,"stem":120},"GitHub","\u002Fproviders\u002Fgithub","4.providers\u002Fgithub",{"title":122,"path":123,"stem":124},"GitLab","\u002Fproviders\u002Fgitlab","4.providers\u002Fgitlab",{"title":126,"path":127,"stem":128},"pushin.eu","\u002Fproviders\u002Fpushin","4.providers\u002Fpushin",{"title":130,"path":131,"stem":132},"Tangled","\u002Fproviders\u002Ftangled","4.providers\u002Ftangled",{"title":134,"icon":135,"path":136,"stem":137,"children":138,"page":22},"Reference","i-lucide-book-marked","\u002Freference","5.reference",[139,143,147,151,155],{"title":140,"path":141,"stem":142},"Provider API","\u002Freference\u002Fprovider-api","5.reference\u002F1.provider-api",{"title":144,"path":145,"stem":146},"Capability matrix","\u002Freference\u002Fcapability-matrix","5.reference\u002F2.capability-matrix",{"title":148,"path":149,"stem":150},"Errors","\u002Freference\u002Ferrors","5.reference\u002F3.errors",{"title":152,"path":153,"stem":154},"Environment variables","\u002Freference\u002Fenvironment-variables","5.reference\u002F4.environment-variables",{"title":156,"path":157,"stem":158},"JSON Schemas","\u002Freference\u002Fjson-schemas","5.reference\u002F5.json-schemas",{"title":160,"icon":161,"path":162,"stem":163,"children":164,"page":22},"Examples","i-lucide-boxes","\u002Fexamples","6.examples",[165,169,173],{"title":166,"path":167,"stem":168},"Inbox CLI","\u002Fexamples\u002Finbox-cli","6.examples\u002F1.inbox-cli",{"title":170,"path":171,"stem":172},"Label bot","\u002Fexamples\u002Flabel-bot","6.examples\u002F2.label-bot",{"title":174,"path":175,"stem":176},"Release digest","\u002Fexamples\u002Frelease-digest","6.examples\u002F3.release-digest",{"title":178,"icon":179,"path":180,"stem":181,"children":182,"page":22},"Contributing","i-lucide-git-pull-request","\u002Fcontributing","7.contributing",[183,187,191,195],{"title":184,"path":185,"stem":186},"Contribution guide","\u002Fcontributing\u002Fguidelines","7.contributing\u002F1.guidelines",{"title":188,"path":189,"stem":190},"Write a provider","\u002Fcontributing\u002Fwrite-a-provider","7.contributing\u002F2.write-a-provider",{"title":192,"path":193,"stem":194},"Record fixtures","\u002Fcontributing\u002Frecord-fixtures","7.contributing\u002F3.record-fixtures",{"title":196,"path":197,"stem":198},"Contributors","\u002Fcontributing\u002Fcontributors","7.contributing\u002F4.contributors",{"id":200,"title":34,"body":201,"description":819,"extension":820,"links":821,"meta":822,"navigation":270,"path":35,"seo":824,"stem":36,"__hash__":825},"docs\u002F2.guides\u002F2.multiple-forges.md",{"type":202,"value":203,"toc":813},"minimark",[204,212,418,423,444,458,564,568,578,673,680,684,687,712,716,723,801,809],[205,206,207,211],"p",{},[208,209,210],"code",{},"createForges()"," takes a list of factories, or of providers you already created. It builds the providers and returns an object that routes calls:",[213,214,219],"pre",{"className":215,"code":216,"language":217,"meta":218,"style":218},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { createForges, github, gitlab } from 'forges'\n\nconst forges = createForges([\n  github({ auth: { type: 'token', token: process.env.GITHUB_TOKEN! } }),\n  gitlab({ auth: { type: 'token', token: process.env.GITLAB_TOKEN! } }),\n])\n","ts","",[208,220,221,265,272,291,359,412],{"__ignoreMap":218},[222,223,226,230,234,238,241,244,246,249,252,255,258,262],"span",{"class":224,"line":225},"line",1,[222,227,229],{"class":228},"s7zQu","import",[222,231,233],{"class":232},"sMK4o"," {",[222,235,237],{"class":236},"sTEyZ"," createForges",[222,239,240],{"class":232},",",[222,242,243],{"class":236}," github",[222,245,240],{"class":232},[222,247,248],{"class":236}," gitlab",[222,250,251],{"class":232}," }",[222,253,254],{"class":228}," from",[222,256,257],{"class":232}," '",[222,259,261],{"class":260},"sfazB","forges",[222,263,264],{"class":232},"'\n",[222,266,268],{"class":224,"line":267},2,[222,269,271],{"emptyLinePlaceholder":270},true,"\n",[222,273,275,279,282,285,288],{"class":224,"line":274},3,[222,276,278],{"class":277},"spNyl","const",[222,280,281],{"class":236}," forges ",[222,283,284],{"class":232},"=",[222,286,237],{"class":287},"s2Zo4",[222,289,290],{"class":236},"([\n",[222,292,294,297,300,303,307,310,312,315,317,319,322,325,327,330,332,335,338,341,343,346,349,351,353,356],{"class":224,"line":293},4,[222,295,296],{"class":287},"  github",[222,298,299],{"class":236},"(",[222,301,302],{"class":232},"{",[222,304,306],{"class":305},"swJcz"," auth",[222,308,309],{"class":232},":",[222,311,233],{"class":232},[222,313,314],{"class":305}," type",[222,316,309],{"class":232},[222,318,257],{"class":232},[222,320,321],{"class":260},"token",[222,323,324],{"class":232},"'",[222,326,240],{"class":232},[222,328,329],{"class":305}," token",[222,331,309],{"class":232},[222,333,334],{"class":236}," process",[222,336,337],{"class":232},".",[222,339,340],{"class":236},"env",[222,342,337],{"class":232},[222,344,345],{"class":236},"GITHUB_TOKEN",[222,347,348],{"class":232},"!",[222,350,251],{"class":232},[222,352,251],{"class":232},[222,354,355],{"class":236},")",[222,357,358],{"class":232},",\n",[222,360,362,365,367,369,371,373,375,377,379,381,383,385,387,389,391,393,395,397,399,402,404,406,408,410],{"class":224,"line":361},5,[222,363,364],{"class":287},"  gitlab",[222,366,299],{"class":236},[222,368,302],{"class":232},[222,370,306],{"class":305},[222,372,309],{"class":232},[222,374,233],{"class":232},[222,376,314],{"class":305},[222,378,309],{"class":232},[222,380,257],{"class":232},[222,382,321],{"class":260},[222,384,324],{"class":232},[222,386,240],{"class":232},[222,388,329],{"class":305},[222,390,309],{"class":232},[222,392,334],{"class":236},[222,394,337],{"class":232},[222,396,340],{"class":236},[222,398,337],{"class":232},[222,400,401],{"class":236},"GITLAB_TOKEN",[222,403,348],{"class":232},[222,405,251],{"class":232},[222,407,251],{"class":232},[222,409,355],{"class":236},[222,411,358],{"class":232},[222,413,415],{"class":224,"line":414},6,[222,416,417],{"class":236},"])\n",[419,420,422],"h2",{"id":421},"route-by-ref","Route by ref",[205,424,425,426,429,430,433,434,429,437,440,441,337],{},"Every ref carries ",[208,427,428],{},"forge"," and ",[208,431,432],{},"instance",". Calls such as ",[208,435,436],{},"forges.threads.get(ref)",[208,438,439],{},"forges.repos.get(ref)"," go to the provider that matches. A ref for an unregistered forge throws ",[208,442,443],{},"UnknownForgeError",[205,445,446,447,450,451,454,455,309],{},"To get the provider itself, use ",[208,448,449],{},"forges.for(ref)",", ",[208,452,453],{},"forges.get('github')",", or ",[208,456,457],{},"forges.all('gitlab')",[213,459,461],{"className":215,"code":460,"language":217,"meta":218,"style":218},"const provider = forges.for(thread.ref)\nif (provider?.can('threads.close', thread.ref.kind)) {\n  await provider.threads.close(thread.ref)\n}\n",[208,462,463,488,529,559],{"__ignoreMap":218},[222,464,465,467,470,472,475,477,480,483,485],{"class":224,"line":225},[222,466,278],{"class":277},[222,468,469],{"class":236}," provider ",[222,471,284],{"class":232},[222,473,474],{"class":236}," forges",[222,476,337],{"class":232},[222,478,479],{"class":287},"for",[222,481,482],{"class":236},"(thread",[222,484,337],{"class":232},[222,486,487],{"class":236},"ref)\n",[222,489,490,493,496,499,502,504,506,509,511,513,516,518,521,523,526],{"class":224,"line":267},[222,491,492],{"class":228},"if",[222,494,495],{"class":236}," (provider",[222,497,498],{"class":232},"?.",[222,500,501],{"class":287},"can",[222,503,299],{"class":236},[222,505,324],{"class":232},[222,507,508],{"class":260},"threads.close",[222,510,324],{"class":232},[222,512,240],{"class":232},[222,514,515],{"class":236}," thread",[222,517,337],{"class":232},[222,519,520],{"class":236},"ref",[222,522,337],{"class":232},[222,524,525],{"class":236},"kind)) ",[222,527,528],{"class":232},"{\n",[222,530,531,534,537,539,542,544,547,549,552,554,556],{"class":224,"line":274},[222,532,533],{"class":228},"  await",[222,535,536],{"class":236}," provider",[222,538,337],{"class":232},[222,540,541],{"class":236},"threads",[222,543,337],{"class":232},[222,545,546],{"class":287},"close",[222,548,299],{"class":305},[222,550,551],{"class":236},"thread",[222,553,337],{"class":232},[222,555,520],{"class":236},[222,557,558],{"class":305},")\n",[222,560,561],{"class":224,"line":293},[222,562,563],{"class":232},"}\n",[419,565,567],{"id":566},"read-a-pasted-url","Read a pasted URL",[205,569,570,573,574,577],{},[208,571,572],{},"forges.parseUrl()"," turns a web URL on any registered instance into refs. It returns ",[208,575,576],{},"undefined"," for a URL that no provider serves:",[213,579,581],{"className":215,"code":580,"language":217,"meta":218,"style":218},"const parsed = forges.parseUrl('https:\u002F\u002Fgithub.com\u002Fnuxt\u002Fnuxt\u002Fissues\u002F1')\n\nif (parsed?.thread) {\n  const thread = await parsed.provider.threads.get(parsed.thread)\n}\n",[208,582,583,610,614,628,669],{"__ignoreMap":218},[222,584,585,587,590,592,594,596,599,601,603,606,608],{"class":224,"line":225},[222,586,278],{"class":277},[222,588,589],{"class":236}," parsed ",[222,591,284],{"class":232},[222,593,474],{"class":236},[222,595,337],{"class":232},[222,597,598],{"class":287},"parseUrl",[222,600,299],{"class":236},[222,602,324],{"class":232},[222,604,605],{"class":260},"https:\u002F\u002Fgithub.com\u002Fnuxt\u002Fnuxt\u002Fissues\u002F1",[222,607,324],{"class":232},[222,609,558],{"class":236},[222,611,612],{"class":224,"line":267},[222,613,271],{"emptyLinePlaceholder":270},[222,615,616,618,621,623,626],{"class":224,"line":274},[222,617,492],{"class":228},[222,619,620],{"class":236}," (parsed",[222,622,498],{"class":232},[222,624,625],{"class":236},"thread) ",[222,627,528],{"class":232},[222,629,630,633,635,638,641,644,646,649,651,653,655,658,660,663,665,667],{"class":224,"line":293},[222,631,632],{"class":277},"  const",[222,634,515],{"class":236},[222,636,637],{"class":232}," =",[222,639,640],{"class":228}," await",[222,642,643],{"class":236}," parsed",[222,645,337],{"class":232},[222,647,648],{"class":236},"provider",[222,650,337],{"class":232},[222,652,541],{"class":236},[222,654,337],{"class":232},[222,656,657],{"class":287},"get",[222,659,299],{"class":305},[222,661,662],{"class":236},"parsed",[222,664,337],{"class":232},[222,666,551],{"class":236},[222,668,558],{"class":305},[222,670,671],{"class":224,"line":361},[222,672,563],{"class":232},[205,674,675,676,679],{},"The reverse is ",[208,677,678],{},"provider.urlFor()",", which builds a web URL from a ref without a request.",[419,681,683],{"id":682},"fan-out-reads","Fan out reads",[205,685,686],{},"Some calls run on every provider that supports them:",[688,689,690,697,706],"ul",{},[691,692,693,696],"li",{},[208,694,695],{},"forges.notifications.list()"," lists notifications provider by provider.",[691,698,699,429,702,705],{},[208,700,701],{},"forges.search.threads()",[208,703,704],{},"forges.search.repos()"," read one page from each provider that supports search, and merge the results, newest first. A provider that fails adds a warning and no items.",[691,707,708,711],{},[208,709,710],{},"forges.threads.getMany()"," groups refs by provider and keeps the input order.",[419,713,715],{"id":714},"run-two-instances-of-one-forge","Run two instances of one forge",[205,717,718,719,722],{},"A provider takes its instance from the host of ",[208,720,721],{},"baseUrl",", so github.com and a GitHub Enterprise Server can be registered together:",[213,724,726],{"className":215,"code":725,"language":217,"meta":218,"style":218},"const forges = createForges([\n  github({ auth: personal }),\n  github({ baseUrl: 'https:\u002F\u002Fghe.example.com\u002Fapi\u002Fv3', auth: work }),\n])\n",[208,727,728,740,762,797],{"__ignoreMap":218},[222,729,730,732,734,736,738],{"class":224,"line":225},[222,731,278],{"class":277},[222,733,281],{"class":236},[222,735,284],{"class":232},[222,737,237],{"class":287},[222,739,290],{"class":236},[222,741,742,744,746,748,750,752,755,758,760],{"class":224,"line":267},[222,743,296],{"class":287},[222,745,299],{"class":236},[222,747,302],{"class":232},[222,749,306],{"class":305},[222,751,309],{"class":232},[222,753,754],{"class":236}," personal ",[222,756,757],{"class":232},"}",[222,759,355],{"class":236},[222,761,358],{"class":232},[222,763,764,766,768,770,773,775,777,780,782,784,786,788,791,793,795],{"class":224,"line":274},[222,765,296],{"class":287},[222,767,299],{"class":236},[222,769,302],{"class":232},[222,771,772],{"class":305}," baseUrl",[222,774,309],{"class":232},[222,776,257],{"class":232},[222,778,779],{"class":260},"https:\u002F\u002Fghe.example.com\u002Fapi\u002Fv3",[222,781,324],{"class":232},[222,783,240],{"class":232},[222,785,306],{"class":305},[222,787,309],{"class":232},[222,789,790],{"class":236}," work ",[222,792,757],{"class":232},[222,794,355],{"class":236},[222,796,358],{"class":232},[222,798,799],{"class":224,"line":293},[222,800,417],{"class":236},[205,802,803,805,806,808],{},[208,804,210],{}," throws when two providers share a forge and an instance. To register two providers for the same host, pass a different ",[208,807,432],{}," to one of them.",[810,811,812],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}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);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":218,"searchDepth":267,"depth":267,"links":814},[815,816,817,818],{"id":421,"depth":267,"text":422},{"id":566,"depth":267,"text":567},{"id":682,"depth":267,"text":683},{"id":714,"depth":267,"text":715},"Register several providers and route calls by ref or by URL.","md",null,{"icon":823},"i-lucide-layers",{"title":34,"description":819},"y00E0_LdRY95X57ptepaDFKBESdAYu5JcWLRpPu7esE",[827,829],{"title":30,"path":31,"stem":32,"description":828,"children":-1},"Pass credentials to a provider, and limit what they can do.",{"title":38,"path":39,"stem":40,"description":830,"children":-1},"Create providers from FORGES_* environment variables.",1791296694008]