[{"data":1,"prerenderedAt":692},["ShallowReactive",2],{"ofd-doc:\u002Fintegration\u002Fhttp":3,"ofd-source:recipes\u002Fworkstation.ts":243,"mdc--efgp15-key":244},{"id":4,"title":5,"body":6,"description":225,"extension":226,"keywords":227,"locale":234,"meta":235,"navigation":236,"order":237,"path":238,"section":239,"seo":240,"stem":241,"__hash__":242},"docs\u002Fintegration\u002Fhttp.zh-CN.md","工作站 HTTP 接入",{"type":7,"value":8,"toc":218},"minimark",[9,13,34,38,51,55,156,182,185],[10,11,12],"h2",{"id":12},"连接已有服务",[14,15,16,17,21,22,25,26,29,30,33],"p",{},"服务端的 ",[18,19,20],"code",{},"handleOFDHttpRequest"," 接收标准 Fetch ",[18,23,24],{},"Request","，默认挂载点为 ",[18,27,28],{},"\u002Fofd","。它使用宿主为当前登录者提供的目录、草稿存储和可选队列。鉴权、院区或租户隔离、持久化和审计归宿主所有。前端可用 ",[18,31,32],{},"createOFDHttpDraftStore"," 等适配器连接同一地址。",[35,36],"docs-recipe",{"name":37},"recipes\u002Fworkstation",[14,39,40,46,47,50],{},[41,42,45],"a",{"href":43,"download":44},"\u002Fdownloads\u002Fworkstations.openapi.json","workstations.openapi.json","下载工作站 OpenAPI JSON","。契约里的 ",[18,48,49],{},"127.0.0.1:8998\u002Fofd"," 是仓库预览的合成业务服务。部署时替换为自己的地址。官网静态示例提供本地文档操作。",[10,52,54],{"id":53},"从版本化模板生成-ofd","从版本化模板生成 OFD",[56,57,58,74],"table",{},[59,60,61],"thead",{},[62,63,64,68,71],"tr",{},[65,66,67],"th",{},"步骤",[65,69,70],{},"请求",[65,72,73],{},"结果",[75,76,77,98,111,124,143],"tbody",{},[62,78,79,83,88],{},[80,81,82],"td",{},"选择模板",[80,84,85],{},[18,86,87],{},"GET \u002Fofd\u002Ftemplates",[80,89,90,91,94,95],{},"在可见条目中选择 ",[18,92,93],{},"id"," 和 ",[18,96,97],{},"revision",[62,99,100,103,108],{},[80,101,102],{},"查询字段",[80,104,105],{},[18,106,107],{},"GET \u002Fofd\u002Ftemplates\u002F{id}\u002Ffields",[80,109,110],{},"标量字段、明细组与 v3 填写示例",[62,112,113,116,121],{},[80,114,115],{},"预检填写",[80,117,118],{},[18,119,120],{},"POST \u002Fofd\u002Ftemplates\u002F{id}\u002Fpreflight",[80,122,123],{},"在生成前核对数据与目标字段",[62,125,126,129,134],{},[80,127,128],{},"生成文件",[80,130,131],{},[18,132,133],{},"POST \u002Fofd\u002Ftemplates\u002F{id}\u002Fdraft",[80,135,136,94,139,142],{},[18,137,138],{},"201",[18,140,141],{},"application\u002Fofd"," 文件字节",[62,144,145,148,153],{},[80,146,147],{},"登记业务草稿",[80,149,150],{},[18,151,152],{},"PUT \u002Fofd\u002Fdrafts\u002F{id}?name=report.ofd",[80,154,155],{},"保存 OFD 字节并返回该业务记录的版本",[14,157,158,159,162,163,166,167,170,171,174,175,177,178,181],{},"模板的字段、预检和生成请求传同一强 ",[18,160,161],{},"If-Match","。例如目录修订为 ",[18,164,165],{},"1"," 时，头部写作 ",[18,168,169],{},"If-Match: \"1\"","。JSON 写入使用 ",[18,172,173],{},"Content-Type: application\u002Fjson","，登记草稿使用 ",[18,176,141],{},"。首次按业务 ID 登记用 ",[18,179,180],{},"If-None-Match: *","，再次保存用打开该草稿时的强 ETag。",[10,183,184],{"id":184},"修改已保存的草稿",[14,186,187,188,191,192,94,195,198,199,202,203,206,207,94,210,213,214],{},"先 ",[18,189,190],{},"GET \u002Fofd\u002Fdrafts\u002F{id}","，再用该草稿版本调用 ",[18,193,194],{},"POST \u002Fofd\u002Fdrafts\u002F{id}\u002Fpreflight",[18,196,197],{},"POST \u002Fofd\u002Fdrafts\u002F{id}\u002Ffill","。必需的条件头缺失会得到 ",[18,200,201],{},"428","，版本已经变化会得到 ",[18,204,205],{},"412","。重新读取并预检后再确认变更。批量操作使用 ",[18,208,209],{},"batch-preflight",[18,211,212],{},"batch-drafts","，逐条读取结果。",[41,215,217],{"href":216},"\u002Fintegration\u002Fdata","统一填写数据",{"title":219,"searchDepth":220,"depth":220,"links":221},"",2,[222,223,224],{"id":12,"depth":220,"text":12},{"id":53,"depth":220,"text":54},{"id":184,"depth":220,"text":184},"让现有业务系统提供模板、草稿和授权，使用条件请求防止覆盖其他人的修改。","md",[228,229,230,231,232,233],"OpenAPI","ETag","HTTP",412,428,"drafts","zh-CN",{},true,3,"\u002Fintegration\u002Fhttp","系统接入",{"title":5,"description":225},"integration\u002Fhttp.zh-CN","za4JjcSAyPdLcZGOnRoJgaKspSWat8ZJlSDsyW8i9ak","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":245,"body":246},{},{"type":247,"children":248},"root",[249,686],{"type":250,"tag":251,"props":252,"children":256},"element","pre",{"className":253,"code":254,"language":255,"meta":219,"style":219},"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",[257],{"type":250,"tag":18,"props":258,"children":259},{"__ignoreMap":219},[260,305,313,322,331,355,373,382,478,544,577,639,668,677],{"type":250,"tag":261,"props":262,"children":265},"span",{"class":263,"line":264},"line",1,[266,273,279,284,289,294,300],{"type":250,"tag":261,"props":267,"children":269},{"style":268},"--shiki-default:#D73A49;--shiki-light:#D73A49;--shiki-dark:#F97583",[270],{"type":271,"value":272},"text","import",{"type":250,"tag":261,"props":274,"children":276},{"style":275},"--shiki-default:#24292E;--shiki-light:#24292E;--shiki-dark:#E1E4E8",[277],{"type":271,"value":278}," { handleOFDHttpRequest, ",{"type":250,"tag":261,"props":280,"children":281},{"style":268},[282],{"type":271,"value":283},"type",{"type":250,"tag":261,"props":285,"children":286},{"style":275},[287],{"type":271,"value":288}," OFDHttpServices } ",{"type":250,"tag":261,"props":290,"children":291},{"style":268},[292],{"type":271,"value":293},"from",{"type":250,"tag":261,"props":295,"children":297},{"style":296},"--shiki-default:#032F62;--shiki-light:#032F62;--shiki-dark:#9ECBFF",[298],{"type":271,"value":299}," \"@quirekit\u002Fofd-editor\u002Fhttp\"",{"type":250,"tag":261,"props":301,"children":302},{"style":275},[303],{"type":271,"value":304},";\n",{"type":250,"tag":261,"props":306,"children":307},{"class":263,"line":220},[308],{"type":250,"tag":261,"props":309,"children":310},{"emptyLinePlaceholder":236},[311],{"type":271,"value":312},"\n",{"type":250,"tag":261,"props":314,"children":315},{"class":263,"line":237},[316],{"type":250,"tag":261,"props":317,"children":319},{"style":318},"--shiki-default:#6A737D;--shiki-light:#6A737D;--shiki-dark:#6A737D",[320],{"type":271,"value":321},"\u002F**\n",{"type":250,"tag":261,"props":323,"children":325},{"class":263,"line":324},4,[326],{"type":250,"tag":261,"props":327,"children":328},{"style":318},[329],{"type":271,"value":330}," * Installs the OFD routes behind the host's existing session and access policy.\n",{"type":250,"tag":261,"props":332,"children":334},{"class":263,"line":333},5,[335,340,345,350],{"type":250,"tag":261,"props":336,"children":337},{"style":318},[338],{"type":271,"value":339}," * ",{"type":250,"tag":261,"props":341,"children":342},{"style":268},[343],{"type":271,"value":344},"@param",{"type":250,"tag":261,"props":346,"children":347},{"style":275},[348],{"type":271,"value":349}," servicesFor",{"type":250,"tag":261,"props":351,"children":352},{"style":318},[353],{"type":271,"value":354}," - Resolves services restricted to this caller and tenant.\n",{"type":250,"tag":261,"props":356,"children":358},{"class":263,"line":357},6,[359,363,368],{"type":250,"tag":261,"props":360,"children":361},{"style":318},[362],{"type":271,"value":339},{"type":250,"tag":261,"props":364,"children":365},{"style":268},[366],{"type":271,"value":367},"@returns",{"type":250,"tag":261,"props":369,"children":370},{"style":318},[371],{"type":271,"value":372}," A Fetch handler mounted at \u002Fofd\u002F.\n",{"type":250,"tag":261,"props":374,"children":376},{"class":263,"line":375},7,[377],{"type":250,"tag":261,"props":378,"children":379},{"style":318},[380],{"type":271,"value":381}," *\u002F\n",{"type":250,"tag":261,"props":383,"children":385},{"class":263,"line":384},8,[386,391,396,402,407,412,417,422,428,432,437,442,447,452,457,462,467,473],{"type":250,"tag":261,"props":387,"children":388},{"style":268},[389],{"type":271,"value":390},"export",{"type":250,"tag":261,"props":392,"children":393},{"style":268},[394],{"type":271,"value":395}," function",{"type":250,"tag":261,"props":397,"children":399},{"style":398},"--shiki-default:#6F42C1;--shiki-light:#6F42C1;--shiki-dark:#B392F0",[400],{"type":271,"value":401}," workstationHandler",{"type":250,"tag":261,"props":403,"children":404},{"style":275},[405],{"type":271,"value":406},"(",{"type":250,"tag":261,"props":408,"children":409},{"style":398},[410],{"type":271,"value":411},"servicesFor",{"type":250,"tag":261,"props":413,"children":414},{"style":268},[415],{"type":271,"value":416},":",{"type":250,"tag":261,"props":418,"children":419},{"style":275},[420],{"type":271,"value":421}," (",{"type":250,"tag":261,"props":423,"children":425},{"style":424},"--shiki-default:#E36209;--shiki-light:#E36209;--shiki-dark:#FFAB70",[426],{"type":271,"value":427},"request",{"type":250,"tag":261,"props":429,"children":430},{"style":268},[431],{"type":271,"value":416},{"type":250,"tag":261,"props":433,"children":434},{"style":398},[435],{"type":271,"value":436}," Request",{"type":250,"tag":261,"props":438,"children":439},{"style":275},[440],{"type":271,"value":441},") ",{"type":250,"tag":261,"props":443,"children":444},{"style":268},[445],{"type":271,"value":446},"=>",{"type":250,"tag":261,"props":448,"children":449},{"style":398},[450],{"type":271,"value":451}," Promise",{"type":250,"tag":261,"props":453,"children":454},{"style":275},[455],{"type":271,"value":456},"\u003C",{"type":250,"tag":261,"props":458,"children":459},{"style":398},[460],{"type":271,"value":461},"OFDHttpServices",{"type":250,"tag":261,"props":463,"children":464},{"style":268},[465],{"type":271,"value":466}," |",{"type":250,"tag":261,"props":468,"children":470},{"style":469},"--shiki-default:#005CC5;--shiki-light:#005CC5;--shiki-dark:#79B8FF",[471],{"type":271,"value":472}," undefined",{"type":250,"tag":261,"props":474,"children":475},{"style":275},[476],{"type":271,"value":477},">) {\n",{"type":250,"tag":261,"props":479,"children":481},{"class":263,"line":480},9,[482,487,492,496,500,504,508,513,517,521,525,530,535,539],{"type":250,"tag":261,"props":483,"children":484},{"style":268},[485],{"type":271,"value":486},"  return",{"type":250,"tag":261,"props":488,"children":489},{"style":268},[490],{"type":271,"value":491}," async",{"type":250,"tag":261,"props":493,"children":494},{"style":275},[495],{"type":271,"value":421},{"type":250,"tag":261,"props":497,"children":498},{"style":424},[499],{"type":271,"value":427},{"type":250,"tag":261,"props":501,"children":502},{"style":268},[503],{"type":271,"value":416},{"type":250,"tag":261,"props":505,"children":506},{"style":398},[507],{"type":271,"value":436},{"type":250,"tag":261,"props":509,"children":510},{"style":275},[511],{"type":271,"value":512},")",{"type":250,"tag":261,"props":514,"children":515},{"style":268},[516],{"type":271,"value":416},{"type":250,"tag":261,"props":518,"children":519},{"style":398},[520],{"type":271,"value":451},{"type":250,"tag":261,"props":522,"children":523},{"style":275},[524],{"type":271,"value":456},{"type":250,"tag":261,"props":526,"children":527},{"style":398},[528],{"type":271,"value":529},"Response",{"type":250,"tag":261,"props":531,"children":532},{"style":275},[533],{"type":271,"value":534},"> ",{"type":250,"tag":261,"props":536,"children":537},{"style":268},[538],{"type":271,"value":446},{"type":250,"tag":261,"props":540,"children":541},{"style":275},[542],{"type":271,"value":543}," {\n",{"type":250,"tag":261,"props":545,"children":547},{"class":263,"line":546},10,[548,553,558,563,568,572],{"type":250,"tag":261,"props":549,"children":550},{"style":268},[551],{"type":271,"value":552},"    const",{"type":250,"tag":261,"props":554,"children":555},{"style":469},[556],{"type":271,"value":557}," services",{"type":250,"tag":261,"props":559,"children":560},{"style":268},[561],{"type":271,"value":562}," =",{"type":250,"tag":261,"props":564,"children":565},{"style":268},[566],{"type":271,"value":567}," await",{"type":250,"tag":261,"props":569,"children":570},{"style":398},[571],{"type":271,"value":349},{"type":250,"tag":261,"props":573,"children":574},{"style":275},[575],{"type":271,"value":576},"(request);\n",{"type":250,"tag":261,"props":578,"children":580},{"class":263,"line":579},11,[581,586,590,595,600,605,610,615,619,624,629,634],{"type":250,"tag":261,"props":582,"children":583},{"style":268},[584],{"type":271,"value":585},"    if",{"type":250,"tag":261,"props":587,"children":588},{"style":275},[589],{"type":271,"value":421},{"type":250,"tag":261,"props":591,"children":592},{"style":268},[593],{"type":271,"value":594},"!",{"type":250,"tag":261,"props":596,"children":597},{"style":275},[598],{"type":271,"value":599},"services) ",{"type":250,"tag":261,"props":601,"children":602},{"style":268},[603],{"type":271,"value":604},"return",{"type":250,"tag":261,"props":606,"children":607},{"style":268},[608],{"type":271,"value":609}," new",{"type":250,"tag":261,"props":611,"children":612},{"style":398},[613],{"type":271,"value":614}," Response",{"type":250,"tag":261,"props":616,"children":617},{"style":275},[618],{"type":271,"value":406},{"type":250,"tag":261,"props":620,"children":621},{"style":469},[622],{"type":271,"value":623},"null",{"type":250,"tag":261,"props":625,"children":626},{"style":275},[627],{"type":271,"value":628},", { status: ",{"type":250,"tag":261,"props":630,"children":631},{"style":469},[632],{"type":271,"value":633},"403",{"type":250,"tag":261,"props":635,"children":636},{"style":275},[637],{"type":271,"value":638}," });\n",{"type":250,"tag":261,"props":640,"children":642},{"class":263,"line":641},12,[643,648,653,658,663],{"type":250,"tag":261,"props":644,"children":645},{"style":268},[646],{"type":271,"value":647},"    return",{"type":250,"tag":261,"props":649,"children":650},{"style":398},[651],{"type":271,"value":652}," handleOFDHttpRequest",{"type":250,"tag":261,"props":654,"children":655},{"style":275},[656],{"type":271,"value":657},"(request, services, ",{"type":250,"tag":261,"props":659,"children":660},{"style":296},[661],{"type":271,"value":662},"\"\u002Fofd\"",{"type":250,"tag":261,"props":664,"children":665},{"style":275},[666],{"type":271,"value":667},");\n",{"type":250,"tag":261,"props":669,"children":671},{"class":263,"line":670},13,[672],{"type":250,"tag":261,"props":673,"children":674},{"style":275},[675],{"type":271,"value":676},"  };\n",{"type":250,"tag":261,"props":678,"children":680},{"class":263,"line":679},14,[681],{"type":250,"tag":261,"props":682,"children":683},{"style":275},[684],{"type":271,"value":685},"}\n",{"type":250,"tag":687,"props":688,"children":689},"style",{},[690],{"type":271,"value":691},"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);}",1795456058408]