[{"data":1,"prerenderedAt":827},["ShallowReactive",2],{"navigation_docs":3,"-guides-multiple-forges":195,"-guides-multiple-forges-surround":822},[4,23,65,87,133,155,173],{"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],{"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},"JSON Schemas","\u002Freference\u002Fjson-schemas","5.reference\u002F5.json-schemas",{"title":156,"icon":157,"path":158,"stem":159,"children":160,"page":22},"Examples","i-lucide-boxes","\u002Fexamples","6.examples",[161,165,169],{"title":162,"path":163,"stem":164},"Inbox CLI","\u002Fexamples\u002Finbox-cli","6.examples\u002F1.inbox-cli",{"title":166,"path":167,"stem":168},"Label bot","\u002Fexamples\u002Flabel-bot","6.examples\u002F2.label-bot",{"title":170,"path":171,"stem":172},"Release digest","\u002Fexamples\u002Frelease-digest","6.examples\u002F3.release-digest",{"title":174,"icon":175,"path":176,"stem":177,"children":178,"page":22},"Contributing","i-lucide-git-pull-request","\u002Fcontributing","7.contributing",[179,183,187,191],{"title":180,"path":181,"stem":182},"Contribution guide","\u002Fcontributing\u002Fguidelines","7.contributing\u002F1.guidelines",{"title":184,"path":185,"stem":186},"Write a provider","\u002Fcontributing\u002Fwrite-a-provider","7.contributing\u002F2.write-a-provider",{"title":188,"path":189,"stem":190},"Record fixtures","\u002Fcontributing\u002Frecord-fixtures","7.contributing\u002F3.record-fixtures",{"title":192,"path":193,"stem":194},"Contributors","\u002Fcontributing\u002Fcontributors","7.contributing\u002F4.contributors",{"id":196,"title":34,"body":197,"description":815,"extension":816,"links":817,"meta":818,"navigation":266,"path":35,"seo":820,"stem":36,"__hash__":821},"docs\u002F2.guides\u002F2.multiple-forges.md",{"type":198,"value":199,"toc":809},"minimark",[200,208,414,419,440,454,560,564,574,669,676,680,683,708,712,719,797,805],[201,202,203,207],"p",{},[204,205,206],"code",{},"createForges()"," takes a list of factories, or of providers you already created. It builds the providers and returns an object that routes calls:",[209,210,215],"pre",{"className":211,"code":212,"language":213,"meta":214,"style":214},"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","",[204,216,217,261,268,287,355,408],{"__ignoreMap":214},[218,219,222,226,230,234,237,240,242,245,248,251,254,258],"span",{"class":220,"line":221},"line",1,[218,223,225],{"class":224},"s7zQu","import",[218,227,229],{"class":228},"sMK4o"," {",[218,231,233],{"class":232},"sTEyZ"," createForges",[218,235,236],{"class":228},",",[218,238,239],{"class":232}," github",[218,241,236],{"class":228},[218,243,244],{"class":232}," gitlab",[218,246,247],{"class":228}," }",[218,249,250],{"class":224}," from",[218,252,253],{"class":228}," '",[218,255,257],{"class":256},"sfazB","forges",[218,259,260],{"class":228},"'\n",[218,262,264],{"class":220,"line":263},2,[218,265,267],{"emptyLinePlaceholder":266},true,"\n",[218,269,271,275,278,281,284],{"class":220,"line":270},3,[218,272,274],{"class":273},"spNyl","const",[218,276,277],{"class":232}," forges ",[218,279,280],{"class":228},"=",[218,282,233],{"class":283},"s2Zo4",[218,285,286],{"class":232},"([\n",[218,288,290,293,296,299,303,306,308,311,313,315,318,321,323,326,328,331,334,337,339,342,345,347,349,352],{"class":220,"line":289},4,[218,291,292],{"class":283},"  github",[218,294,295],{"class":232},"(",[218,297,298],{"class":228},"{",[218,300,302],{"class":301},"swJcz"," auth",[218,304,305],{"class":228},":",[218,307,229],{"class":228},[218,309,310],{"class":301}," type",[218,312,305],{"class":228},[218,314,253],{"class":228},[218,316,317],{"class":256},"token",[218,319,320],{"class":228},"'",[218,322,236],{"class":228},[218,324,325],{"class":301}," token",[218,327,305],{"class":228},[218,329,330],{"class":232}," process",[218,332,333],{"class":228},".",[218,335,336],{"class":232},"env",[218,338,333],{"class":228},[218,340,341],{"class":232},"GITHUB_TOKEN",[218,343,344],{"class":228},"!",[218,346,247],{"class":228},[218,348,247],{"class":228},[218,350,351],{"class":232},")",[218,353,354],{"class":228},",\n",[218,356,358,361,363,365,367,369,371,373,375,377,379,381,383,385,387,389,391,393,395,398,400,402,404,406],{"class":220,"line":357},5,[218,359,360],{"class":283},"  gitlab",[218,362,295],{"class":232},[218,364,298],{"class":228},[218,366,302],{"class":301},[218,368,305],{"class":228},[218,370,229],{"class":228},[218,372,310],{"class":301},[218,374,305],{"class":228},[218,376,253],{"class":228},[218,378,317],{"class":256},[218,380,320],{"class":228},[218,382,236],{"class":228},[218,384,325],{"class":301},[218,386,305],{"class":228},[218,388,330],{"class":232},[218,390,333],{"class":228},[218,392,336],{"class":232},[218,394,333],{"class":228},[218,396,397],{"class":232},"GITLAB_TOKEN",[218,399,344],{"class":228},[218,401,247],{"class":228},[218,403,247],{"class":228},[218,405,351],{"class":232},[218,407,354],{"class":228},[218,409,411],{"class":220,"line":410},6,[218,412,413],{"class":232},"])\n",[415,416,418],"h2",{"id":417},"route-by-ref","Route by ref",[201,420,421,422,425,426,429,430,425,433,436,437,333],{},"Every ref carries ",[204,423,424],{},"forge"," and ",[204,427,428],{},"instance",". Calls such as ",[204,431,432],{},"forges.threads.get(ref)",[204,434,435],{},"forges.repos.get(ref)"," go to the provider that matches. A ref for an unregistered forge throws ",[204,438,439],{},"UnknownForgeError",[201,441,442,443,446,447,450,451,305],{},"To get the provider itself, use ",[204,444,445],{},"forges.for(ref)",", ",[204,448,449],{},"forges.get('github')",", or ",[204,452,453],{},"forges.all('gitlab')",[209,455,457],{"className":211,"code":456,"language":213,"meta":214,"style":214},"const provider = forges.for(thread.ref)\nif (provider?.can('threads.close', thread.ref.kind)) {\n  await provider.threads.close(thread.ref)\n}\n",[204,458,459,484,525,555],{"__ignoreMap":214},[218,460,461,463,466,468,471,473,476,479,481],{"class":220,"line":221},[218,462,274],{"class":273},[218,464,465],{"class":232}," provider ",[218,467,280],{"class":228},[218,469,470],{"class":232}," forges",[218,472,333],{"class":228},[218,474,475],{"class":283},"for",[218,477,478],{"class":232},"(thread",[218,480,333],{"class":228},[218,482,483],{"class":232},"ref)\n",[218,485,486,489,492,495,498,500,502,505,507,509,512,514,517,519,522],{"class":220,"line":263},[218,487,488],{"class":224},"if",[218,490,491],{"class":232}," (provider",[218,493,494],{"class":228},"?.",[218,496,497],{"class":283},"can",[218,499,295],{"class":232},[218,501,320],{"class":228},[218,503,504],{"class":256},"threads.close",[218,506,320],{"class":228},[218,508,236],{"class":228},[218,510,511],{"class":232}," thread",[218,513,333],{"class":228},[218,515,516],{"class":232},"ref",[218,518,333],{"class":228},[218,520,521],{"class":232},"kind)) ",[218,523,524],{"class":228},"{\n",[218,526,527,530,533,535,538,540,543,545,548,550,552],{"class":220,"line":270},[218,528,529],{"class":224},"  await",[218,531,532],{"class":232}," provider",[218,534,333],{"class":228},[218,536,537],{"class":232},"threads",[218,539,333],{"class":228},[218,541,542],{"class":283},"close",[218,544,295],{"class":301},[218,546,547],{"class":232},"thread",[218,549,333],{"class":228},[218,551,516],{"class":232},[218,553,554],{"class":301},")\n",[218,556,557],{"class":220,"line":289},[218,558,559],{"class":228},"}\n",[415,561,563],{"id":562},"read-a-pasted-url","Read a pasted URL",[201,565,566,569,570,573],{},[204,567,568],{},"forges.parseUrl()"," turns a web URL on any registered instance into refs. It returns ",[204,571,572],{},"undefined"," for a URL that no provider serves:",[209,575,577],{"className":211,"code":576,"language":213,"meta":214,"style":214},"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",[204,578,579,606,610,624,665],{"__ignoreMap":214},[218,580,581,583,586,588,590,592,595,597,599,602,604],{"class":220,"line":221},[218,582,274],{"class":273},[218,584,585],{"class":232}," parsed ",[218,587,280],{"class":228},[218,589,470],{"class":232},[218,591,333],{"class":228},[218,593,594],{"class":283},"parseUrl",[218,596,295],{"class":232},[218,598,320],{"class":228},[218,600,601],{"class":256},"https:\u002F\u002Fgithub.com\u002Fnuxt\u002Fnuxt\u002Fissues\u002F1",[218,603,320],{"class":228},[218,605,554],{"class":232},[218,607,608],{"class":220,"line":263},[218,609,267],{"emptyLinePlaceholder":266},[218,611,612,614,617,619,622],{"class":220,"line":270},[218,613,488],{"class":224},[218,615,616],{"class":232}," (parsed",[218,618,494],{"class":228},[218,620,621],{"class":232},"thread) ",[218,623,524],{"class":228},[218,625,626,629,631,634,637,640,642,645,647,649,651,654,656,659,661,663],{"class":220,"line":289},[218,627,628],{"class":273},"  const",[218,630,511],{"class":232},[218,632,633],{"class":228}," =",[218,635,636],{"class":224}," await",[218,638,639],{"class":232}," parsed",[218,641,333],{"class":228},[218,643,644],{"class":232},"provider",[218,646,333],{"class":228},[218,648,537],{"class":232},[218,650,333],{"class":228},[218,652,653],{"class":283},"get",[218,655,295],{"class":301},[218,657,658],{"class":232},"parsed",[218,660,333],{"class":228},[218,662,547],{"class":232},[218,664,554],{"class":301},[218,666,667],{"class":220,"line":357},[218,668,559],{"class":228},[201,670,671,672,675],{},"The reverse is ",[204,673,674],{},"provider.urlFor()",", which builds a web URL from a ref without a request.",[415,677,679],{"id":678},"fan-out-reads","Fan out reads",[201,681,682],{},"Some calls run on every provider that supports them:",[684,685,686,693,702],"ul",{},[687,688,689,692],"li",{},[204,690,691],{},"forges.notifications.list()"," lists notifications provider by provider.",[687,694,695,425,698,701],{},[204,696,697],{},"forges.search.threads()",[204,699,700],{},"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.",[687,703,704,707],{},[204,705,706],{},"forges.threads.getMany()"," groups refs by provider and keeps the input order.",[415,709,711],{"id":710},"run-two-instances-of-one-forge","Run two instances of one forge",[201,713,714,715,718],{},"A provider takes its instance from the host of ",[204,716,717],{},"baseUrl",", so github.com and a GitHub Enterprise Server can be registered together:",[209,720,722],{"className":211,"code":721,"language":213,"meta":214,"style":214},"const forges = createForges([\n  github({ auth: personal }),\n  github({ baseUrl: 'https:\u002F\u002Fghe.example.com\u002Fapi\u002Fv3', auth: work }),\n])\n",[204,723,724,736,758,793],{"__ignoreMap":214},[218,725,726,728,730,732,734],{"class":220,"line":221},[218,727,274],{"class":273},[218,729,277],{"class":232},[218,731,280],{"class":228},[218,733,233],{"class":283},[218,735,286],{"class":232},[218,737,738,740,742,744,746,748,751,754,756],{"class":220,"line":263},[218,739,292],{"class":283},[218,741,295],{"class":232},[218,743,298],{"class":228},[218,745,302],{"class":301},[218,747,305],{"class":228},[218,749,750],{"class":232}," personal ",[218,752,753],{"class":228},"}",[218,755,351],{"class":232},[218,757,354],{"class":228},[218,759,760,762,764,766,769,771,773,776,778,780,782,784,787,789,791],{"class":220,"line":270},[218,761,292],{"class":283},[218,763,295],{"class":232},[218,765,298],{"class":228},[218,767,768],{"class":301}," baseUrl",[218,770,305],{"class":228},[218,772,253],{"class":228},[218,774,775],{"class":256},"https:\u002F\u002Fghe.example.com\u002Fapi\u002Fv3",[218,777,320],{"class":228},[218,779,236],{"class":228},[218,781,302],{"class":301},[218,783,305],{"class":228},[218,785,786],{"class":232}," work ",[218,788,753],{"class":228},[218,790,351],{"class":232},[218,792,354],{"class":228},[218,794,795],{"class":220,"line":289},[218,796,413],{"class":232},[201,798,799,801,802,804],{},[204,800,206],{}," throws when two providers share a forge and an instance. To register two providers for the same host, pass a different ",[204,803,428],{}," to one of them.",[806,807,808],"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":214,"searchDepth":263,"depth":263,"links":810},[811,812,813,814],{"id":417,"depth":263,"text":418},{"id":562,"depth":263,"text":563},{"id":678,"depth":263,"text":679},{"id":710,"depth":263,"text":711},"Register several providers and route calls by ref or by URL.","md",null,{"icon":819},"i-lucide-layers",{"title":34,"description":815},"y00E0_LdRY95X57ptepaDFKBESdAYu5JcWLRpPu7esE",[823,825],{"title":30,"path":31,"stem":32,"description":824,"children":-1},"Pass credentials to a provider, and limit what they can do.",{"title":38,"path":39,"stem":40,"description":826,"children":-1},"Create providers from FORGES_* environment variables.",1791294007993]