[{"data":1,"prerenderedAt":3300},["ShallowReactive",2],{"navigation_docs":3,"-developers-client-module":613,"-developers-client-module-surround":3297},[4,39,101,378,540,562,584,606],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":38},"Start","i-lucide-rocket","\u002Fstart","1.start",[10,14,18,22,26,30,34],{"title":11,"path":12,"stem":13},"Our approach","\u002Fstart\u002Four-approach","1.start\u002F0.our-approach",{"title":15,"path":16,"stem":17},"Introduction","\u002Fstart\u002Fintroduction","1.start\u002F1.introduction",{"title":19,"path":20,"stem":21},"Concepts","\u002Fstart\u002Fconcepts","1.start\u002F2.concepts",{"title":23,"path":24,"stem":25},"Glossary","\u002Fstart\u002Fglossary","1.start\u002F3.glossary",{"title":27,"path":28,"stem":29},"Try it locally","\u002Fstart\u002Ftry-it-locally","1.start\u002F4.try-it-locally",{"title":31,"path":32,"stem":33},"Features","\u002Fstart\u002Ffeatures","1.start\u002F5.features",{"title":35,"path":36,"stem":37},"Questions","\u002Fstart\u002Ffaq","1.start\u002F6.faq",false,{"title":40,"icon":41,"path":42,"stem":43,"children":44,"page":38},"Run SHADE","i-lucide-server","\u002Frun","2.run",[45,49,53,57,61,65,69,73,77,81,85,89,93,97],{"title":46,"path":47,"stem":48},"Setting up an instance (Coolify)","\u002Frun\u002Fcoolify","2.run\u002F1.coolify",{"title":50,"path":51,"stem":52},"Console commands","\u002Frun\u002Fconsole","2.run\u002F10.console",{"title":54,"path":55,"stem":56},"Rotating APP_SECRET","\u002Frun\u002Frotating-app-secret","2.run\u002F11.rotating-app-secret",{"title":58,"path":59,"stem":60},"Checking an instance","\u002Frun\u002Fdoctor","2.run\u002F12.doctor",{"title":62,"path":63,"stem":64},"Self-hosting by hand","\u002Frun\u002Fown-server-by-hand","2.run\u002F13.own-server-by-hand",{"title":66,"path":67,"stem":68},"NixOS (experimental)","\u002Frun\u002Fnixos","2.run\u002F14.nixos",{"title":70,"path":71,"stem":72},"Self-hosting without Coolify","\u002Frun\u002Fown-server","2.run\u002F2.own-server",{"title":74,"path":75,"stem":76},"Hosting the site on a static host","\u002Frun\u002Fstatic-hosts","2.run\u002F3.static-hosts",{"title":78,"path":79,"stem":80},"Licence","\u002Frun\u002Flicence","2.run\u002F4.licence",{"title":82,"path":83,"stem":84},"Updating and backups","\u002Frun\u002Fupdating-and-backups","2.run\u002F5.updating-and-backups",{"title":86,"path":87,"stem":88},"Troubleshooting","\u002Frun\u002Ftroubleshooting","2.run\u002F6.troubleshooting",{"title":90,"path":91,"stem":92},"Logs, request ids, traces and metrics","\u002Frun\u002Flogs","2.run\u002F7.logs",{"title":94,"path":95,"stem":96},"Maintenance mode","\u002Frun\u002Fmaintenance-mode","2.run\u002F8.maintenance-mode",{"title":98,"path":99,"stem":100},"Usage limits","\u002Frun\u002Fusage-limits","2.run\u002F9.usage-limits",{"title":102,"icon":103,"path":104,"stem":105,"children":106},"Guide","i-lucide-book-open","\u002Fguide","3.guide",[107,109,147,192,210,280,310,364],{"title":102,"path":104,"stem":108},"3.guide\u002Findex",{"title":110,"icon":111,"path":112,"stem":113,"children":114,"page":38},"Content","i-lucide-file-text","\u002Fguide\u002Fcontent","3.guide\u002F1.content",[115,119,123,127,131,135,139,143],{"title":116,"path":117,"stem":118},"Collections and entries","\u002Fguide\u002Fcontent\u002Fcollections","3.guide\u002F1.content\u002F1.collections",{"title":120,"path":121,"stem":122},"Field types","\u002Fguide\u002Fcontent\u002Ffields","3.guide\u002F1.content\u002F2.fields",{"title":124,"path":125,"stem":126},"Drafts, publishing and version history","\u002Fguide\u002Fcontent\u002Fversions","3.guide\u002F1.content\u002F3.versions",{"title":128,"path":129,"stem":130},"Languages","\u002Fguide\u002Fcontent\u002Flanguages","3.guide\u002F1.content\u002F4.languages",{"title":132,"path":133,"stem":134},"Data sources","\u002Fguide\u002Fcontent\u002Fdata-sources","3.guide\u002F1.content\u002F5.data-sources",{"title":136,"path":137,"stem":138},"Media","\u002Fguide\u002Fcontent\u002Fmedia","3.guide\u002F1.content\u002F6.media",{"title":140,"path":141,"stem":142},"Search","\u002Fguide\u002Fcontent\u002Fsearch","3.guide\u002F1.content\u002F7.search",{"title":144,"path":145,"stem":146},"Trash","\u002Fguide\u002Fcontent\u002Ftrash","3.guide\u002F1.content\u002F8.trash",{"title":148,"icon":149,"path":150,"stem":151,"children":152,"page":38},"Website","i-lucide-globe","\u002Fguide\u002Fwebsite","3.guide\u002F2.website",[153,156,160,164,168,172,176,180,184,188],{"title":148,"path":154,"stem":155},"\u002Fguide\u002Fwebsite\u002Fwebsite","3.guide\u002F2.website\u002F1.website",{"title":157,"path":158,"stem":159},"Scroll scenes","\u002Fguide\u002Fwebsite\u002Fscroll-scenes","3.guide\u002F2.website\u002F10.scroll-scenes",{"title":161,"path":162,"stem":163},"Pages and posts","\u002Fguide\u002Fwebsite\u002Fpages","3.guide\u002F2.website\u002F2.pages",{"title":165,"path":166,"stem":167},"The visual editor","\u002Fguide\u002Fwebsite\u002Fvisual-editor","3.guide\u002F2.website\u002F3.visual-editor",{"title":169,"path":170,"stem":171},"Roles and locks","\u002Fguide\u002Fwebsite\u002Froles-and-locks","3.guide\u002F2.website\u002F4.roles-and-locks",{"title":173,"path":174,"stem":175},"Header and footer","\u002Fguide\u002Fwebsite\u002Fheader-and-footer","3.guide\u002F2.website\u002F5.header-and-footer",{"title":177,"path":178,"stem":179},"Theme","\u002Fguide\u002Fwebsite\u002Ftheme","3.guide\u002F2.website\u002F6.theme",{"title":181,"path":182,"stem":183},"Redirects","\u002Fguide\u002Fwebsite\u002Fredirects","3.guide\u002F2.website\u002F7.redirects",{"title":185,"path":186,"stem":187},"Site settings","\u002Fguide\u002Fwebsite\u002Fsite-settings","3.guide\u002F2.website\u002F8.site-settings",{"title":189,"path":190,"stem":191},"The site","\u002Fguide\u002Fwebsite\u002Fthe-site","3.guide\u002F2.website\u002F9.the-site",{"title":193,"icon":194,"path":195,"stem":196,"children":197,"page":38},"Publishing","i-lucide-send","\u002Fguide\u002Fpublishing","3.guide\u002F3.publishing",[198,202,206],{"title":199,"path":200,"stem":201},"Publishing and preview","\u002Fguide\u002Fpublishing\u002Fpublishing","3.guide\u002F3.publishing\u002F1.publishing",{"title":203,"path":204,"stem":205},"Builds","\u002Fguide\u002Fpublishing\u002Fbuilds","3.guide\u002F3.publishing\u002F2.builds",{"title":207,"path":208,"stem":209},"CDN caches","\u002Fguide\u002Fpublishing\u002Fcaches","3.guide\u002F3.publishing\u002F3.caches",{"title":211,"icon":212,"path":213,"stem":214,"children":215,"page":38},"People, security and privacy","i-lucide-shield","\u002Fguide\u002Fpeople-and-security","3.guide\u002F4.people-and-security",[216,220,224,228,232,236,240,244,248,252,256,260,264,268,272,276],{"title":217,"path":218,"stem":219},"People in SHADE","\u002Fguide\u002Fpeople-and-security\u002Fpeople-in-shade","3.guide\u002F4.people-and-security\u002F0.people-in-shade",{"title":221,"path":222,"stem":223},"Team and roles","\u002Fguide\u002Fpeople-and-security\u002Fteam","3.guide\u002F4.people-and-security\u002F1.team",{"title":225,"path":226,"stem":227},"Errors and security alerts","\u002Fguide\u002Fpeople-and-security\u002Ferrors","3.guide\u002F4.people-and-security\u002F10.errors",{"title":229,"path":230,"stem":231},"Exporting an instance","\u002Fguide\u002Fpeople-and-security\u002Fexporting","3.guide\u002F4.people-and-security\u002F11.exporting",{"title":233,"path":234,"stem":235},"Organisations","\u002Fguide\u002Fpeople-and-security\u002Forganisations","3.guide\u002F4.people-and-security\u002F12.organisations",{"title":237,"path":238,"stem":239},"Signing in through an identity provider (team)","\u002Fguide\u002Fpeople-and-security\u002Fidentity-providers","3.guide\u002F4.people-and-security\u002F13.identity-providers",{"title":241,"path":242,"stem":243},"System status","\u002Fguide\u002Fpeople-and-security\u002Fsystem-status","3.guide\u002F4.people-and-security\u002F14.system-status",{"title":245,"path":246,"stem":247},"Appearance","\u002Fguide\u002Fpeople-and-security\u002Fappearance","3.guide\u002F4.people-and-security\u002F15.appearance",{"title":249,"path":250,"stem":251},"Accounts and personal pages","\u002Fguide\u002Fpeople-and-security\u002Faccounts","3.guide\u002F4.people-and-security\u002F2.accounts",{"title":253,"path":254,"stem":255},"Signing in (team)","\u002Fguide\u002Fpeople-and-security\u002Fsign-in","3.guide\u002F4.people-and-security\u002F3.sign-in",{"title":257,"path":258,"stem":259},"API tokens","\u002Fguide\u002Fpeople-and-security\u002Fapi-tokens","3.guide\u002F4.people-and-security\u002F4.api-tokens",{"title":261,"path":262,"stem":263},"Audit log","\u002Fguide\u002Fpeople-and-security\u002Faudit","3.guide\u002F4.people-and-security\u002F5.audit",{"title":265,"path":266,"stem":267},"Request protection","\u002Fguide\u002Fpeople-and-security\u002Fprotection","3.guide\u002F4.people-and-security\u002F6.protection",{"title":269,"path":270,"stem":271},"Personal data per person","\u002Fguide\u002Fpeople-and-security\u002Fprivacy","3.guide\u002F4.people-and-security\u002F7.privacy",{"title":273,"path":274,"stem":275},"Data retention","\u002Fguide\u002Fpeople-and-security\u002Fretention","3.guide\u002F4.people-and-security\u002F8.retention",{"title":277,"path":278,"stem":279},"Consent banner","\u002Fguide\u002Fpeople-and-security\u002Fconsent","3.guide\u002F4.people-and-security\u002F9.consent",{"title":281,"icon":282,"path":283,"stem":284,"children":285,"page":38},"Services","i-lucide-plug","\u002Fguide\u002Fservices","3.guide\u002F5.services",[286,290,294,298,302,306],{"title":287,"path":288,"stem":289},"Email","\u002Fguide\u002Fservices\u002Femail","3.guide\u002F5.services\u002F1.email",{"title":291,"path":292,"stem":293},"Opening hours","\u002Fguide\u002Fservices\u002Fopening-hours","3.guide\u002F5.services\u002F4.opening-hours",{"title":295,"path":296,"stem":297},"Webhooks","\u002Fguide\u002Fservices\u002Fwebhooks","3.guide\u002F5.services\u002F5.webhooks",{"title":299,"path":300,"stem":301},"Locations","\u002Fguide\u002Fservices\u002Flocations","3.guide\u002F5.services\u002F6.locations",{"title":303,"path":304,"stem":305},"VAT rates","\u002Fguide\u002Fservices\u002Fvat-rates","3.guide\u002F5.services\u002F7.vat-rates",{"title":307,"path":308,"stem":309},"Channels","\u002Fguide\u002Fservices\u002Fchannels","3.guide\u002F5.services\u002F8.channels",{"title":311,"icon":312,"path":313,"stem":314,"children":315,"page":38},"InstalledModules","i-lucide-puzzle","\u002Fguide\u002Fmodules","3.guide\u002F6.modules",[316,320,324,328,332,336,340,344,348,352,356,360],{"title":317,"path":318,"stem":319},"Modules","\u002Fguide\u002Fmodules\u002Fmanaging","3.guide\u002F6.modules\u002F1.managing",{"title":321,"path":322,"stem":323},"Dutch services (module)","\u002Fguide\u002Fmodules\u002Fnl","3.guide\u002F6.modules\u002F10.nl",{"title":325,"path":326,"stem":327},"Editorial (module)","\u002Fguide\u002Fmodules\u002Feditorial","3.guide\u002F6.modules\u002F11.editorial",{"title":329,"path":330,"stem":331},"Appointments (module)","\u002Fguide\u002Fmodules\u002Fappointments","3.guide\u002F6.modules\u002F2.appointments",{"title":333,"path":334,"stem":335},"Shop (the commerce module)","\u002Fguide\u002Fmodules\u002Fshop","3.guide\u002F6.modules\u002F3.shop",{"title":337,"path":338,"stem":339},"Untrusted modules","\u002Fguide\u002Fmodules\u002Funtrusted","3.guide\u002F6.modules\u002F4.untrusted",{"title":341,"path":342,"stem":343},"Analytics (module)","\u002Fguide\u002Fmodules\u002Fanalytics","3.guide\u002F6.modules\u002F5.analytics",{"title":345,"path":346,"stem":347},"Error forwarding (module)","\u002Fguide\u002Fmodules\u002Ferror-forwarding","3.guide\u002F6.modules\u002F6.error-forwarding",{"title":349,"path":350,"stem":351},"Client programs","\u002Fguide\u002Fmodules\u002Fprograms","3.guide\u002F6.modules\u002F7.programs",{"title":353,"path":354,"stem":355},"Import and export (module)","\u002Fguide\u002Fmodules\u002Fimport","3.guide\u002F6.modules\u002F8.import",{"title":357,"path":358,"stem":359},"Payments (module)","\u002Fguide\u002Fmodules\u002Fpayments","3.guide\u002F6.modules\u002F8.payments",{"title":361,"path":362,"stem":363},"Forms (module)","\u002Fguide\u002Fmodules\u002Fforms","3.guide\u002F6.modules\u002F9.forms",{"title":365,"icon":366,"path":367,"stem":368,"children":369,"page":38},"AI assistants","i-lucide-bot","\u002Fguide\u002Fai","3.guide\u002F7.ai",[370,374],{"title":371,"path":372,"stem":373},"AI assistants (MCP)","\u002Fguide\u002Fai\u002Fassistants","3.guide\u002F7.ai\u002F1.assistants",{"title":375,"path":376,"stem":377},"Connecting an AI assistant","\u002Fguide\u002Fai\u002Fconnecting","3.guide\u002F7.ai\u002F2.connecting",{"title":379,"icon":380,"path":381,"stem":382,"children":383,"page":38},"Developers","i-lucide-code","\u002Fdevelopers","4.developers",[384,388,392,396,400,404,408,412,416,420,424,428,432,435,489,493,497,501,536],{"title":385,"path":386,"stem":387},"Architecture","\u002Fdevelopers\u002Farchitecture","4.developers\u002F1.architecture",{"title":389,"path":390,"stem":391},"Capabilities","\u002Fdevelopers\u002Fcapabilities","4.developers\u002F10.capabilities",{"title":393,"path":394,"stem":395},"Trust","\u002Fdevelopers\u002Ftrust","4.developers\u002F11.trust",{"title":397,"path":398,"stem":399},"Redis and the ports","\u002Fdevelopers\u002Fredis","4.developers\u002F12.redis",{"title":401,"path":402,"stem":403},"The worker container role","\u002Fdevelopers\u002Fworker","4.developers\u002F13.worker",{"title":405,"path":406,"stem":407},"kv: a module's own key-value storage","\u002Fdevelopers\u002Fkv","4.developers\u002F14.kv",{"title":409,"path":410,"stem":411},"Processes: long-running work on the worker","\u002Fdevelopers\u002Fprocesses","4.developers\u002F15.processes",{"title":413,"path":414,"stem":415},"Network: a module's outgoing calls","\u002Fdevelopers\u002Fnetwork","4.developers\u002F16.network",{"title":417,"path":418,"stem":419},"Realtime","\u002Fdevelopers\u002Frealtime","4.developers\u002F17.realtime",{"title":421,"path":422,"stem":423},"Private files","\u002Fdevelopers\u002Ffiles","4.developers\u002F18.files",{"title":425,"path":426,"stem":427},"Notify","\u002Fdevelopers\u002Fnotify","4.developers\u002F19.notify",{"title":429,"path":430,"stem":431},"Collections","\u002Fdevelopers\u002Fcollections","4.developers\u002F2.collections",{"title":337,"path":433,"stem":434},"\u002Fdevelopers\u002Funtrusted","4.developers\u002F20.untrusted",{"title":436,"icon":312,"path":437,"stem":438,"children":439},"Writing a plugin","\u002Fdevelopers\u002Fmodules","4.developers\u002F3.modules\u002Findex",[440,442,446,450,454,458,462,466,470,473,477,481,485],{"title":441,"path":437,"stem":438},"Writing a module",{"title":443,"path":444,"stem":445},"Module SDK and tooling","\u002Fdevelopers\u002Fmodules\u002Fsdk-and-tooling","4.developers\u002F3.modules\u002F1.sdk-and-tooling",{"title":447,"path":448,"stem":449},"Connecting accounts with OAuth2","\u002Fdevelopers\u002Fmodules\u002Foauth","4.developers\u002F3.modules\u002F10.oauth",{"title":451,"path":452,"stem":453},"Calls between modules","\u002Fdevelopers\u002Fmodules\u002Fcalls-between-modules","4.developers\u002F3.modules\u002F11.calls-between-modules",{"title":455,"path":456,"stem":457},"Experimental parts","\u002Fdevelopers\u002Fmodules\u002Fexperimental-parts","4.developers\u002F3.modules\u002F12.experimental-parts",{"title":459,"path":460,"stem":461},"The manifest","\u002Fdevelopers\u002Fmodules\u002Fmanifest","4.developers\u002F3.modules\u002F2.manifest",{"title":463,"path":464,"stem":465},"Routes","\u002Fdevelopers\u002Fmodules\u002Froutes","4.developers\u002F3.modules\u002F3.routes",{"title":467,"path":468,"stem":469},"Admin screens and the site part","\u002Fdevelopers\u002Fmodules\u002Fadmin-and-site","4.developers\u002F3.modules\u002F4.admin-and-site",{"title":110,"path":471,"stem":472},"\u002Fdevelopers\u002Fmodules\u002Fcontent","4.developers\u002F3.modules\u002F5.content",{"title":474,"path":475,"stem":476},"Background work and services","\u002Fdevelopers\u002Fmodules\u002Fbackground-and-services","4.developers\u002F3.modules\u002F6.background-and-services",{"title":478,"path":479,"stem":480},"SDK reference","\u002Fdevelopers\u002Fmodules\u002Fsdk-reference","4.developers\u002F3.modules\u002F7.sdk-reference",{"title":482,"path":483,"stem":484},"The website module's SDK","\u002Fdevelopers\u002Fmodules\u002Fwebsite-sdk","4.developers\u002F3.modules\u002F8.website-sdk",{"title":486,"path":487,"stem":488},"Incoming webhooks","\u002Fdevelopers\u002Fmodules\u002Fincoming-webhooks","4.developers\u002F3.modules\u002F9.incoming-webhooks",{"title":490,"path":491,"stem":492},"Core and the website module","\u002Fdevelopers\u002Fcore-and-website-module","4.developers\u002F4.core-and-website-module",{"title":494,"path":495,"stem":496},"The API","\u002Fdevelopers\u002Fapi","4.developers\u002F6.api",{"title":498,"path":499,"stem":500},"API reference","\u002Fdevelopers\u002Fapi-reference","4.developers\u002F6.api-reference",{"title":502,"icon":503,"path":504,"stem":505,"children":506},"Sites in other frameworks","i-lucide-layout-template","\u002Fdevelopers\u002Fframeworks","4.developers\u002F7.frameworks\u002Findex",[507,508,512,516,520,524,528,532],{"title":502,"path":504,"stem":505},{"title":509,"path":510,"stem":511},"Accounts: sign-in and modules' routes","\u002Fdevelopers\u002Fframeworks\u002Faccounts","4.developers\u002F7.frameworks\u002F1.accounts",{"title":513,"path":514,"stem":515},"`@shadestack\u002Ftree`","\u002Fdevelopers\u002Fframeworks\u002Ftree","4.developers\u002F7.frameworks\u002F2.tree",{"title":517,"path":518,"stem":519},"Expressions and styles","\u002Fdevelopers\u002Fframeworks\u002Fexpressions-and-styles","4.developers\u002F7.frameworks\u002F3.expressions-and-styles",{"title":521,"path":522,"stem":523},"`@shadestack\u002Frender`","\u002Fdevelopers\u002Fframeworks\u002Frender","4.developers\u002F7.frameworks\u002F4.render",{"title":525,"path":526,"stem":527},"`@shadestack\u002Finteractions`","\u002Fdevelopers\u002Fframeworks\u002Finteractions","4.developers\u002F7.frameworks\u002F5.interactions",{"title":529,"path":530,"stem":531},"`@shadestack\u002Fa11y`","\u002Fdevelopers\u002Fframeworks\u002Fa11y","4.developers\u002F7.frameworks\u002F6.a11y",{"title":533,"path":534,"stem":535},"Your own page for SHADE's links","\u002Fdevelopers\u002Fframeworks\u002Flinks","4.developers\u002F7.frameworks\u002F7.links",{"title":537,"path":538,"stem":539},"Build a client module","\u002Fdevelopers\u002Fclient-module","4.developers\u002F9.client-module",{"title":541,"icon":542,"path":543,"stem":544,"children":545,"page":38},"Security","i-lucide-shield-check","\u002Fsecurity","5.security",[546,550,554,558],{"title":547,"path":548,"stem":549},"Reporting a vulnerability","\u002Fsecurity\u002Freporting","5.security\u002F0.reporting",{"title":551,"path":552,"stem":553},"Security testing","\u002Fsecurity\u002Ftesting","5.security\u002F1.testing",{"title":555,"path":556,"stem":557},"Hardening a production instance","\u002Fsecurity\u002Fhardening","5.security\u002F2.hardening",{"title":559,"path":560,"stem":561},"Manual testing with Kali Linux","\u002Fsecurity\u002Fmanual-testing","5.security\u002F3.manual-testing",{"title":563,"icon":564,"path":565,"stem":566,"children":567,"page":38},"Contributing","i-lucide-git-pull-request","\u002Fcontributing","6.contributing",[568,572,576,580],{"title":569,"path":570,"stem":571},"Reading the code","\u002Fcontributing\u002Freading-the-code","6.contributing\u002F1.reading-the-code",{"title":573,"path":574,"stem":575},"Docs site","\u002Fcontributing\u002Fdocs-site","6.contributing\u002F2.docs-site",{"title":577,"path":578,"stem":579},"Releases","\u002Fcontributing\u002Freleases","6.contributing\u002F3.releases",{"title":581,"path":582,"stem":583},"Load tests","\u002Fcontributing\u002Fload-tests","6.contributing\u002F4.load-tests",{"title":585,"icon":586,"path":587,"stem":588,"children":589,"page":38},"Project","i-lucide-map","\u002Fproject","7.project",[590,594,598,602],{"title":591,"path":592,"stem":593},"Roadmap","\u002Fproject\u002Froadmap","7.project\u002F1.roadmap",{"title":595,"path":596,"stem":597},"Known issues","\u002Fproject\u002Fknown-issues","7.project\u002F2.known-issues",{"title":599,"path":600,"stem":601},"Changelog","\u002Fproject\u002Fchangelog","7.project\u002F3.changelog",{"title":603,"path":604,"stem":605},"Decisions","\u002Fproject\u002Fdecisions","7.project\u002F4.decisions",{"title":607,"path":608,"stem":609,"children":610,"icon":612},"Community","\u002Fcommunity","8.community\u002Findex",[611],{"title":607,"path":608,"stem":609},"i-lucide-users",{"id":614,"title":537,"body":615,"description":661,"extension":3292,"links":3293,"meta":3294,"navigation":820,"path":538,"seo":3295,"stem":539,"__hash__":3296},"docs\u002F4.developers\u002F9.client-module.md",{"type":616,"value":617,"toc":3280},"minimark",[618,626,629,634,652,662,684,690,697,717,721,733,1032,1051,1066,1070,1077,1248,1601,1605,1610,2287,2291,2298,2515,2535,2539,2550,2854,2885,2889,2909,2954,2968,2972,3052,3061,3065,3071,3100,3122,3126,3129,3273,3276],[619,620,621,622,625],"p",{},"Many clients get a system, not a website: their software is SHADE, the official modules they need and\none module of their own, with a frontend in any framework on SHADE's accounts. This guide\nbuilds that module of their own from the first command to a server package. Sign-in, permissions, validation of\nwhat SHADE stores, rate limits, the audit log, the error log and privacy stay SHADE's; the module holds only what is\nspecific to the client. Every step links to the part of ",[623,624,441],"a",{"href":437}," that has the details.",[619,627,628],{},"As the example, a bicycle repair shop: customers ask for a quote on the shop's site and follow their repairs in their\naccount, the staff work through the repairs in the admin, and a weekly post on the site says what was repaired.",[630,631,633],"h2",{"id":632},"_1-start-the-repository","1. Start the repository",[619,635,636,637,641,642,646,647,651],{},"In the ",[623,638,640],{"href":639},"\u002Fdevelopers\u002Fmodules\u002Fsdk-and-tooling#the-shade-workspace","SHADE workspace"," (for SHADE's maintainers for now), with SHADE's\ncommand ",[643,644,645],"code",{},"shade-module","\n(",[623,648,650],{"href":649},"\u002Fdevelopers\u002Fmodules\u002Fsdk-and-tooling#starting-a-module-repository","Starting a module repository","):",[653,654,659],"pre",{"className":655,"code":657,"language":658},[656],"language-text","node shade\u002Fshade\u002Fmodule-sdk\u002Fbin\u002Fshade-module.mjs init repairs --out modules\u002Frepairs\n","text",[643,660,657],{"__ignoreMap":661},"",[619,663,664,667,668,671,672,675,676,679,680,683],{},[643,665,666],{},"init"," writes ",[643,669,670],{},"modules\u002Frepairs\u002F"," (a module that loads, validates and packages as it is) with a dependency on the\nSDK from npm, in SHADE's range (",[643,673,674],{},"\"@shadestack\u002Fmodule-sdk\": \"^0.1.0-next.2\""," today), with no ",[643,677,678],{},".npmrc",". Inside the workspace, change it\nto ",[643,681,682],{},"\"workspace:^\""," so the module uses the SDK you are working on. Then:",[653,685,688],{"className":686,"code":687,"language":658},[656],"# SHADE's .env\nSHADE_DEV_MODULES=..\u002Fmodules\u002Frepairs\npnpm dev\n",[643,689,687],{"__ignoreMap":661},[619,691,692,693,696],{},"and switch the module on under ",[694,695,317],"em",{},". Give the repository to the client: it is theirs.",[619,698,699,700,703,704,707,708,711,712,716],{},"The module uses SHADE only through ",[643,701,702],{},"@shadestack\u002Fmodule-sdk",". Its names are a promise: every one is in\nthe SDK's contract with the version that added it, none goes without a deprecation kept for at least a minor version,\nand ",[643,705,706],{},"CHANGELOG.md"," in the SDK says what changed. Write ",[643,709,710],{},"shade: '^0.1.0'"," in the manifest: before SHADE 1.0 that means\n0.1.x only; see ",[623,713,715],{"href":714},"\u002Fdevelopers\u002Fmodules\u002Fsdk-and-tooling#the-shade-versions-a-module-works-with","The SHADE versions a module works with",".",[630,718,720],{"id":719},"_2-its-tables","2. Its tables",[619,722,723,724,727,728,732],{},"The repairs are the module's own records, not content: tables in ",[643,725,726],{},"server\u002Frepairs.sql.ts",", prefixed with the module's\nname (",[623,729,731],{"href":730},"\u002Fdevelopers\u002Fmodules\u002Fmanifest#naming-rules-enforced-by-validateplugin","Naming rules",").",[653,734,738],{"className":735,"code":736,"language":737,"meta":661,"style":661},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { createdAt, id, teamMemberReference, accountReference } from '@shadestack\u002Fmodule-sdk\u002Fserver'\nimport { pgTable, text } from 'drizzle-orm\u002Fpg-core'\n\nexport const repairsJobs = pgTable('repairs_jobs', {\n  id: id(),\n  customer: accountReference('customer_id').notNull(),   \u002F\u002F the account (a foreign key); the rows go with it\n  bike: text('bike').notNull(),\n  status: text('status').notNull().default('received'),\n  handledBy: teamMemberReference('handled_by'),       \u002F\u002F a team member; null when they are deleted\n  createdAt: createdAt()\n})\n","ts",[643,739,740,789,815,822,857,875,910,939,984,1010,1023],{"__ignoreMap":661},[741,742,745,749,753,757,760,763,765,768,770,773,776,779,782,786],"span",{"class":743,"line":744},"line",1,[741,746,748],{"class":747},"s7zQu","import",[741,750,752],{"class":751},"sMK4o"," {",[741,754,756],{"class":755},"sTEyZ"," createdAt",[741,758,759],{"class":751},",",[741,761,762],{"class":755}," id",[741,764,759],{"class":751},[741,766,767],{"class":755}," teamMemberReference",[741,769,759],{"class":751},[741,771,772],{"class":755}," accountReference",[741,774,775],{"class":751}," }",[741,777,778],{"class":747}," from",[741,780,781],{"class":751}," '",[741,783,785],{"class":784},"sfazB","@shadestack\u002Fmodule-sdk\u002Fserver",[741,787,788],{"class":751},"'\n",[741,790,792,794,796,799,801,804,806,808,810,813],{"class":743,"line":791},2,[741,793,748],{"class":747},[741,795,752],{"class":751},[741,797,798],{"class":755}," pgTable",[741,800,759],{"class":751},[741,802,803],{"class":755}," text",[741,805,775],{"class":751},[741,807,778],{"class":747},[741,809,781],{"class":751},[741,811,812],{"class":784},"drizzle-orm\u002Fpg-core",[741,814,788],{"class":751},[741,816,818],{"class":743,"line":817},3,[741,819,821],{"emptyLinePlaceholder":820},true,"\n",[741,823,825,828,832,835,838,841,844,847,850,852,854],{"class":743,"line":824},4,[741,826,827],{"class":747},"export",[741,829,831],{"class":830},"spNyl"," const",[741,833,834],{"class":755}," repairsJobs ",[741,836,837],{"class":751},"=",[741,839,798],{"class":840},"s2Zo4",[741,842,843],{"class":755},"(",[741,845,846],{"class":751},"'",[741,848,849],{"class":784},"repairs_jobs",[741,851,846],{"class":751},[741,853,759],{"class":751},[741,855,856],{"class":751}," {\n",[741,858,860,864,867,869,872],{"class":743,"line":859},5,[741,861,863],{"class":862},"swJcz","  id",[741,865,866],{"class":751},":",[741,868,762],{"class":840},[741,870,871],{"class":755},"()",[741,873,874],{"class":751},",\n",[741,876,878,881,883,885,887,889,892,894,897,899,902,904,906],{"class":743,"line":877},6,[741,879,880],{"class":862},"  customer",[741,882,866],{"class":751},[741,884,772],{"class":840},[741,886,843],{"class":755},[741,888,846],{"class":751},[741,890,891],{"class":784},"customer_id",[741,893,846],{"class":751},[741,895,896],{"class":755},")",[741,898,716],{"class":751},[741,900,901],{"class":840},"notNull",[741,903,871],{"class":755},[741,905,759],{"class":751},[741,907,909],{"class":908},"sHwdD","   \u002F\u002F the account (a foreign key); the rows go with it\n",[741,911,913,916,918,920,922,924,927,929,931,933,935,937],{"class":743,"line":912},7,[741,914,915],{"class":862},"  bike",[741,917,866],{"class":751},[741,919,803],{"class":840},[741,921,843],{"class":755},[741,923,846],{"class":751},[741,925,926],{"class":784},"bike",[741,928,846],{"class":751},[741,930,896],{"class":755},[741,932,716],{"class":751},[741,934,901],{"class":840},[741,936,871],{"class":755},[741,938,874],{"class":751},[741,940,942,945,947,949,951,953,956,958,960,962,964,966,968,971,973,975,978,980,982],{"class":743,"line":941},8,[741,943,944],{"class":862},"  status",[741,946,866],{"class":751},[741,948,803],{"class":840},[741,950,843],{"class":755},[741,952,846],{"class":751},[741,954,955],{"class":784},"status",[741,957,846],{"class":751},[741,959,896],{"class":755},[741,961,716],{"class":751},[741,963,901],{"class":840},[741,965,871],{"class":755},[741,967,716],{"class":751},[741,969,970],{"class":840},"default",[741,972,843],{"class":755},[741,974,846],{"class":751},[741,976,977],{"class":784},"received",[741,979,846],{"class":751},[741,981,896],{"class":755},[741,983,874],{"class":751},[741,985,987,990,992,994,996,998,1001,1003,1005,1007],{"class":743,"line":986},9,[741,988,989],{"class":862},"  handledBy",[741,991,866],{"class":751},[741,993,767],{"class":840},[741,995,843],{"class":755},[741,997,846],{"class":751},[741,999,1000],{"class":784},"handled_by",[741,1002,846],{"class":751},[741,1004,896],{"class":755},[741,1006,759],{"class":751},[741,1008,1009],{"class":908},"       \u002F\u002F a team member; null when they are deleted\n",[741,1011,1013,1016,1018,1020],{"class":743,"line":1012},10,[741,1014,1015],{"class":862},"  createdAt",[741,1017,866],{"class":751},[741,1019,756],{"class":840},[741,1021,1022],{"class":755},"()\n",[741,1024,1026,1029],{"class":743,"line":1025},11,[741,1027,1028],{"class":751},"}",[741,1030,1031],{"class":755},")\n",[619,1033,1034,1037,1038,1041,1042,1046,1047,732],{},[643,1035,1036],{},"pnpm db:generate"," writes the migration into the module's own ",[643,1039,1040],{},"migrations\u002F","; SHADE applies it on start, with a history\ntable of its own (",[623,1043,1045],{"href":1044},"\u002Fdevelopers\u002Fmodules\u002Fcontent#database","Database","). Content the site shows and editors edit, with drafts and\nversions, is a collection instead (",[623,1048,1050],{"href":1049},"\u002Fdevelopers\u002Fmodules\u002Fcontent#collections-from-modules","Collections from modules",[619,1052,1053,1054,1057,1058,1061,1062,732],{},"A table with a ",[643,1055,1056],{},"accountReference"," holds accounts' personal data: list it in a ",[643,1059,1060],{},"personalData"," source that finds and\nerases it, or the module does not load (",[623,1063,1065],{"href":1064},"\u002Fdevelopers\u002Fmodules\u002Fbackground-and-services#personal-data","Personal data",[630,1067,1069],{"id":1068},"_3-permissions","3. Permissions",[619,1071,1072,1073,651],{},"The module's actions, declared once, granted to editors by default if you want, and checked first in every service\n(",[623,1074,1076],{"href":1075},"\u002Fdevelopers\u002Fmodules\u002Fmanifest#permissions","Permissions",[653,1078,1080],{"className":735,"code":1079,"language":737,"meta":661,"style":661},"export const ACTIONS = { 'repairs.read': [], 'repairs.manage': [] } as const\ndeclare module '@shadestack\u002Fmodule-sdk\u002Fshared' {\n  interface ActionRegistry { 'repairs.read': true, 'repairs.manage': true }\n}\n\u002F\u002F in the manifest\npermissions: { actions: ACTIONS, grants: { editor: ['repairs.read', 'repairs.manage'] } }\n",[643,1081,1082,1129,1146,1183,1188,1193],{"__ignoreMap":661},[741,1083,1084,1086,1088,1091,1093,1095,1097,1100,1102,1104,1107,1109,1111,1114,1116,1118,1121,1123,1126],{"class":743,"line":744},[741,1085,827],{"class":747},[741,1087,831],{"class":830},[741,1089,1090],{"class":755}," ACTIONS ",[741,1092,837],{"class":751},[741,1094,752],{"class":751},[741,1096,781],{"class":751},[741,1098,1099],{"class":862},"repairs.read",[741,1101,846],{"class":751},[741,1103,866],{"class":751},[741,1105,1106],{"class":755}," []",[741,1108,759],{"class":751},[741,1110,781],{"class":751},[741,1112,1113],{"class":862},"repairs.manage",[741,1115,846],{"class":751},[741,1117,866],{"class":751},[741,1119,1120],{"class":755}," [] ",[741,1122,1028],{"class":751},[741,1124,1125],{"class":747}," as",[741,1127,1128],{"class":830}," const\n",[741,1130,1131,1134,1137,1139,1142,1144],{"class":743,"line":791},[741,1132,1133],{"class":830},"declare",[741,1135,1136],{"class":830}," module",[741,1138,781],{"class":751},[741,1140,1141],{"class":784},"@shadestack\u002Fmodule-sdk\u002Fshared",[741,1143,846],{"class":751},[741,1145,856],{"class":751},[741,1147,1148,1151,1155,1157,1159,1161,1163,1165,1168,1170,1172,1174,1176,1178,1180],{"class":743,"line":817},[741,1149,1150],{"class":830},"  interface",[741,1152,1154],{"class":1153},"sBMFI"," ActionRegistry",[741,1156,752],{"class":751},[741,1158,781],{"class":751},[741,1160,1099],{"class":784},[741,1162,846],{"class":751},[741,1164,866],{"class":751},[741,1166,1167],{"class":1153}," true",[741,1169,759],{"class":751},[741,1171,781],{"class":751},[741,1173,1113],{"class":784},[741,1175,846],{"class":751},[741,1177,866],{"class":751},[741,1179,1167],{"class":1153},[741,1181,1182],{"class":751}," }\n",[741,1184,1185],{"class":743,"line":824},[741,1186,1187],{"class":751},"}\n",[741,1189,1190],{"class":743,"line":859},[741,1191,1192],{"class":908},"\u002F\u002F in the manifest\n",[741,1194,1195,1198,1200,1202,1205,1207,1210,1212,1215,1217,1219,1222,1224,1227,1229,1231,1233,1235,1237,1239,1241,1244,1246],{"class":743,"line":877},[741,1196,1197],{"class":1153},"permissions",[741,1199,866],{"class":751},[741,1201,752],{"class":751},[741,1203,1204],{"class":1153}," actions",[741,1206,866],{"class":751},[741,1208,1209],{"class":755}," ACTIONS",[741,1211,759],{"class":751},[741,1213,1214],{"class":1153}," grants",[741,1216,866],{"class":751},[741,1218,752],{"class":751},[741,1220,1221],{"class":1153}," editor",[741,1223,866],{"class":751},[741,1225,1226],{"class":862}," [",[741,1228,846],{"class":751},[741,1230,1099],{"class":784},[741,1232,846],{"class":751},[741,1234,759],{"class":751},[741,1236,781],{"class":751},[741,1238,1113],{"class":784},[741,1240,846],{"class":751},[741,1242,1243],{"class":862},"] ",[741,1245,1028],{"class":751},[741,1247,1182],{"class":751},[653,1249,1251],{"className":735,"code":1250,"language":737,"meta":661,"style":661},"export async function setStatus(ctx: ServiceContext, id: string, input: unknown) {\n  assertCan(ctx.actor, 'repairs.manage')\n  const { status } = parseInput(StatusInput, input)\n  return ctx.db.transaction(async (tx) => {\n    const [job] = await tx.update(repairsJobs).set({ status }).where(eq(repairsJobs.id, id)).returning()\n    if (!job) throw notFound('Repair not found')\n    await recordAudit(tx, ctx, { action: 'repairs.manage', targetType: 'repair', targetId: id, summary: `Repair set to ${status}` })\n    return job\n  })\n}\n",[643,1252,1253,1300,1324,1353,1389,1471,1503,1582,1590,1597],{"__ignoreMap":661},[741,1254,1255,1257,1260,1263,1266,1268,1272,1274,1277,1279,1281,1283,1286,1288,1291,1293,1296,1298],{"class":743,"line":744},[741,1256,827],{"class":747},[741,1258,1259],{"class":830}," async",[741,1261,1262],{"class":830}," function",[741,1264,1265],{"class":840}," setStatus",[741,1267,843],{"class":751},[741,1269,1271],{"class":1270},"sHdIc","ctx",[741,1273,866],{"class":751},[741,1275,1276],{"class":1153}," ServiceContext",[741,1278,759],{"class":751},[741,1280,762],{"class":1270},[741,1282,866],{"class":751},[741,1284,1285],{"class":1153}," string",[741,1287,759],{"class":751},[741,1289,1290],{"class":1270}," input",[741,1292,866],{"class":751},[741,1294,1295],{"class":1153}," unknown",[741,1297,896],{"class":751},[741,1299,856],{"class":751},[741,1301,1302,1305,1307,1309,1311,1314,1316,1318,1320,1322],{"class":743,"line":791},[741,1303,1304],{"class":840},"  assertCan",[741,1306,843],{"class":862},[741,1308,1271],{"class":755},[741,1310,716],{"class":751},[741,1312,1313],{"class":755},"actor",[741,1315,759],{"class":751},[741,1317,781],{"class":751},[741,1319,1113],{"class":784},[741,1321,846],{"class":751},[741,1323,1031],{"class":862},[741,1325,1326,1329,1331,1334,1336,1339,1342,1344,1347,1349,1351],{"class":743,"line":817},[741,1327,1328],{"class":830},"  const",[741,1330,752],{"class":751},[741,1332,1333],{"class":755}," status",[741,1335,775],{"class":751},[741,1337,1338],{"class":751}," =",[741,1340,1341],{"class":840}," parseInput",[741,1343,843],{"class":862},[741,1345,1346],{"class":755},"StatusInput",[741,1348,759],{"class":751},[741,1350,1290],{"class":755},[741,1352,1031],{"class":862},[741,1354,1355,1358,1361,1363,1366,1368,1371,1373,1376,1379,1382,1384,1387],{"class":743,"line":824},[741,1356,1357],{"class":747},"  return",[741,1359,1360],{"class":755}," ctx",[741,1362,716],{"class":751},[741,1364,1365],{"class":755},"db",[741,1367,716],{"class":751},[741,1369,1370],{"class":840},"transaction",[741,1372,843],{"class":862},[741,1374,1375],{"class":830},"async",[741,1377,1378],{"class":751}," (",[741,1380,1381],{"class":1270},"tx",[741,1383,896],{"class":751},[741,1385,1386],{"class":830}," =>",[741,1388,856],{"class":751},[741,1390,1391,1394,1396,1399,1402,1404,1407,1410,1412,1415,1417,1420,1422,1424,1427,1429,1432,1434,1436,1438,1440,1443,1445,1448,1450,1452,1454,1457,1459,1461,1464,1466,1469],{"class":743,"line":859},[741,1392,1393],{"class":830},"    const",[741,1395,1226],{"class":751},[741,1397,1398],{"class":755},"job",[741,1400,1401],{"class":751},"]",[741,1403,1338],{"class":751},[741,1405,1406],{"class":747}," await",[741,1408,1409],{"class":755}," tx",[741,1411,716],{"class":751},[741,1413,1414],{"class":840},"update",[741,1416,843],{"class":862},[741,1418,1419],{"class":755},"repairsJobs",[741,1421,896],{"class":862},[741,1423,716],{"class":751},[741,1425,1426],{"class":840},"set",[741,1428,843],{"class":862},[741,1430,1431],{"class":751},"{",[741,1433,1333],{"class":755},[741,1435,775],{"class":751},[741,1437,896],{"class":862},[741,1439,716],{"class":751},[741,1441,1442],{"class":840},"where",[741,1444,843],{"class":862},[741,1446,1447],{"class":840},"eq",[741,1449,843],{"class":862},[741,1451,1419],{"class":755},[741,1453,716],{"class":751},[741,1455,1456],{"class":755},"id",[741,1458,759],{"class":751},[741,1460,762],{"class":755},[741,1462,1463],{"class":862},"))",[741,1465,716],{"class":751},[741,1467,1468],{"class":840},"returning",[741,1470,1022],{"class":862},[741,1472,1473,1476,1478,1481,1483,1486,1489,1492,1494,1496,1499,1501],{"class":743,"line":877},[741,1474,1475],{"class":747},"    if",[741,1477,1378],{"class":862},[741,1479,1480],{"class":751},"!",[741,1482,1398],{"class":755},[741,1484,1485],{"class":862},") ",[741,1487,1488],{"class":747},"throw",[741,1490,1491],{"class":840}," notFound",[741,1493,843],{"class":862},[741,1495,846],{"class":751},[741,1497,1498],{"class":784},"Repair not found",[741,1500,846],{"class":751},[741,1502,1031],{"class":862},[741,1504,1505,1508,1511,1513,1515,1517,1519,1521,1523,1526,1528,1530,1532,1534,1536,1539,1541,1543,1546,1548,1550,1553,1555,1557,1559,1562,1564,1567,1570,1573,1575,1578,1580],{"class":743,"line":912},[741,1506,1507],{"class":747},"    await",[741,1509,1510],{"class":840}," recordAudit",[741,1512,843],{"class":862},[741,1514,1381],{"class":755},[741,1516,759],{"class":751},[741,1518,1360],{"class":755},[741,1520,759],{"class":751},[741,1522,752],{"class":751},[741,1524,1525],{"class":862}," action",[741,1527,866],{"class":751},[741,1529,781],{"class":751},[741,1531,1113],{"class":784},[741,1533,846],{"class":751},[741,1535,759],{"class":751},[741,1537,1538],{"class":862}," targetType",[741,1540,866],{"class":751},[741,1542,781],{"class":751},[741,1544,1545],{"class":784},"repair",[741,1547,846],{"class":751},[741,1549,759],{"class":751},[741,1551,1552],{"class":862}," targetId",[741,1554,866],{"class":751},[741,1556,762],{"class":755},[741,1558,759],{"class":751},[741,1560,1561],{"class":862}," summary",[741,1563,866],{"class":751},[741,1565,1566],{"class":751}," `",[741,1568,1569],{"class":784},"Repair set to ",[741,1571,1572],{"class":751},"${",[741,1574,955],{"class":755},[741,1576,1577],{"class":751},"}`",[741,1579,775],{"class":751},[741,1581,1031],{"class":862},[741,1583,1584,1587],{"class":743,"line":941},[741,1585,1586],{"class":747},"    return",[741,1588,1589],{"class":755}," job\n",[741,1591,1592,1595],{"class":743,"line":986},[741,1593,1594],{"class":751},"  }",[741,1596,1031],{"class":862},[741,1598,1599],{"class":743,"line":1012},[741,1600,1187],{"class":751},[630,1602,1604],{"id":1603},"_4-routes","4. Routes",[619,1606,1607,1608,732],{},"Thin: parse the input with a schema, call the service, return (",[623,1609,463],{"href":464},[1611,1612,1613,1625,1800,1968],"ul",{},[1614,1615,1616,1620,1621,1624],"li",{},[1617,1618,1619],"strong",{},"Session routes"," (the default) serve the module's admin screens, at ",[643,1622,1623],{},"\u002Fapi\u002Fpackages\u002Frepairs\u002F…",", with the editor's\nown rights.",[1614,1626,1627,1630,1631,1634,1635],{},[1617,1628,1629],{},"A public route"," for the quote request, at ",[643,1632,1633],{},"\u002Fapi\u002Fv1\u002Faccount\u002Frepairs\u002Fquote",". Anyone on the internet can call it, so\nit must declare a rate limit, and its handler validates everything and keeps out spam itself:",[653,1636,1638],{"className":735,"code":1637,"language":737,"meta":661,"style":661},"{ method: 'POST', path: '\u002Fquote', auth: 'public', rateLimit: { limit: 5, windowMs: 60_000, key: 'ip' },\n  doc: { summary: 'Asks for a quote', body: QuoteInput }, handler: (ctx, request) => askQuote(ctx, request.body) }\n",[643,1639,1640,1729],{"__ignoreMap":661},[741,1641,1642,1644,1647,1649,1651,1654,1656,1658,1661,1663,1665,1668,1670,1672,1675,1677,1679,1682,1684,1686,1689,1691,1693,1696,1698,1702,1704,1707,1709,1712,1714,1717,1719,1721,1724,1726],{"class":743,"line":744},[741,1643,1431],{"class":751},[741,1645,1646],{"class":1153}," method",[741,1648,866],{"class":751},[741,1650,781],{"class":751},[741,1652,1653],{"class":784},"POST",[741,1655,846],{"class":751},[741,1657,759],{"class":751},[741,1659,1660],{"class":1153}," path",[741,1662,866],{"class":751},[741,1664,781],{"class":751},[741,1666,1667],{"class":784},"\u002Fquote",[741,1669,846],{"class":751},[741,1671,759],{"class":751},[741,1673,1674],{"class":1153}," auth",[741,1676,866],{"class":751},[741,1678,781],{"class":751},[741,1680,1681],{"class":784},"public",[741,1683,846],{"class":751},[741,1685,759],{"class":751},[741,1687,1688],{"class":1153}," rateLimit",[741,1690,866],{"class":751},[741,1692,752],{"class":751},[741,1694,1695],{"class":1153}," limit",[741,1697,866],{"class":751},[741,1699,1701],{"class":1700},"sbssI"," 5",[741,1703,759],{"class":751},[741,1705,1706],{"class":1153}," windowMs",[741,1708,866],{"class":751},[741,1710,1711],{"class":1700}," 60_000",[741,1713,759],{"class":751},[741,1715,1716],{"class":1153}," key",[741,1718,866],{"class":751},[741,1720,781],{"class":751},[741,1722,1723],{"class":784},"ip",[741,1725,846],{"class":751},[741,1727,1728],{"class":751}," },\n",[741,1730,1731,1734,1736,1738,1740,1742,1744,1747,1749,1751,1754,1756,1759,1762,1765,1767,1769,1771,1773,1776,1778,1780,1783,1785,1787,1789,1791,1793,1796,1798],{"class":743,"line":791},[741,1732,1733],{"class":1153},"  doc",[741,1735,866],{"class":751},[741,1737,752],{"class":751},[741,1739,1561],{"class":1153},[741,1741,866],{"class":751},[741,1743,781],{"class":751},[741,1745,1746],{"class":784},"Asks for a quote",[741,1748,846],{"class":751},[741,1750,759],{"class":751},[741,1752,1753],{"class":1153}," body",[741,1755,866],{"class":751},[741,1757,1758],{"class":755}," QuoteInput",[741,1760,1761],{"class":751}," },",[741,1763,1764],{"class":1153}," handler",[741,1766,866],{"class":751},[741,1768,1378],{"class":751},[741,1770,1271],{"class":1270},[741,1772,759],{"class":751},[741,1774,1775],{"class":1270}," request",[741,1777,896],{"class":751},[741,1779,1386],{"class":830},[741,1781,1782],{"class":840}," askQuote",[741,1784,843],{"class":862},[741,1786,1271],{"class":755},[741,1788,759],{"class":751},[741,1790,1775],{"class":755},[741,1792,716],{"class":751},[741,1794,1795],{"class":755},"body",[741,1797,1485],{"class":862},[741,1799,1187],{"class":751},[1614,1801,1802,1805,1806,1809,1810,1813,1814,651,1817,1938,1941,1942,1944,1945,1947,1948,1947,1951,1954,1955,1958,1959,1962,1963,646,1966,732],{},[1617,1803,1804],{},"Account routes"," for \"my repairs\": the account arrives as ",[643,1807,1808],{},"request.account",", and\n",[643,1811,1812],{},"ownedBy"," reads only their rows (",[623,1815,1804],{"href":1816},"\u002Fdevelopers\u002Fmodules\u002Froutes#account-routes",[653,1818,1820],{"className":735,"code":1819,"language":737,"meta":661,"style":661},"{ method: 'GET', path: '\u002Fmine', auth: 'account',\n  handler: (ctx, request) => ctx.db.select().from(repairsJobs).where(ownedBy(repairsJobs.customer, request.account)) }\n",[643,1821,1822,1865],{"__ignoreMap":661},[741,1823,1824,1826,1828,1830,1832,1835,1837,1839,1841,1843,1845,1848,1850,1852,1854,1856,1858,1861,1863],{"class":743,"line":744},[741,1825,1431],{"class":751},[741,1827,1646],{"class":1153},[741,1829,866],{"class":751},[741,1831,781],{"class":751},[741,1833,1834],{"class":784},"GET",[741,1836,846],{"class":751},[741,1838,759],{"class":751},[741,1840,1660],{"class":1153},[741,1842,866],{"class":751},[741,1844,781],{"class":751},[741,1846,1847],{"class":784},"\u002Fmine",[741,1849,846],{"class":751},[741,1851,759],{"class":751},[741,1853,1674],{"class":1153},[741,1855,866],{"class":751},[741,1857,781],{"class":751},[741,1859,1860],{"class":784},"account",[741,1862,846],{"class":751},[741,1864,874],{"class":751},[741,1866,1867,1870,1872,1874,1876,1878,1880,1882,1884,1886,1888,1890,1892,1895,1897,1899,1902,1904,1906,1908,1910,1912,1914,1916,1918,1920,1922,1925,1927,1929,1931,1933,1936],{"class":743,"line":791},[741,1868,1869],{"class":1153},"  handler",[741,1871,866],{"class":751},[741,1873,1378],{"class":751},[741,1875,1271],{"class":1270},[741,1877,759],{"class":751},[741,1879,1775],{"class":1270},[741,1881,896],{"class":751},[741,1883,1386],{"class":830},[741,1885,1360],{"class":755},[741,1887,716],{"class":751},[741,1889,1365],{"class":755},[741,1891,716],{"class":751},[741,1893,1894],{"class":840},"select",[741,1896,871],{"class":862},[741,1898,716],{"class":751},[741,1900,1901],{"class":840},"from",[741,1903,843],{"class":862},[741,1905,1419],{"class":755},[741,1907,896],{"class":862},[741,1909,716],{"class":751},[741,1911,1442],{"class":840},[741,1913,843],{"class":862},[741,1915,1812],{"class":840},[741,1917,843],{"class":862},[741,1919,1419],{"class":755},[741,1921,716],{"class":751},[741,1923,1924],{"class":755},"customer",[741,1926,759],{"class":751},[741,1928,1775],{"class":755},[741,1930,716],{"class":751},[741,1932,1860],{"class":755},[741,1934,1935],{"class":862},")) ",[741,1937,1187],{"class":751},[1939,1940],"br",{},"An account ",[643,1943,1834],{}," route changes nothing; every change is a ",[643,1946,1653],{},", ",[643,1949,1950],{},"PUT",[643,1952,1953],{},"PATCH"," or ",[643,1956,1957],{},"DELETE",", which must come from the\nsite's origin. The frontend calls it with ",[643,1960,1961],{},"callAccountRoute('repairs', '\u002Fmine')"," from ",[643,1964,1965],{},"@shadestack\u002Fclient",[623,1967,502],{"href":504},[1614,1969,1970,1973,1974,1977,1978,2272,2274,2275,2277,2278,2281,2282,2286],{},[1617,1971,1972],{},"Routes for staff",": when people with different jobs use the system on its site, such as the\nmechanics of a workshop and their foreman, declare account roles instead of a role column of your own. A route\nneeds an ability, SHADE checks it before your code runs, and ",[643,1975,1976],{},"inScope"," keeps each mechanic to their workshop's rows:",[653,1979,1981],{"className":735,"code":1980,"language":737,"meta":661,"style":661},"accounts: {\n  roles: {\n    mechanic: { scope: 'workshops', can: ['jobs.read'] },\n    foreman: { scope: 'workshops', includes: ['mechanic'], can: ['mechanics.assign', { ability: 'accounts.roles.give', roles: ['mechanic'] }] }\n  }\n}\n\n{ method: 'GET', path: '\u002Fworkshop\u002Fjobs', auth: { account: 'jobs.read' },\n  handler: (ctx, request) => ctx.db.select().from(repairsJobs).where(inScope(repairsJobs.workshopId, request.account, 'jobs.read')) }\n",[643,1982,1983,1992,2001,2043,2134,2139,2143,2147,2195],{"__ignoreMap":661},[741,1984,1985,1988,1990],{"class":743,"line":744},[741,1986,1987],{"class":1153},"accounts",[741,1989,866],{"class":751},[741,1991,856],{"class":751},[741,1993,1994,1997,1999],{"class":743,"line":791},[741,1995,1996],{"class":1153},"  roles",[741,1998,866],{"class":751},[741,2000,856],{"class":751},[741,2002,2003,2006,2008,2010,2013,2015,2017,2020,2022,2024,2027,2029,2031,2033,2036,2038,2040],{"class":743,"line":817},[741,2004,2005],{"class":1153},"    mechanic",[741,2007,866],{"class":751},[741,2009,752],{"class":751},[741,2011,2012],{"class":1153}," scope",[741,2014,866],{"class":751},[741,2016,781],{"class":751},[741,2018,2019],{"class":784},"workshops",[741,2021,846],{"class":751},[741,2023,759],{"class":751},[741,2025,2026],{"class":1153}," can",[741,2028,866],{"class":751},[741,2030,1226],{"class":862},[741,2032,846],{"class":751},[741,2034,2035],{"class":784},"jobs.read",[741,2037,846],{"class":751},[741,2039,1243],{"class":862},[741,2041,2042],{"class":751},"},\n",[741,2044,2045,2048,2050,2052,2054,2056,2058,2060,2062,2064,2067,2069,2071,2073,2076,2078,2080,2082,2084,2086,2088,2090,2093,2095,2097,2099,2102,2104,2106,2109,2111,2113,2116,2118,2120,2122,2124,2126,2128,2130,2132],{"class":743,"line":824},[741,2046,2047],{"class":1153},"    foreman",[741,2049,866],{"class":751},[741,2051,752],{"class":751},[741,2053,2012],{"class":1153},[741,2055,866],{"class":751},[741,2057,781],{"class":751},[741,2059,2019],{"class":784},[741,2061,846],{"class":751},[741,2063,759],{"class":751},[741,2065,2066],{"class":1153}," includes",[741,2068,866],{"class":751},[741,2070,1226],{"class":862},[741,2072,846],{"class":751},[741,2074,2075],{"class":784},"mechanic",[741,2077,846],{"class":751},[741,2079,1401],{"class":862},[741,2081,759],{"class":751},[741,2083,2026],{"class":1153},[741,2085,866],{"class":751},[741,2087,1226],{"class":862},[741,2089,846],{"class":751},[741,2091,2092],{"class":784},"mechanics.assign",[741,2094,846],{"class":751},[741,2096,759],{"class":751},[741,2098,752],{"class":751},[741,2100,2101],{"class":862}," ability",[741,2103,866],{"class":751},[741,2105,781],{"class":751},[741,2107,2108],{"class":784},"accounts.roles.give",[741,2110,846],{"class":751},[741,2112,759],{"class":751},[741,2114,2115],{"class":862}," roles",[741,2117,866],{"class":751},[741,2119,1226],{"class":862},[741,2121,846],{"class":751},[741,2123,2075],{"class":784},[741,2125,846],{"class":751},[741,2127,1243],{"class":862},[741,2129,1028],{"class":751},[741,2131,1243],{"class":862},[741,2133,1187],{"class":751},[741,2135,2136],{"class":743,"line":859},[741,2137,2138],{"class":751},"  }\n",[741,2140,2141],{"class":743,"line":877},[741,2142,1187],{"class":751},[741,2144,2145],{"class":743,"line":912},[741,2146,821],{"emptyLinePlaceholder":820},[741,2148,2149,2151,2153,2155,2157,2159,2161,2163,2165,2167,2169,2172,2174,2176,2178,2180,2182,2185,2187,2189,2191,2193],{"class":743,"line":941},[741,2150,1431],{"class":751},[741,2152,1646],{"class":1153},[741,2154,866],{"class":751},[741,2156,781],{"class":751},[741,2158,1834],{"class":784},[741,2160,846],{"class":751},[741,2162,759],{"class":751},[741,2164,1660],{"class":1153},[741,2166,866],{"class":751},[741,2168,781],{"class":751},[741,2170,2171],{"class":784},"\u002Fworkshop\u002Fjobs",[741,2173,846],{"class":751},[741,2175,759],{"class":751},[741,2177,1674],{"class":1153},[741,2179,866],{"class":751},[741,2181,752],{"class":751},[741,2183,2184],{"class":1153}," account",[741,2186,866],{"class":751},[741,2188,781],{"class":751},[741,2190,2035],{"class":784},[741,2192,846],{"class":751},[741,2194,1728],{"class":751},[741,2196,2197,2199,2201,2203,2205,2207,2209,2211,2213,2215,2217,2219,2221,2223,2225,2227,2229,2231,2233,2235,2237,2239,2241,2243,2245,2247,2249,2252,2254,2256,2258,2260,2262,2264,2266,2268,2270],{"class":743,"line":986},[741,2198,1869],{"class":1153},[741,2200,866],{"class":751},[741,2202,1378],{"class":751},[741,2204,1271],{"class":1270},[741,2206,759],{"class":751},[741,2208,1775],{"class":1270},[741,2210,896],{"class":751},[741,2212,1386],{"class":830},[741,2214,1360],{"class":755},[741,2216,716],{"class":751},[741,2218,1365],{"class":755},[741,2220,716],{"class":751},[741,2222,1894],{"class":840},[741,2224,871],{"class":862},[741,2226,716],{"class":751},[741,2228,1901],{"class":840},[741,2230,843],{"class":862},[741,2232,1419],{"class":755},[741,2234,896],{"class":862},[741,2236,716],{"class":751},[741,2238,1442],{"class":840},[741,2240,843],{"class":862},[741,2242,1976],{"class":840},[741,2244,843],{"class":862},[741,2246,1419],{"class":755},[741,2248,716],{"class":751},[741,2250,2251],{"class":755},"workshopId",[741,2253,759],{"class":751},[741,2255,1775],{"class":755},[741,2257,716],{"class":751},[741,2259,1860],{"class":755},[741,2261,759],{"class":751},[741,2263,781],{"class":751},[741,2265,2035],{"class":784},[741,2267,846],{"class":751},[741,2269,1935],{"class":862},[741,2271,1187],{"class":751},[1939,2273],{},"An admin gives the first foreman their role on the Accounts screen; the foreman gives ",[643,2276,2075],{}," in their own\nworkshop with ",[643,2279,2280],{},"assignAccountRole",", the only way your module gives roles\n(",[623,2283,2285],{"href":2284},"\u002Fdevelopers\u002Fmodules\u002Froutes#account-roles","Account roles","). Bounded on purpose: one scope per role, no rules language, not\nfor separate customers in one install, no single sign-on.",[630,2288,2290],{"id":2289},"_5-content-as-the-module-itself","5. Content, as the module itself",[619,2292,2293,2294,2297],{},"The weekly post is written by a schedule, which runs as the module's own actor with exactly the grants its\nmanifest lists in ",[643,2295,2296],{},"uses",", shown to the admin on the install consent:",[653,2299,2301],{"className":735,"code":2300,"language":737,"meta":661,"style":661},"uses: ['collections.website-posts.create', 'collections.website-posts.publish'],\nschedules: [{ name: 'weekly-post', intervalMs: 7 * 24 * 3_600_000, run: async (ctx) => {\n  const post = await createEntry(ctx, 'posts', { data: { title: 'Repaired this week', slug: `repaired-${week()}` } })\n  await publishEntry(ctx, 'posts', post.id, {})\n} }]\n",[643,2302,2303,2331,2394,2471,2506],{"__ignoreMap":661},[741,2304,2305,2307,2309,2311,2313,2316,2318,2320,2322,2325,2327,2329],{"class":743,"line":744},[741,2306,2296],{"class":1153},[741,2308,866],{"class":751},[741,2310,1226],{"class":755},[741,2312,846],{"class":751},[741,2314,2315],{"class":784},"collections.website-posts.create",[741,2317,846],{"class":751},[741,2319,759],{"class":751},[741,2321,781],{"class":751},[741,2323,2324],{"class":784},"collections.website-posts.publish",[741,2326,846],{"class":751},[741,2328,1401],{"class":755},[741,2330,874],{"class":751},[741,2332,2333,2336,2338,2340,2342,2345,2347,2349,2352,2354,2356,2359,2361,2364,2367,2370,2372,2375,2377,2380,2382,2384,2386,2388,2390,2392],{"class":743,"line":791},[741,2334,2335],{"class":1153},"schedules",[741,2337,866],{"class":751},[741,2339,1226],{"class":755},[741,2341,1431],{"class":751},[741,2343,2344],{"class":862}," name",[741,2346,866],{"class":751},[741,2348,781],{"class":751},[741,2350,2351],{"class":784},"weekly-post",[741,2353,846],{"class":751},[741,2355,759],{"class":751},[741,2357,2358],{"class":862}," intervalMs",[741,2360,866],{"class":751},[741,2362,2363],{"class":1700}," 7",[741,2365,2366],{"class":751}," *",[741,2368,2369],{"class":1700}," 24",[741,2371,2366],{"class":751},[741,2373,2374],{"class":1700}," 3_600_000",[741,2376,759],{"class":751},[741,2378,2379],{"class":840}," run",[741,2381,866],{"class":751},[741,2383,1259],{"class":830},[741,2385,1378],{"class":751},[741,2387,1271],{"class":1270},[741,2389,896],{"class":751},[741,2391,1386],{"class":830},[741,2393,856],{"class":751},[741,2395,2396,2398,2401,2403,2405,2408,2410,2412,2414,2416,2419,2421,2423,2425,2428,2430,2432,2435,2437,2439,2442,2444,2446,2449,2451,2453,2456,2458,2461,2463,2465,2467,2469],{"class":743,"line":817},[741,2397,1328],{"class":830},[741,2399,2400],{"class":755}," post",[741,2402,1338],{"class":751},[741,2404,1406],{"class":747},[741,2406,2407],{"class":840}," createEntry",[741,2409,843],{"class":862},[741,2411,1271],{"class":755},[741,2413,759],{"class":751},[741,2415,781],{"class":751},[741,2417,2418],{"class":784},"posts",[741,2420,846],{"class":751},[741,2422,759],{"class":751},[741,2424,752],{"class":751},[741,2426,2427],{"class":862}," data",[741,2429,866],{"class":751},[741,2431,752],{"class":751},[741,2433,2434],{"class":862}," title",[741,2436,866],{"class":751},[741,2438,781],{"class":751},[741,2440,2441],{"class":784},"Repaired this week",[741,2443,846],{"class":751},[741,2445,759],{"class":751},[741,2447,2448],{"class":862}," slug",[741,2450,866],{"class":751},[741,2452,1566],{"class":751},[741,2454,2455],{"class":784},"repaired-",[741,2457,1572],{"class":751},[741,2459,2460],{"class":840},"week",[741,2462,871],{"class":755},[741,2464,1577],{"class":751},[741,2466,775],{"class":751},[741,2468,775],{"class":751},[741,2470,1031],{"class":862},[741,2472,2473,2476,2479,2481,2483,2485,2487,2489,2491,2493,2495,2497,2499,2501,2504],{"class":743,"line":824},[741,2474,2475],{"class":747},"  await",[741,2477,2478],{"class":840}," publishEntry",[741,2480,843],{"class":862},[741,2482,1271],{"class":755},[741,2484,759],{"class":751},[741,2486,781],{"class":751},[741,2488,2418],{"class":784},[741,2490,846],{"class":751},[741,2492,759],{"class":751},[741,2494,2400],{"class":755},[741,2496,716],{"class":751},[741,2498,1456],{"class":755},[741,2500,759],{"class":751},[741,2502,2503],{"class":751}," {}",[741,2505,1031],{"class":862},[741,2507,2508,2510,2512],{"class":743,"line":859},[741,2509,1028],{"class":751},[741,2511,775],{"class":751},[741,2513,2514],{"class":755},"]\n",[619,2516,2517,2518,1378,2521,2525,2526,2528,2529,2534],{},"Core's content services check the permission, validate, write in a transaction and audit the post as\n",[643,2519,2520],{},"package:repairs",[623,2522,2524],{"href":2523},"\u002Fdevelopers\u002Fmodules\u002Fcontent#content-services","Content services","). Public and account routes act as the module too;\nsession routes act as the editor and never get more from ",[643,2527,2296],{},". What can never be\ngranted (accounts, roles, tokens, settings, the logs, the forms collection, …) is listed under\n",[623,2530,2532],{"href":2531},"\u002Fdevelopers\u002Fmodules\u002Fmanifest#what-the-module-itself-may-do-uses",[643,2533,2296],{},". A module that only touches its own tables needs no grants.",[630,2536,2538],{"id":2537},"_6-in-the-admin","6. In the admin",[619,2540,2541,2542,2545,2546,651],{},"Pages, a sidebar group of its own, dashboard cards, a panel beside an entry editor and a section of Settings, all in\nthe manifest's ",[643,2543,2544],{},"admin"," part (",[623,2547,2549],{"href":2548},"\u002Fdevelopers\u002Fmodules\u002Fadmin-and-site#where-a-module-appears-in-the-admin","Where a module appears in the\nadmin",[653,2551,2553],{"className":735,"code":2552,"language":737,"meta":661,"style":661},"admin: {\n  locales: 'admin\u002Flocales',\n  pages: [{ path: '\u002Fmodules\u002Frepairs\u002Fjobs', file: 'admin\u002FJobsPage.vue' }],\n  sidebar: { group: { label: 'repairs.sidebar.group', icon: 'i-lucide-wrench' },\n    entries: [{ label: 'repairs.sidebar.jobs', icon: 'i-lucide-list', to: '\u002Fmodules\u002Frepairs\u002Fjobs', requires: 'repairs.read' }] },\n  widgets: [{ id: 'waiting', label: 'repairs.widgets.waiting', file: 'admin\u002FWaitingWidget.vue', requires: 'repairs.read' }],\n  settings: [{ id: 'general', label: 'repairs.settings.title', file: 'admin\u002FRepairsSettings.vue' }]\n}\n",[643,2554,2555,2563,2579,2621,2665,2732,2798,2850],{"__ignoreMap":661},[741,2556,2557,2559,2561],{"class":743,"line":744},[741,2558,2544],{"class":1153},[741,2560,866],{"class":751},[741,2562,856],{"class":751},[741,2564,2565,2568,2570,2572,2575,2577],{"class":743,"line":791},[741,2566,2567],{"class":1153},"  locales",[741,2569,866],{"class":751},[741,2571,781],{"class":751},[741,2573,2574],{"class":784},"admin\u002Flocales",[741,2576,846],{"class":751},[741,2578,874],{"class":751},[741,2580,2581,2584,2586,2588,2590,2592,2594,2596,2599,2601,2603,2606,2608,2610,2613,2615,2617,2619],{"class":743,"line":817},[741,2582,2583],{"class":1153},"  pages",[741,2585,866],{"class":751},[741,2587,1226],{"class":862},[741,2589,1431],{"class":751},[741,2591,1660],{"class":862},[741,2593,866],{"class":751},[741,2595,781],{"class":751},[741,2597,2598],{"class":784},"\u002Fmodules\u002Frepairs\u002Fjobs",[741,2600,846],{"class":751},[741,2602,759],{"class":751},[741,2604,2605],{"class":862}," file",[741,2607,866],{"class":751},[741,2609,781],{"class":751},[741,2611,2612],{"class":784},"admin\u002FJobsPage.vue",[741,2614,846],{"class":751},[741,2616,775],{"class":751},[741,2618,1401],{"class":862},[741,2620,874],{"class":751},[741,2622,2623,2626,2628,2630,2633,2635,2637,2640,2642,2644,2647,2649,2651,2654,2656,2658,2661,2663],{"class":743,"line":824},[741,2624,2625],{"class":1153},"  sidebar",[741,2627,866],{"class":751},[741,2629,752],{"class":751},[741,2631,2632],{"class":1153}," group",[741,2634,866],{"class":751},[741,2636,752],{"class":751},[741,2638,2639],{"class":1153}," label",[741,2641,866],{"class":751},[741,2643,781],{"class":751},[741,2645,2646],{"class":784},"repairs.sidebar.group",[741,2648,846],{"class":751},[741,2650,759],{"class":751},[741,2652,2653],{"class":1153}," icon",[741,2655,866],{"class":751},[741,2657,781],{"class":751},[741,2659,2660],{"class":784},"i-lucide-wrench",[741,2662,846],{"class":751},[741,2664,1728],{"class":751},[741,2666,2667,2670,2672,2674,2676,2678,2680,2682,2685,2687,2689,2691,2693,2695,2698,2700,2702,2705,2707,2709,2711,2713,2715,2718,2720,2722,2724,2726,2728,2730],{"class":743,"line":859},[741,2668,2669],{"class":1153},"    entries",[741,2671,866],{"class":751},[741,2673,1226],{"class":862},[741,2675,1431],{"class":751},[741,2677,2639],{"class":862},[741,2679,866],{"class":751},[741,2681,781],{"class":751},[741,2683,2684],{"class":784},"repairs.sidebar.jobs",[741,2686,846],{"class":751},[741,2688,759],{"class":751},[741,2690,2653],{"class":862},[741,2692,866],{"class":751},[741,2694,781],{"class":751},[741,2696,2697],{"class":784},"i-lucide-list",[741,2699,846],{"class":751},[741,2701,759],{"class":751},[741,2703,2704],{"class":862}," to",[741,2706,866],{"class":751},[741,2708,781],{"class":751},[741,2710,2598],{"class":784},[741,2712,846],{"class":751},[741,2714,759],{"class":751},[741,2716,2717],{"class":862}," requires",[741,2719,866],{"class":751},[741,2721,781],{"class":751},[741,2723,1099],{"class":784},[741,2725,846],{"class":751},[741,2727,775],{"class":751},[741,2729,1243],{"class":862},[741,2731,2042],{"class":751},[741,2733,2734,2737,2739,2741,2743,2745,2747,2749,2752,2754,2756,2758,2760,2762,2765,2767,2769,2771,2773,2775,2778,2780,2782,2784,2786,2788,2790,2792,2794,2796],{"class":743,"line":877},[741,2735,2736],{"class":1153},"  widgets",[741,2738,866],{"class":751},[741,2740,1226],{"class":862},[741,2742,1431],{"class":751},[741,2744,762],{"class":862},[741,2746,866],{"class":751},[741,2748,781],{"class":751},[741,2750,2751],{"class":784},"waiting",[741,2753,846],{"class":751},[741,2755,759],{"class":751},[741,2757,2639],{"class":862},[741,2759,866],{"class":751},[741,2761,781],{"class":751},[741,2763,2764],{"class":784},"repairs.widgets.waiting",[741,2766,846],{"class":751},[741,2768,759],{"class":751},[741,2770,2605],{"class":862},[741,2772,866],{"class":751},[741,2774,781],{"class":751},[741,2776,2777],{"class":784},"admin\u002FWaitingWidget.vue",[741,2779,846],{"class":751},[741,2781,759],{"class":751},[741,2783,2717],{"class":862},[741,2785,866],{"class":751},[741,2787,781],{"class":751},[741,2789,1099],{"class":784},[741,2791,846],{"class":751},[741,2793,775],{"class":751},[741,2795,1401],{"class":862},[741,2797,874],{"class":751},[741,2799,2800,2803,2805,2807,2809,2811,2813,2815,2818,2820,2822,2824,2826,2828,2831,2833,2835,2837,2839,2841,2844,2846,2848],{"class":743,"line":912},[741,2801,2802],{"class":1153},"  settings",[741,2804,866],{"class":751},[741,2806,1226],{"class":862},[741,2808,1431],{"class":751},[741,2810,762],{"class":862},[741,2812,866],{"class":751},[741,2814,781],{"class":751},[741,2816,2817],{"class":784},"general",[741,2819,846],{"class":751},[741,2821,759],{"class":751},[741,2823,2639],{"class":862},[741,2825,866],{"class":751},[741,2827,781],{"class":751},[741,2829,2830],{"class":784},"repairs.settings.title",[741,2832,846],{"class":751},[741,2834,759],{"class":751},[741,2836,2605],{"class":862},[741,2838,866],{"class":751},[741,2840,781],{"class":751},[741,2842,2843],{"class":784},"admin\u002FRepairsSettings.vue",[741,2845,846],{"class":751},[741,2847,775],{"class":751},[741,2849,2514],{"class":862},[741,2851,2852],{"class":743,"line":941},[741,2853,1187],{"class":751},[619,2855,2856,2857,1947,2860,2863,2864,2868,2869,2872,2873,2876,2877,2880,2881,732],{},"Screens use the admin's Vue, Nuxt UI and composables without importing them, and build their forms with the admin's\nown field components (",[643,2858,2859],{},"FieldForm",[643,2861,2862],{},"FieldRenderer","; ",[623,2865,2867],{"href":2866},"\u002Fdevelopers\u002Fmodules\u002Fadmin-and-site#forms-from-the-admins-field-components","Forms from the admin's field components",").\nA settings section is for admins only: every route it calls starts with ",[643,2870,2871],{},"assertModuleAdmin(ctx)",". Texts go in\n",[643,2874,2875],{},"admin\u002Flocales\u002Fen.json"," and ",[643,2878,2879],{},"nl.json",", with the same keys (",[623,2882,2884],{"href":2883},"\u002Fdevelopers\u002Fmodules\u002Fsdk-and-tooling#its-texts","Its texts",[630,2886,2888],{"id":2887},"_7-building-on-another-module","7. Building on another module",[619,2890,2891,2892,1947,2895,1954,2898,2901,2902,874,2905,2908],{},"When the client's module builds on another module (an official one, such as the website module once it is one), it\nsays so with the versions it works with, within one major version of it: ",[643,2893,2894],{},"1.2.0",[643,2896,2897],{},"^1.2.0",[643,2899,2900],{},"~1.2.0",", never ",[643,2903,2904],{},"*",[643,2906,2907],{},">=1.0.0"," or a range across major versions. A patch or minor release of the other module then needs no\nnew release of the client's; its next major version does:",[653,2910,2912],{"className":735,"code":2911,"language":737,"meta":661,"style":661},"requires: { website: '^1.0.0' },\nuses: ['collections.website-pages.read']\n",[643,2913,2914,2937],{"__ignoreMap":661},[741,2915,2916,2919,2921,2923,2926,2928,2930,2933,2935],{"class":743,"line":744},[741,2917,2918],{"class":1153},"requires",[741,2920,866],{"class":751},[741,2922,752],{"class":751},[741,2924,2925],{"class":1153}," website",[741,2927,866],{"class":751},[741,2929,781],{"class":751},[741,2931,2932],{"class":784},"^1.0.0",[741,2934,846],{"class":751},[741,2936,1728],{"class":751},[741,2938,2939,2941,2943,2945,2947,2950,2952],{"class":743,"line":791},[741,2940,2296],{"class":1153},[741,2942,866],{"class":751},[741,2944,1226],{"class":755},[741,2946,846],{"class":751},[741,2948,2949],{"class":784},"collections.website-pages.read",[741,2951,846],{"class":751},[741,2953,2514],{"class":755},[619,2955,2956,2957,2959,2960,2963,2964,732],{},"SHADE loads the other module first, refuses the client's module while the other is missing or of another version, and\ncounts it as off while the other is off; the other can't be switched off, uninstalled or updated past the range while\nthe client's module is on. Its ",[643,2958,2296],{}," may name the other module's collections only when that module shares them\n(",[643,2961,2962],{},"shares: { collections: ['website-pages'] }","), and the install consent names both modules\n(",[623,2965,2967],{"href":2966},"\u002Fdevelopers\u002Fmodules\u002Fmanifest#modules-that-build-on-other-modules","Modules that build on other modules",[630,2969,2971],{"id":2970},"_8-tests","8. Tests",[1611,2973,2974,2994,3031],{},[1614,2975,2976,2979,2980,1962,2983,2985,2986,2989,2990,2993],{},[1617,2977,2978],{},"Unit",": ",[643,2981,2982],{},"module.test.ts",[643,2984,666],{}," checks the manifest (",[643,2987,2988],{},"validateModule",") and its texts in both languages\n(",[643,2991,2992],{},"checkModuleTexts","). Test your services' rules here too.",[1614,2995,2996,2979,2999,1962,3002,3005,3006,3009,3010,1947,3013,2876,3016,3019,3020,3023,3024,3026,3027,3030],{},[1617,2997,2998],{},"Postgres",[643,3000,3001],{},"...testDatabase()",[643,3003,3004],{},"@shadestack\u002Fmodule-sdk\u002Ftest-database"," in ",[643,3007,3008],{},"vitest.config.ts",", then\n",[643,3011,3012],{},"createTestDatabase()",[643,3014,3015],{},"loadModules([plugin], …)",[643,3017,3018],{},"moduleContext(ctx, 'repairs')"," from\n",[643,3021,3022],{},"@shadestack\u002Fmodule-sdk\u002Ftesting",": test that an editor without ",[643,3025,1113],{}," is refused, that an account sees only\ntheir own repairs, that a mechanic of one workshop never reads another's jobs (memberships in\n",[643,3028,3029],{},"tables.accountRoles","), that the job's post is audited as the module.",[1614,3032,3033,2979,3036,3039,3040,3043,3044,3047,3048,732],{},[1617,3034,3035],{},"Browser",[643,3037,3038],{},"e2e\u002Fplaywright.config.ts"," with ",[643,3041,3042],{},"moduleE2eConfig"," runs against SHADE's test instance with the module\ninstalled as a package; ",[643,3045,3046],{},"e2e\u002Fsite.config.ts"," for the site (",[623,3049,3051],{"href":3050},"\u002Fdevelopers\u002Fmodules\u002Fsdk-and-tooling#its-browser-tests","Its browser tests",[619,3053,3054,1947,3057,3060],{},[643,3055,3056],{},"pnpm test",[643,3058,3059],{},"pnpm typecheck"," and the browser tests in the workspace before every release.",[630,3062,3064],{"id":3063},"_9-package-sign-and-install","9. Package, sign and install",[653,3066,3069],{"className":3067,"code":3068,"language":658},[656],"pnpm package                                                  # dist\u002Frepairs-\u003Cversion>.shade-module.json\npnpm exec shade-module sign dist\u002Frepairs-\u003Cversion>.shade-module.json --name rg-digital --key \u003Cprivate key file>\n",[643,3070,3068],{"__ignoreMap":661},[619,3072,3073,3076,3077,3080,3081,3084,3085,3088,3089,3092,3093,3095,3096,732],{},[643,3074,3075],{},"build"," refuses a module that reads ",[643,3078,3079],{},"process.env"," (secrets are settings), checks the manifest, and refuses one whose\nparts need a ",[623,3082,3083],{"href":390},"capability"," it does not declare, naming it: the repair shop declares\n",[643,3086,3087],{},"capabilities: { http: {}, schedule: {}, accounts: {}, personalData: {} }"," for its routes, its weekly post, its customers'\nand mechanics' roles and its personal data (",[643,3090,3091],{},"shade-module capabilities"," prints what a manifest needs). It writes the\ndeclaration into the package with ",[643,3094,2296],{}," and the modules it requires, and warns about deprecated SDK names it uses. The signature covers all of it; the private key never goes\nin a repository (",[623,3097,3099],{"href":3098},"\u002Fdevelopers\u002Fmodules\u002Fsdk-and-tooling#packaging-and-signing","Packaging and signing",[619,3101,3102,3103,3106,3107,3111,3112,3005,3115,2876,3118,3121],{},"On the client's instance an admin installs the file under ",[694,3104,3105],{},"Modules → Install package",": the consent lists what it can\ndo, an admin agrees to trust it, and it runs after a restart\n(",[623,3108,3110],{"href":3109},"\u002Fdevelopers\u002Fmodules\u002Fsdk-and-tooling#installing-a-trusted-module","Installing a trusted module","). For each release raise\n",[643,3113,3114],{},"version",[643,3116,3117],{},"module.ts",[643,3119,3120],{},"package.json","; an update that asks for more (a new capability, a new route for anyone, a\nnew grant, a shared collection it starts using) asks for consent again.",[630,3123,3125],{"id":3124},"what-shade-checks-and-what-is-yours","What SHADE checks, and what is yours",[619,3127,3128],{},"The SDK is a contract, not a sandbox. A trusted module runs\ninside the API's process: SHADE makes the honest path the easy one, but whatever the module's own code does is the\nmodule author's to get right.",[3130,3131,3132,3145],"table",{},[3133,3134,3135],"thead",{},[3136,3137,3138,3142],"tr",{},[3139,3140,3141],"th",{},"SHADE checks",[3139,3143,3144],{},"Yours",[3146,3147,3148,3164,3174,3185,3201,3212,3227,3235,3243,3258],"tbody",{},[3136,3149,3150,3154],{},[3151,3152,3153],"td",{},"Who is signed in: the team on session routes, the account on account routes (401 otherwise); cross-site requests and other origins refused on account routes",[3151,3155,3156,3157,3160,3161,3163],{},"What each route lets that person do: ",[643,3158,3159],{},"assertCan"," first in every service, ",[643,3162,1812],{}," on every query of an account's rows (a route that forgets it shows every account's data)",[3136,3165,3166,3169],{},[3151,3167,3168],{},"An account route's ability, from the account's roles read on every request (403 otherwise); who may give which role, in which scope, audited",[3151,3170,3171,3173],{},[643,3172,1976],{}," on every query of a scoped route (a route that forgets it shows one workshop's mechanics every workshop's rows)",[3136,3175,3176,3182],{},[3151,3177,3178,3179,3181],{},"That a manifest is well formed: names, prefixes, routes, rate limits declared, ",[643,3180,2296],{}," grantable, required modules present and in range",[3151,3183,3184],{},"The rate limit is enough for what the route costs; spam and abuse protection on public routes (a honeypot, a captcha of your own, limits per address)",[3136,3186,3187,3190],{},[3151,3188,3189],{},"The permission, input and audit of core's own services (content services, media, email)",[3151,3191,3192,3193,3196,3197,3200],{},"Validating your own input with a schema (",[643,3194,3195],{},"parseInput","), writing in a transaction, and ",[643,3198,3199],{},"recordAudit"," for your own changes",[3136,3202,3203,3209],{},[3151,3204,3205,3206,3208],{},"The module actor's grants (",[643,3207,2296],{},"): nothing else, and never admins' actions",[3151,3210,3211],{},"Asking only for the grants you need; never making up an actor of your own to get around them",[3136,3213,3214,3217],{},[3151,3215,3216],{},"Personal data tables that refer to accounts are registered (the module does not load otherwise)",[3151,3218,3219,3220,3222,3223,3226],{},"Every other personal data you keep (names, addresses in your own columns) in a ",[643,3221,1060],{}," source and a ",[643,3224,3225],{},"retention"," kind",[3136,3228,3229,3232],{},[3151,3230,3231],{},"Secrets as encrypted settings, the module's own only",[3151,3233,3234],{},"Never logging them, never sending them to a browser",[3136,3236,3237,3240],{},[3151,3238,3239],{},"The signature and consent of the package; the stylesheet scoped to its own markup",[3151,3241,3242],{},"What your admin screens and site parts render: escaping, what they fetch, what they show to whom",[3136,3244,3245,3248],{},[3151,3246,3247],{},"An error in a widget, panel or settings section stays in its box and goes to the error log",[3151,3249,3250,3251,1947,3254,3257],{},"Errors in your own routes and schedules that are expected: answer with SHADE's errors (",[643,3252,3253],{},"notFound",[643,3255,3256],{},"validation",", …), never a stack trace",[3136,3259,3260,3266],{},[3151,3261,3262,3263],{},"Webhook signatures over the raw body when a route declares ",[643,3264,3265],{},"webhook",[3151,3267,3268,3269,3272],{},"Idempotency of what a webhook or a retried request does (",[643,3270,3271],{},"idempotent: true",", or by the provider's id)",[619,3274,3275],{},"When something the module needs is missing from the SDK, ask for it to be added to the SDK (and its contract) rather\nthan importing core's files: a module that reaches past the SDK breaks on SHADE's next version, and the contract\ncan't warn it.",[3277,3278,3279],"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 pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}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);}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}",{"title":661,"searchDepth":791,"depth":791,"links":3281},[3282,3283,3284,3285,3286,3287,3288,3289,3290,3291],{"id":632,"depth":791,"text":633},{"id":719,"depth":791,"text":720},{"id":1068,"depth":791,"text":1069},{"id":1603,"depth":791,"text":1604},{"id":2289,"depth":791,"text":2290},{"id":2537,"depth":791,"text":2538},{"id":2887,"depth":791,"text":2888},{"id":2970,"depth":791,"text":2971},{"id":3063,"depth":791,"text":3064},{"id":3124,"depth":791,"text":3125},"md",null,{},{"title":537,"description":661},"I9KDfuFc7eQ1B_OyntEhkulnsGk8B8uxHH3GYkGUA3Y",[3298,3299],{"title":533,"path":534,"stem":535,"description":661,"children":-1},{"title":547,"path":548,"stem":549,"description":661,"children":-1},1796500153725]