[{"data":1,"prerenderedAt":693},["ShallowReactive",2],{"ofd-doc:\u002Fen\u002Fintegration\u002Fhttp":3,"ofd-source:recipes\u002Fworkstation.ts":244,"mdc--efgp15-key":245},{"id":4,"title":5,"body":6,"description":226,"extension":227,"keywords":228,"locale":235,"meta":236,"navigation":237,"order":238,"path":239,"section":240,"seo":241,"stem":242,"__hash__":243},"docs\u002Fintegration\u002Fhttp.en.md","Workstation HTTP integration",{"type":7,"value":8,"toc":219},"minimark",[9,14,34,38,51,55,156,182,186],[10,11,13],"h2",{"id":12},"connect-existing-services","Connect existing services",[15,16,17,21,22,25,26,29,30,33],"p",{},[18,19,20],"code",{},"handleOFDHttpRequest"," accepts a standard Fetch ",[18,23,24],{},"Request",", mounted at ",[18,27,28],{},"\u002Fofd"," by default. Provide the current caller's template library, draft store and optional queue. The host owns authentication, tenant isolation, persistence and auditing. Browser adapters such as ",[18,31,32],{},"createOFDHttpDraftStore"," can point at the same base URL.",[35,36],"docs-recipe",{"name":37},"recipes\u002Fworkstation",[15,39,40,46,47,50],{},[41,42,45],"a",{"href":43,"download":44},"\u002Fdownloads\u002Fworkstations.openapi.json","workstations.openapi.json","Download the workstation OpenAPI JSON",". The contract's ",[18,48,49],{},"127.0.0.1:8998\u002Fofd"," server is the repository's synthetic local service. Use your deployment's own address. The public static demo offers local document operations.",[10,52,54],{"id":53},"generate-an-ofd-from-a-versioned-template","Generate an OFD from a versioned template",[56,57,58,73],"table",{},[59,60,61],"thead",{},[62,63,64,68,70],"tr",{},[65,66,67],"th",{},"Step",[65,69,24],{},[65,71,72],{},"Result",[74,75,76,98,111,124,143],"tbody",{},[62,77,78,82,87],{},[79,80,81],"td",{},"Select a template",[79,83,84],{},[18,85,86],{},"GET \u002Fofd\u002Ftemplates",[79,88,89,90,93,94,97],{},"Choose the ",[18,91,92],{},"id"," and ",[18,95,96],{},"revision"," of a visible entry",[62,99,100,103,108],{},[79,101,102],{},"Inspect fields",[79,104,105],{},[18,106,107],{},"GET \u002Fofd\u002Ftemplates\u002F{id}\u002Ffields",[79,109,110],{},"Scalar fields, detail groups and a v3 example",[62,112,113,116,121],{},[79,114,115],{},"Review input",[79,117,118],{},[18,119,120],{},"POST \u002Fofd\u002Ftemplates\u002F{id}\u002Fpreflight",[79,122,123],{},"Compare the submitted data with the target fields",[62,125,126,129,134],{},[79,127,128],{},"Generate the file",[79,130,131],{},[18,132,133],{},"POST \u002Fofd\u002Ftemplates\u002F{id}\u002Fdraft",[79,135,136,93,139,142],{},[18,137,138],{},"201",[18,140,141],{},"application\u002Fofd"," bytes",[62,144,145,148,153],{},[79,146,147],{},"Register a business draft",[79,149,150],{},[18,151,152],{},"PUT \u002Fofd\u002Fdrafts\u002F{id}?name=report.ofd",[79,154,155],{},"Persist OFD bytes and receive a business revision",[15,157,158,159,162,163,166,167,170,171,174,175,177,178,181],{},"Send the same strong ",[18,160,161],{},"If-Match"," on the template fields, preflight and generation requests. For revision ",[18,164,165],{},"1"," the header is ",[18,168,169],{},"If-Match: \"1\"",". Use ",[18,172,173],{},"Content-Type: application\u002Fjson"," for fill data and ",[18,176,141],{}," for storing file bytes. First registration uses ",[18,179,180],{},"If-None-Match: *",". Subsequent writes use the strong ETag obtained when opening that draft.",[10,183,185],{"id":184},"update-a-saved-draft","Update a saved draft",[15,187,188,189,192,193,93,196,199,200,203,204,207,208,93,211,214,215],{},"Read ",[18,190,191],{},"GET \u002Fofd\u002Fdrafts\u002F{id}"," and use its revision with ",[18,194,195],{},"POST \u002Fofd\u002Fdrafts\u002F{id}\u002Fpreflight",[18,197,198],{},"POST \u002Fofd\u002Fdrafts\u002F{id}\u002Ffill",". A missing required precondition returns ",[18,201,202],{},"428",". A stale revision returns ",[18,205,206],{},"412",". Reload and review against the latest edition before confirming. Bulk operations use ",[18,209,210],{},"batch-preflight",[18,212,213],{},"batch-drafts"," and return results per item. ",[41,216,218],{"href":217},"\u002Fen\u002Fintegration\u002Fdata","One fill-data contract",{"title":220,"searchDepth":221,"depth":221,"links":222},"",2,[223,224,225],{"id":12,"depth":221,"text":13},{"id":53,"depth":221,"text":54},{"id":184,"depth":221,"text":185},"Connect authorized stores and use conditional requests to avoid overwriting another user's work.","md",[229,230,231,232,233,234],"OpenAPI","ETag","HTTP",412,428,"drafts","en",{},true,3,"\u002Fen\u002Fintegration\u002Fhttp","Integration",{"title":5,"description":226},"integration\u002Fhttp.en","1OQZ38vIr-NzBv8va0n0468hzdtxAO4NIosjuuGgKEk","import { handleOFDHttpRequest, type OFDHttpServices } from \"@quirekit\u002Fofd-editor\u002Fhttp\";\n\n\u002F**\n * Installs the OFD routes behind the host's existing session and access policy.\n * @param servicesFor - Resolves services restricted to this caller and tenant.\n * @returns A Fetch handler mounted at \u002Fofd\u002F.\n *\u002F\nexport function workstationHandler(servicesFor: (request: Request) => Promise\u003COFDHttpServices | undefined>) {\n  return async (request: Request): Promise\u003CResponse> => {\n    const services = await servicesFor(request);\n    if (!services) return new Response(null, { status: 403 });\n    return handleOFDHttpRequest(request, services, \"\u002Fofd\");\n  };\n}\n",{"data":246,"body":247},{},{"type":248,"children":249},"root",[250,687],{"type":251,"tag":252,"props":253,"children":257},"element","pre",{"className":254,"code":255,"language":256,"meta":220,"style":220},"language-ts shiki shiki-themes github-light github-light github-dark","import { handleOFDHttpRequest, type OFDHttpServices } from \"@quirekit\u002Fofd-editor\u002Fhttp\";\n\n\u002F**\n * Installs the OFD routes behind the host's existing session and access policy.\n * @param servicesFor - Resolves services restricted to this caller and tenant.\n * @returns A Fetch handler mounted at \u002Fofd\u002F.\n *\u002F\nexport function workstationHandler(servicesFor: (request: Request) => Promise\u003COFDHttpServices | undefined>) {\n  return async (request: Request): Promise\u003CResponse> => {\n    const services = await servicesFor(request);\n    if (!services) return new Response(null, { status: 403 });\n    return handleOFDHttpRequest(request, services, \"\u002Fofd\");\n  };\n}\n\n","ts",[258],{"type":251,"tag":18,"props":259,"children":260},{"__ignoreMap":220},[261,306,314,323,332,356,374,383,479,545,578,640,669,678],{"type":251,"tag":262,"props":263,"children":266},"span",{"class":264,"line":265},"line",1,[267,274,280,285,290,295,301],{"type":251,"tag":262,"props":268,"children":270},{"style":269},"--shiki-default:#D73A49;--shiki-light:#D73A49;--shiki-dark:#F97583",[271],{"type":272,"value":273},"text","import",{"type":251,"tag":262,"props":275,"children":277},{"style":276},"--shiki-default:#24292E;--shiki-light:#24292E;--shiki-dark:#E1E4E8",[278],{"type":272,"value":279}," { handleOFDHttpRequest, ",{"type":251,"tag":262,"props":281,"children":282},{"style":269},[283],{"type":272,"value":284},"type",{"type":251,"tag":262,"props":286,"children":287},{"style":276},[288],{"type":272,"value":289}," OFDHttpServices } ",{"type":251,"tag":262,"props":291,"children":292},{"style":269},[293],{"type":272,"value":294},"from",{"type":251,"tag":262,"props":296,"children":298},{"style":297},"--shiki-default:#032F62;--shiki-light:#032F62;--shiki-dark:#9ECBFF",[299],{"type":272,"value":300}," \"@quirekit\u002Fofd-editor\u002Fhttp\"",{"type":251,"tag":262,"props":302,"children":303},{"style":276},[304],{"type":272,"value":305},";\n",{"type":251,"tag":262,"props":307,"children":308},{"class":264,"line":221},[309],{"type":251,"tag":262,"props":310,"children":311},{"emptyLinePlaceholder":237},[312],{"type":272,"value":313},"\n",{"type":251,"tag":262,"props":315,"children":316},{"class":264,"line":238},[317],{"type":251,"tag":262,"props":318,"children":320},{"style":319},"--shiki-default:#6A737D;--shiki-light:#6A737D;--shiki-dark:#6A737D",[321],{"type":272,"value":322},"\u002F**\n",{"type":251,"tag":262,"props":324,"children":326},{"class":264,"line":325},4,[327],{"type":251,"tag":262,"props":328,"children":329},{"style":319},[330],{"type":272,"value":331}," * Installs the OFD routes behind the host's existing session and access policy.\n",{"type":251,"tag":262,"props":333,"children":335},{"class":264,"line":334},5,[336,341,346,351],{"type":251,"tag":262,"props":337,"children":338},{"style":319},[339],{"type":272,"value":340}," * ",{"type":251,"tag":262,"props":342,"children":343},{"style":269},[344],{"type":272,"value":345},"@param",{"type":251,"tag":262,"props":347,"children":348},{"style":276},[349],{"type":272,"value":350}," servicesFor",{"type":251,"tag":262,"props":352,"children":353},{"style":319},[354],{"type":272,"value":355}," - Resolves services restricted to this caller and tenant.\n",{"type":251,"tag":262,"props":357,"children":359},{"class":264,"line":358},6,[360,364,369],{"type":251,"tag":262,"props":361,"children":362},{"style":319},[363],{"type":272,"value":340},{"type":251,"tag":262,"props":365,"children":366},{"style":269},[367],{"type":272,"value":368},"@returns",{"type":251,"tag":262,"props":370,"children":371},{"style":319},[372],{"type":272,"value":373}," A Fetch handler mounted at \u002Fofd\u002F.\n",{"type":251,"tag":262,"props":375,"children":377},{"class":264,"line":376},7,[378],{"type":251,"tag":262,"props":379,"children":380},{"style":319},[381],{"type":272,"value":382}," *\u002F\n",{"type":251,"tag":262,"props":384,"children":386},{"class":264,"line":385},8,[387,392,397,403,408,413,418,423,429,433,438,443,448,453,458,463,468,474],{"type":251,"tag":262,"props":388,"children":389},{"style":269},[390],{"type":272,"value":391},"export",{"type":251,"tag":262,"props":393,"children":394},{"style":269},[395],{"type":272,"value":396}," function",{"type":251,"tag":262,"props":398,"children":400},{"style":399},"--shiki-default:#6F42C1;--shiki-light:#6F42C1;--shiki-dark:#B392F0",[401],{"type":272,"value":402}," workstationHandler",{"type":251,"tag":262,"props":404,"children":405},{"style":276},[406],{"type":272,"value":407},"(",{"type":251,"tag":262,"props":409,"children":410},{"style":399},[411],{"type":272,"value":412},"servicesFor",{"type":251,"tag":262,"props":414,"children":415},{"style":269},[416],{"type":272,"value":417},":",{"type":251,"tag":262,"props":419,"children":420},{"style":276},[421],{"type":272,"value":422}," (",{"type":251,"tag":262,"props":424,"children":426},{"style":425},"--shiki-default:#E36209;--shiki-light:#E36209;--shiki-dark:#FFAB70",[427],{"type":272,"value":428},"request",{"type":251,"tag":262,"props":430,"children":431},{"style":269},[432],{"type":272,"value":417},{"type":251,"tag":262,"props":434,"children":435},{"style":399},[436],{"type":272,"value":437}," Request",{"type":251,"tag":262,"props":439,"children":440},{"style":276},[441],{"type":272,"value":442},") ",{"type":251,"tag":262,"props":444,"children":445},{"style":269},[446],{"type":272,"value":447},"=>",{"type":251,"tag":262,"props":449,"children":450},{"style":399},[451],{"type":272,"value":452}," Promise",{"type":251,"tag":262,"props":454,"children":455},{"style":276},[456],{"type":272,"value":457},"\u003C",{"type":251,"tag":262,"props":459,"children":460},{"style":399},[461],{"type":272,"value":462},"OFDHttpServices",{"type":251,"tag":262,"props":464,"children":465},{"style":269},[466],{"type":272,"value":467}," |",{"type":251,"tag":262,"props":469,"children":471},{"style":470},"--shiki-default:#005CC5;--shiki-light:#005CC5;--shiki-dark:#79B8FF",[472],{"type":272,"value":473}," undefined",{"type":251,"tag":262,"props":475,"children":476},{"style":276},[477],{"type":272,"value":478},">) {\n",{"type":251,"tag":262,"props":480,"children":482},{"class":264,"line":481},9,[483,488,493,497,501,505,509,514,518,522,526,531,536,540],{"type":251,"tag":262,"props":484,"children":485},{"style":269},[486],{"type":272,"value":487},"  return",{"type":251,"tag":262,"props":489,"children":490},{"style":269},[491],{"type":272,"value":492}," async",{"type":251,"tag":262,"props":494,"children":495},{"style":276},[496],{"type":272,"value":422},{"type":251,"tag":262,"props":498,"children":499},{"style":425},[500],{"type":272,"value":428},{"type":251,"tag":262,"props":502,"children":503},{"style":269},[504],{"type":272,"value":417},{"type":251,"tag":262,"props":506,"children":507},{"style":399},[508],{"type":272,"value":437},{"type":251,"tag":262,"props":510,"children":511},{"style":276},[512],{"type":272,"value":513},")",{"type":251,"tag":262,"props":515,"children":516},{"style":269},[517],{"type":272,"value":417},{"type":251,"tag":262,"props":519,"children":520},{"style":399},[521],{"type":272,"value":452},{"type":251,"tag":262,"props":523,"children":524},{"style":276},[525],{"type":272,"value":457},{"type":251,"tag":262,"props":527,"children":528},{"style":399},[529],{"type":272,"value":530},"Response",{"type":251,"tag":262,"props":532,"children":533},{"style":276},[534],{"type":272,"value":535},"> ",{"type":251,"tag":262,"props":537,"children":538},{"style":269},[539],{"type":272,"value":447},{"type":251,"tag":262,"props":541,"children":542},{"style":276},[543],{"type":272,"value":544}," {\n",{"type":251,"tag":262,"props":546,"children":548},{"class":264,"line":547},10,[549,554,559,564,569,573],{"type":251,"tag":262,"props":550,"children":551},{"style":269},[552],{"type":272,"value":553},"    const",{"type":251,"tag":262,"props":555,"children":556},{"style":470},[557],{"type":272,"value":558}," services",{"type":251,"tag":262,"props":560,"children":561},{"style":269},[562],{"type":272,"value":563}," =",{"type":251,"tag":262,"props":565,"children":566},{"style":269},[567],{"type":272,"value":568}," await",{"type":251,"tag":262,"props":570,"children":571},{"style":399},[572],{"type":272,"value":350},{"type":251,"tag":262,"props":574,"children":575},{"style":276},[576],{"type":272,"value":577},"(request);\n",{"type":251,"tag":262,"props":579,"children":581},{"class":264,"line":580},11,[582,587,591,596,601,606,611,616,620,625,630,635],{"type":251,"tag":262,"props":583,"children":584},{"style":269},[585],{"type":272,"value":586},"    if",{"type":251,"tag":262,"props":588,"children":589},{"style":276},[590],{"type":272,"value":422},{"type":251,"tag":262,"props":592,"children":593},{"style":269},[594],{"type":272,"value":595},"!",{"type":251,"tag":262,"props":597,"children":598},{"style":276},[599],{"type":272,"value":600},"services) ",{"type":251,"tag":262,"props":602,"children":603},{"style":269},[604],{"type":272,"value":605},"return",{"type":251,"tag":262,"props":607,"children":608},{"style":269},[609],{"type":272,"value":610}," new",{"type":251,"tag":262,"props":612,"children":613},{"style":399},[614],{"type":272,"value":615}," Response",{"type":251,"tag":262,"props":617,"children":618},{"style":276},[619],{"type":272,"value":407},{"type":251,"tag":262,"props":621,"children":622},{"style":470},[623],{"type":272,"value":624},"null",{"type":251,"tag":262,"props":626,"children":627},{"style":276},[628],{"type":272,"value":629},", { status: ",{"type":251,"tag":262,"props":631,"children":632},{"style":470},[633],{"type":272,"value":634},"403",{"type":251,"tag":262,"props":636,"children":637},{"style":276},[638],{"type":272,"value":639}," });\n",{"type":251,"tag":262,"props":641,"children":643},{"class":264,"line":642},12,[644,649,654,659,664],{"type":251,"tag":262,"props":645,"children":646},{"style":269},[647],{"type":272,"value":648},"    return",{"type":251,"tag":262,"props":650,"children":651},{"style":399},[652],{"type":272,"value":653}," handleOFDHttpRequest",{"type":251,"tag":262,"props":655,"children":656},{"style":276},[657],{"type":272,"value":658},"(request, services, ",{"type":251,"tag":262,"props":660,"children":661},{"style":297},[662],{"type":272,"value":663},"\"\u002Fofd\"",{"type":251,"tag":262,"props":665,"children":666},{"style":276},[667],{"type":272,"value":668},");\n",{"type":251,"tag":262,"props":670,"children":672},{"class":264,"line":671},13,[673],{"type":251,"tag":262,"props":674,"children":675},{"style":276},[676],{"type":272,"value":677},"  };\n",{"type":251,"tag":262,"props":679,"children":681},{"class":264,"line":680},14,[682],{"type":251,"tag":262,"props":683,"children":684},{"style":276},[685],{"type":272,"value":686},"}\n",{"type":251,"tag":688,"props":689,"children":690},"style",{},[691],{"type":272,"value":692},"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 .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 .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);}",1795456058633]