[{"data":1,"prerenderedAt":2462},["ShallowReactive",2],{"navigation":3,"\u002Fextensions\u002Fqueries":340,"\u002Fextensions\u002Fqueries-surround":2457},{"3.x":4,"2.x":236},[5,32,61,103,125,151,169,207],{"title":6,"icon":7,"path":8,"stem":9,"children":10,"page":31},"Getting Started","i-heroicons-star","\u002Fgetting-started","1.getting-started",[11,15,19,23,27],{"title":12,"path":13,"stem":14},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction",{"title":16,"path":17,"stem":18},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation",{"title":20,"path":21,"stem":22},"Quick start","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F3.quick-start",{"title":24,"path":25,"stem":26},"Configuration","\u002Fgetting-started\u002Fconfiguration","1.getting-started\u002F4.configuration",{"title":28,"path":29,"stem":30},"Upgrade guide","\u002Fgetting-started\u002Fupgrade-guide","1.getting-started\u002F5.upgrade-guide",false,{"title":33,"icon":34,"path":35,"stem":36,"children":37,"page":31},"Resources","i-heroicons-document-text","\u002Fresources","2.resources",[38,41,45,49,53,57],{"title":33,"path":39,"stem":40},"\u002Fresources\u002Fresources","2.resources\u002F1.resources",{"title":42,"path":43,"stem":44},"Fields","\u002Fresources\u002Ffields","2.resources\u002F2.fields",{"title":46,"path":47,"stem":48},"Relationships","\u002Fresources\u002Frelations","2.resources\u002F3.relations",{"title":50,"path":51,"stem":52},"Validation","\u002Fresources\u002Fvalidation","2.resources\u002F4.validation",{"title":54,"path":55,"stem":56},"Perimeter","\u002Fresources\u002Fperimeter","2.resources\u002F5.perimeter",{"title":58,"path":59,"stem":60},"Limits","\u002Fresources\u002Flimits","2.resources\u002F6.limits",{"title":62,"icon":63,"path":64,"stem":65,"children":66,"page":31},"Search","i-heroicons-magnifying-glass","\u002Fsearch","3.search",[67,71,75,79,83,87,91,95,99],{"title":68,"path":69,"stem":70},"Search overview","\u002Fsearch\u002Foverview","3.search\u002F1.overview",{"title":72,"path":73,"stem":74},"Search filters","\u002Fsearch\u002Ffilters","3.search\u002F2.filters",{"title":76,"path":77,"stem":78},"Sorts and selects","\u002Fsearch\u002Fsorts-and-selects","3.search\u002F3.sorts-and-selects",{"title":80,"path":81,"stem":82},"Includes and aggregates","\u002Fsearch\u002Fincludes-and-aggregates","3.search\u002F4.includes-and-aggregates",{"title":84,"path":85,"stem":86},"Scopes and instructions","\u002Fsearch\u002Fscopes-and-instructions","3.search\u002F5.scopes-and-instructions",{"title":88,"path":89,"stem":90},"Text search","\u002Fsearch\u002Ftext-search","3.search\u002F6.text-search",{"title":92,"path":93,"stem":94},"Search engines","\u002Fsearch\u002Fsearch-engines","3.search\u002F7.search-engines",{"title":96,"path":97,"stem":98},"Searching outside HTTP","\u002Fsearch\u002Foutside-http","3.search\u002F8.outside-http",{"title":100,"path":101,"stem":102},"Totals","\u002Fsearch\u002Ftotals","3.search\u002F9.totals",{"title":104,"icon":105,"path":106,"stem":107,"children":108,"page":31},"Writing","i-heroicons-pencil-square","\u002Fwriting","4.writing",[109,113,117,121],{"title":110,"path":111,"stem":112},"Mutate","\u002Fwriting\u002Fmutate","4.writing\u002F1.mutate",{"title":114,"path":115,"stem":116},"Writing relations","\u002Fwriting\u002Frelations","4.writing\u002F2.relations",{"title":118,"path":119,"stem":120},"Versioned rows","\u002Fwriting\u002Fversioned-rows","4.writing\u002F3.versioned-rows",{"title":122,"path":123,"stem":124},"Deleting and restoring","\u002Fwriting\u002Fdeleting","4.writing\u002F4.deleting",{"title":126,"icon":127,"path":128,"stem":129,"children":130,"page":31},"Actions and Metrics","i-heroicons-bolt","\u002Factions-and-metrics","5.actions-and-metrics",[131,135,139,143,147],{"title":132,"path":133,"stem":134},"Actions","\u002Factions-and-metrics\u002Factions","5.actions-and-metrics\u002F1.actions",{"title":136,"path":137,"stem":138},"Queued Actions","\u002Factions-and-metrics\u002Fqueued-actions","5.actions-and-metrics\u002F2.queued-actions",{"title":140,"path":141,"stem":142},"Confirmation","\u002Factions-and-metrics\u002Fconfirmation","5.actions-and-metrics\u002F3.confirmation",{"title":144,"path":145,"stem":146},"Metrics","\u002Factions-and-metrics\u002Fmetrics","5.actions-and-metrics\u002F4.metrics",{"title":148,"path":149,"stem":150},"Exports","\u002Factions-and-metrics\u002Fexports","5.actions-and-metrics\u002F5.exports",{"title":152,"icon":153,"path":154,"stem":155,"children":156,"page":31},"Authorization","i-heroicons-lock-closed","\u002Fauthorization","6.authorization",[157,161,165],{"title":158,"path":159,"stem":160},"Policies","\u002Fauthorization\u002Fpolicies","6.authorization\u002F1.policies",{"title":162,"path":163,"stem":164},"Gates","\u002Fauthorization\u002Fgates","6.authorization\u002F2.gates",{"title":166,"path":167,"stem":168},"Decision Cache","\u002Fauthorization\u002Fdecision-cache","6.authorization\u002F3.decision-cache",{"title":170,"icon":171,"path":172,"stem":173,"children":174,"page":31},"Digging Deeper","i-heroicons-list-bullet","\u002Fdigging-deeper","7.digging-deeper",[175,179,183,187,191,195,199,203],{"title":176,"path":177,"stem":178},"Details","\u002Fdigging-deeper\u002Fdetails","7.digging-deeper\u002F1.details",{"title":180,"path":181,"stem":182},"Events and Hooks","\u002Fdigging-deeper\u002Fevents-and-hooks","7.digging-deeper\u002F2.events-and-hooks",{"title":184,"path":185,"stem":186},"Custom Responses","\u002Fdigging-deeper\u002Fresponses","7.digging-deeper\u002F3.responses",{"title":188,"path":189,"stem":190},"OpenAPI Documentation","\u002Fdigging-deeper\u002Fopenapi","7.digging-deeper\u002F4.openapi",{"title":192,"path":193,"stem":194},"Precognition","\u002Fdigging-deeper\u002Fprecognition","7.digging-deeper\u002F5.precognition",{"title":196,"path":197,"stem":198},"Artisan Commands","\u002Fdigging-deeper\u002Fartisan","7.digging-deeper\u002F6.artisan",{"title":200,"path":201,"stem":202},"Use with AI","\u002Fdigging-deeper\u002Fai-skill","7.digging-deeper\u002F7.ai-skill",{"title":204,"path":205,"stem":206},"Translations","\u002Fdigging-deeper\u002Ftranslations","7.digging-deeper\u002F8.translations",{"title":208,"icon":209,"path":210,"stem":211,"children":212,"page":31},"Extensions","i-heroicons-puzzle-piece","\u002Fextensions","8.extensions",[213,216,220,224,228,232],{"title":208,"path":214,"stem":215},"\u002Fextensions\u002Foverview","8.extensions\u002F1.overview",{"title":217,"path":218,"stem":219},"Query extensions","\u002Fextensions\u002Fqueries","8.extensions\u002F2.queries",{"title":221,"path":222,"stem":223},"Engine extensions","\u002Fextensions\u002Fengines","8.extensions\u002F3.engines",{"title":225,"path":226,"stem":227},"Authorization extensions","\u002Fextensions\u002Fauthorization","8.extensions\u002F4.authorization",{"title":229,"path":230,"stem":231},"Route and write extensions","\u002Fextensions\u002Froutes-and-writes","8.extensions\u002F5.routes-and-writes",{"title":233,"path":234,"stem":235},"Response and check extensions","\u002Fextensions\u002Fresponses-and-checks","8.extensions\u002F6.responses-and-checks",[237,248,270,293,330],{"title":6,"icon":7,"path":238,"stem":239,"children":240,"page":31},"\u002F2.x\u002Fgetting-started","2.x\u002F1.getting-started",[241,244],{"title":16,"path":242,"stem":243},"\u002F2.x\u002Fgetting-started\u002Finstallation","2.x\u002F1.getting-started\u002F1.installation",{"title":245,"path":246,"stem":247},"Upgrade Guide","\u002F2.x\u002Fgetting-started\u002Fupgrade-guide","2.x\u002F1.getting-started\u002F2.upgrade-guide",{"title":249,"icon":250,"path":251,"stem":252,"children":253,"page":31},"Endpoints","i-heroicons-arrow-uturn-left","\u002F2.x\u002Fendpoints","2.x\u002F2.endpoints",[254,257,260,263,266],{"title":176,"path":255,"stem":256},"\u002F2.x\u002Fendpoints\u002Fdetails","2.x\u002F2.endpoints\u002F1.details",{"title":62,"path":258,"stem":259},"\u002F2.x\u002Fendpoints\u002Fsearch","2.x\u002F2.endpoints\u002F2.search",{"title":110,"path":261,"stem":262},"\u002F2.x\u002Fendpoints\u002Fmutate","2.x\u002F2.endpoints\u002F3.mutate",{"title":132,"path":264,"stem":265},"\u002F2.x\u002Fendpoints\u002Factions","2.x\u002F2.endpoints\u002F4.actions",{"title":267,"path":268,"stem":269},"Delete","\u002F2.x\u002Fendpoints\u002Fdelete","2.x\u002F2.endpoints\u002F5.delete",{"title":33,"icon":34,"path":271,"stem":272,"children":273,"page":31},"\u002F2.x\u002Fresources","2.x\u002F3.resources",[274,278,282,285,289],{"title":275,"path":276,"stem":277},"Basics","\u002F2.x\u002Fresources\u002Fbasics","2.x\u002F3.resources\u002F1.basics",{"title":279,"path":280,"stem":281},"Exposed Data","\u002F2.x\u002Fresources\u002Fexposed-data","2.x\u002F3.resources\u002F2.exposed-data",{"title":46,"path":283,"stem":284},"\u002F2.x\u002Fresources\u002Frelationships","2.x\u002F3.resources\u002F3.relationships",{"title":286,"path":287,"stem":288},"Validations","\u002F2.x\u002Fresources\u002Fvalidations","2.x\u002F3.resources\u002F4.validations",{"title":290,"path":291,"stem":292},"Interactions","\u002F2.x\u002Fresources\u002Finteractions","2.x\u002F3.resources\u002F5.interactions",{"title":170,"icon":171,"path":294,"stem":295,"children":296,"page":31},"\u002F2.x\u002Fdigging-deeper","2.x\u002F4.digging-deeper",[297,300,304,307,311,315,319,323,327],{"title":132,"path":298,"stem":299},"\u002F2.x\u002Fdigging-deeper\u002Factions","2.x\u002F4.digging-deeper\u002F1.actions",{"title":301,"path":302,"stem":303},"Hooks","\u002F2.x\u002Fdigging-deeper\u002Fhooks","2.x\u002F4.digging-deeper\u002F2.hooks",{"title":162,"path":305,"stem":306},"\u002F2.x\u002Fdigging-deeper\u002Fgates","2.x\u002F4.digging-deeper\u002F3.gates",{"title":308,"path":309,"stem":310},"Authorizations","\u002F2.x\u002Fdigging-deeper\u002Fauthorizations","2.x\u002F4.digging-deeper\u002F4.authorizations",{"title":312,"path":313,"stem":314},"Full Text Search","\u002F2.x\u002Fdigging-deeper\u002Ffull-text-search","2.x\u002F4.digging-deeper\u002F5.full-text-search",{"title":316,"path":317,"stem":318},"Instructions","\u002F2.x\u002Fdigging-deeper\u002Finstructions","2.x\u002F4.digging-deeper\u002F6.instructions",{"title":320,"path":321,"stem":322},"Responses","\u002F2.x\u002Fdigging-deeper\u002Fresponses","2.x\u002F4.digging-deeper\u002F7.responses",{"title":324,"path":325,"stem":326},"Documentation","\u002F2.x\u002Fdigging-deeper\u002Fdocumentation","2.x\u002F4.digging-deeper\u002F8.documentation",{"title":192,"path":328,"stem":329},"\u002F2.x\u002Fdigging-deeper\u002Fprecognition","2.x\u002F4.digging-deeper\u002F9.precognition",{"title":331,"icon":332,"path":333,"stem":334,"children":335,"page":31},"Integrations","i-lucide-puzzle","\u002F2.x\u002Fintegrations","2.x\u002F5.integrations",[336],{"title":337,"path":338,"stem":339},"Flutter","\u002F2.x\u002Fintegrations\u002Fflutter","2.x\u002F5.integrations\u002F1.flutter",{"id":341,"title":217,"body":342,"description":2449,"extension":2450,"links":2451,"meta":2452,"navigation":474,"path":218,"seo":2453,"sitemap":2454,"stem":219,"updatedAt":2455,"__hash__":2456},"docs3x\u002F8.extensions\u002F2.queries.md",{"type":343,"value":344,"toc":2436},"minimark",[345,362,367,373,801,843,848,872,928,932,942,950,962,966,981,990,1055,1114,1118,1124,1556,1614,1618,1668,1671,1703,1707,1713,1963,2044,2061,2065,2071,2310,2382,2419,2432],[346,347,348,349,353,354,357,358,361],"p",{},"Four kinds act on the SQL queries of the package, and ",[350,351,352],"code",{},"ProvidesPerimeter"," marks a restriction that is the perimeter. They throw ",[350,355,356],{},"Lomkit\\Rest\\Exceptions\\InvalidQueryExtensionException",", which names the extension by its name and its class. See ",[359,360,208],"a",{"href":214}," for registering an extension.",[363,364,366],"h2",{"id":365},"restricting-queries","Restricting queries",[346,368,369,372],{},[350,370,371],{},"RestrictsQueries::restrict(RestrictionContext $context)"," adds where clauses to the perimeter of a resource:",[374,375,381],"pre",{"className":376,"code":377,"filename":378,"language":379,"meta":380,"style":380},"language-php shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","use Lomkit\\Rest\\Extensions\\Contexts\\RestrictionContext;\nuse Lomkit\\Rest\\Extensions\\Extension;\nuse Lomkit\\Rest\\Extensions\\Kinds\\RestrictsQueries;\n\nfinal class TenantExtension extends Extension implements RestrictsQueries\n{\n    public function __construct(private readonly CurrentTenant $tenant) {}\n\n    #[\\Override]\n    public static function name(): string\n    {\n        return 'tenant';\n    }\n\n    #[\\Override]\n    public function restrict(RestrictionContext $context): void\n    {\n        if ($context->user === null) {\n            $context->query->whereRaw('0 = 1');\n\n            return;\n        }\n\n        $context->query->where($context->query->qualifyColumn('tenant_id'), $this->tenant->id());\n    }\n}\n","Vendor\u002FTenancy\u002FTenantExtension.php","php","",[350,382,383,420,442,469,476,502,508,545,550,561,580,586,604,610,615,624,649,654,680,710,715,723,729,734,790,795],{"__ignoreMap":380},[384,385,388,392,396,400,403,405,407,409,412,414,417],"span",{"class":386,"line":387},"line",1,[384,389,391],{"class":390},"sbssI","use",[384,393,395],{"class":394},"sTEyZ"," Lomkit",[384,397,399],{"class":398},"sMK4o","\\",[384,401,402],{"class":394},"Rest",[384,404,399],{"class":398},[384,406,208],{"class":394},[384,408,399],{"class":398},[384,410,411],{"class":394},"Contexts",[384,413,399],{"class":398},[384,415,416],{"class":394},"RestrictionContext",[384,418,419],{"class":398},";\n",[384,421,423,425,427,429,431,433,435,437,440],{"class":386,"line":422},2,[384,424,391],{"class":390},[384,426,395],{"class":394},[384,428,399],{"class":398},[384,430,402],{"class":394},[384,432,399],{"class":398},[384,434,208],{"class":394},[384,436,399],{"class":398},[384,438,439],{"class":394},"Extension",[384,441,419],{"class":398},[384,443,445,447,449,451,453,455,457,459,462,464,467],{"class":386,"line":444},3,[384,446,391],{"class":390},[384,448,395],{"class":394},[384,450,399],{"class":398},[384,452,402],{"class":394},[384,454,399],{"class":398},[384,456,208],{"class":394},[384,458,399],{"class":398},[384,460,461],{"class":394},"Kinds",[384,463,399],{"class":398},[384,465,466],{"class":394},"RestrictsQueries",[384,468,419],{"class":398},[384,470,472],{"class":386,"line":471},4,[384,473,475],{"emptyLinePlaceholder":474},true,"\n",[384,477,479,483,486,490,493,496,499],{"class":386,"line":478},5,[384,480,482],{"class":481},"spNyl","final",[384,484,485],{"class":481}," class",[384,487,489],{"class":488},"sBMFI"," TenantExtension",[384,491,492],{"class":481}," extends",[384,494,495],{"class":488}," Extension",[384,497,498],{"class":481}," implements",[384,500,501],{"class":488}," RestrictsQueries\n",[384,503,505],{"class":386,"line":504},6,[384,506,507],{"class":398},"{\n",[384,509,511,514,517,521,524,527,530,533,536,539,542],{"class":386,"line":510},7,[384,512,513],{"class":481},"    public",[384,515,516],{"class":481}," function",[384,518,520],{"class":519},"s2Zo4"," __construct",[384,522,523],{"class":398},"(",[384,525,526],{"class":481},"private",[384,528,529],{"class":481}," readonly",[384,531,532],{"class":488}," CurrentTenant",[384,534,535],{"class":398}," $",[384,537,538],{"class":394},"tenant",[384,540,541],{"class":398},")",[384,543,544],{"class":398}," {}\n",[384,546,548],{"class":386,"line":547},8,[384,549,475],{"emptyLinePlaceholder":474},[384,551,553,556,558],{"class":386,"line":552},9,[384,554,555],{"class":394},"    #[",[384,557,399],{"class":398},[384,559,560],{"class":394},"Override]\n",[384,562,564,566,569,571,574,577],{"class":386,"line":563},10,[384,565,513],{"class":481},[384,567,568],{"class":481}," static",[384,570,516],{"class":481},[384,572,573],{"class":519}," name",[384,575,576],{"class":398},"():",[384,578,579],{"class":390}," string\n",[384,581,583],{"class":386,"line":582},11,[384,584,585],{"class":398},"    {\n",[384,587,589,593,596,599,602],{"class":386,"line":588},12,[384,590,592],{"class":591},"s7zQu","        return",[384,594,595],{"class":398}," '",[384,597,538],{"class":598},"sfazB",[384,600,601],{"class":398},"'",[384,603,419],{"class":398},[384,605,607],{"class":386,"line":606},13,[384,608,609],{"class":398},"    }\n",[384,611,613],{"class":386,"line":612},14,[384,614,475],{"emptyLinePlaceholder":474},[384,616,618,620,622],{"class":386,"line":617},15,[384,619,555],{"class":394},[384,621,399],{"class":398},[384,623,560],{"class":394},[384,625,627,629,631,634,636,638,640,643,646],{"class":386,"line":626},16,[384,628,513],{"class":481},[384,630,516],{"class":481},[384,632,633],{"class":519}," restrict",[384,635,523],{"class":398},[384,637,416],{"class":488},[384,639,535],{"class":398},[384,641,642],{"class":394},"context",[384,644,645],{"class":398},"):",[384,647,648],{"class":390}," void\n",[384,650,652],{"class":386,"line":651},17,[384,653,585],{"class":398},[384,655,657,660,663,665,668,671,674,677],{"class":386,"line":656},18,[384,658,659],{"class":591},"        if",[384,661,662],{"class":398}," ($",[384,664,642],{"class":394},[384,666,667],{"class":398},"->",[384,669,670],{"class":394},"user ",[384,672,673],{"class":398},"===",[384,675,676],{"class":398}," null)",[384,678,679],{"class":398}," {\n",[384,681,683,686,688,690,693,695,698,700,702,705,707],{"class":386,"line":682},19,[384,684,685],{"class":398},"            $",[384,687,642],{"class":394},[384,689,667],{"class":398},[384,691,692],{"class":394},"query",[384,694,667],{"class":398},[384,696,697],{"class":519},"whereRaw",[384,699,523],{"class":398},[384,701,601],{"class":398},[384,703,704],{"class":598},"0 = 1",[384,706,601],{"class":398},[384,708,709],{"class":398},");\n",[384,711,713],{"class":386,"line":712},20,[384,714,475],{"emptyLinePlaceholder":474},[384,716,718,721],{"class":386,"line":717},21,[384,719,720],{"class":591},"            return",[384,722,419],{"class":398},[384,724,726],{"class":386,"line":725},22,[384,727,728],{"class":398},"        }\n",[384,730,732],{"class":386,"line":731},23,[384,733,475],{"emptyLinePlaceholder":474},[384,735,737,740,742,744,746,748,751,754,756,758,760,762,765,767,769,772,774,777,780,782,784,787],{"class":386,"line":736},24,[384,738,739],{"class":398},"        $",[384,741,642],{"class":394},[384,743,667],{"class":398},[384,745,692],{"class":394},[384,747,667],{"class":398},[384,749,750],{"class":519},"where",[384,752,753],{"class":398},"($",[384,755,642],{"class":394},[384,757,667],{"class":398},[384,759,692],{"class":394},[384,761,667],{"class":398},[384,763,764],{"class":519},"qualifyColumn",[384,766,523],{"class":398},[384,768,601],{"class":398},[384,770,771],{"class":598},"tenant_id",[384,773,601],{"class":398},[384,775,776],{"class":398},"),",[384,778,779],{"class":398}," $this->",[384,781,538],{"class":394},[384,783,667],{"class":398},[384,785,786],{"class":519},"id",[384,788,789],{"class":398},"());\n",[384,791,793],{"class":386,"line":792},25,[384,794,609],{"class":398},[384,796,798],{"class":386,"line":797},26,[384,799,800],{"class":398},"}\n",[802,803,804,819,833,840],"ul",{},[805,806,807,810,811,814,815,818],"li",{},[350,808,809],{},"$context->query"," is the Eloquent builder of the extension's own where group. The group comes after ",[350,812,813],{},"perimeterQuery()",", inside its own parentheses, and is AND-ed with the perimeter and the other extensions: an ",[350,816,817],{},"orWhere()"," in it cannot widen the rows.",[805,820,821,824,825,828,829,832],{},[350,822,823],{},"$context->resource"," is the restricted resource: the related one on an include, a relation filter, sort or aggregate. ",[350,826,827],{},"$context->user"," is the user of the request, ",[350,830,831],{},"null"," for a guest: decide the rows of a guest yourself.",[805,834,835,836,839],{},"Qualify columns with ",[350,837,838],{},"$context->query->qualifyColumn()",": pivot reads join another table.",[805,841,842],{},"A restriction may run several times in one request, and again on each attempt of a write transaction: keep it free of side effects.",[844,845,847],"h3",{"id":846},"where-it-applies","Where it applies",[346,849,850,851,854,855,854,858,854,861,864,865,868,869,871],{},"A restriction applies wherever the perimeter does: searches and includes, through a pivot too, relation filters, sorts and aggregates, metrics and the key of their cache in both scopes, the key lookups of ",[350,852,853],{},"mutate",", ",[350,856,857],{},"destroy",[350,859,860],{},"restore",[350,862,863],{},"forceDestroy"," and actions, the rows of queued actions, child syncs, attached pivot rows, the records read again after a write and the write gates of rendered rows. It also applies to ",[350,866,867],{},"#[WithoutPerimeter]"," resources. See ",[359,870,54],{"href":55},".",[802,873,874,877,894,916],{},[805,875,876],{},"The key of a cached metric holds the SQL and the bindings of each restricted perimeter, with the user, so a restriction that reads a tenant or a flag never shares a result. Without a restriction, the key does not change.",[805,878,879,880,883,884,887,888,890,891,871],{},"Every relation path reads the perimeter through the final ",[350,881,882],{},"Relation::constrainToPerimeter()",". It opens one where group, runs ",[350,885,886],{},"applyPerimeter()"," inside it, then adds the restrictions after it: an override of ",[350,889,886],{}," cannot skip a restriction. A custom relation picks the restricted resource with the protected ",[350,892,893],{},"perimeterResource(Model $model)",[805,895,896,897,903,904,907,908,911,912,915],{},"On a search engine, the rows of a page load by key without the restriction: the engine is the proof. Restrict the engine query with ",[359,898,900],{"href":899},"\u002Fextensions\u002Fengines#restricting-engine-searches",[350,901,902],{},"RestrictsEngineQueries",", or a text search of the resource throws ",[350,905,906],{},"InvalidTextSearchException"," on an engine that does not run SQL. On the Scout ",[350,909,910],{},"database"," and ",[350,913,914],{},"collection"," drivers, the restriction applies in the SQL of the engine query.",[805,917,918,919,921,922,871],{},"A tenant that does not come from ",[350,920,827],{},", such as a subdomain or a header, is not in the keys of kept decisions: add it with ",[359,923,925],{"href":924},"\u002Fextensions\u002Fauthorization#adding-to-the-cache-context",[350,926,927],{},"ContributesCacheContext",[844,929,931],{"id":930},"what-it-refuses","What it refuses",[346,933,934,935,854,938,941],{},"Only where clauses. A join, order, limit, offset, select, distinct, lock, group, having, union, eager load, other table, before-query or after-query callback, added global scope or removed global scope (",[350,936,937],{},"withTrashed()",[350,939,940],{},"withoutGlobalScope()",") throws:",[374,943,948],{"className":944,"code":946,"language":947},[945],"language-text","The [tenant] extension Vendor\\Tenancy\\TenantExtension adds a join to the restriction of App\\Rest\\Resources\\PostResource, which holds only where clauses. Restrict through another table with whereHas() or whereExists().\n","text",[350,949,946],{"__ignoreMap":380},[802,951,952,955],{},[805,953,954],{},"The check reads the nested where groups too, at every depth.",[805,956,957,958,961],{},"Laravel drops a global scope or an ",[350,959,960],{},"afterQuery()"," callback added to the Eloquent builder of a nested group before the check runs: neither is applied. Write where clauses only.",[363,963,965],{"id":964},"providing-the-perimeter","Providing the perimeter",[346,967,968,971,972,974,975,977,978,980],{},[350,969,970],{},"rest:check"," reports a resource without ",[350,973,813],{}," or ",[350,976,867],{}," even when a ",[350,979,466],{}," extension restricts it: a tenant extension narrows a perimeter declared elsewhere, it does not stand for it.",[346,982,983,984,986,987,989],{},"An extension whose restriction is the perimeter, such as an access-control extension that decides the rows of each user, implements ",[350,985,352],{},", which extends ",[350,988,466],{}," and adds no method:",[374,991,993],{"className":376,"code":992,"language":379,"meta":380,"style":380},"use Lomkit\\Rest\\Extensions\\Kinds\\ProvidesPerimeter;\n\nfinal class AccessControlExtension extends Extension implements ProvidesPerimeter\n{\n    \u002F\u002F name() and restrict(), as above\n}\n",[350,994,995,1019,1023,1041,1045,1051],{"__ignoreMap":380},[384,996,997,999,1001,1003,1005,1007,1009,1011,1013,1015,1017],{"class":386,"line":387},[384,998,391],{"class":390},[384,1000,395],{"class":394},[384,1002,399],{"class":398},[384,1004,402],{"class":394},[384,1006,399],{"class":398},[384,1008,208],{"class":394},[384,1010,399],{"class":398},[384,1012,461],{"class":394},[384,1014,399],{"class":398},[384,1016,352],{"class":394},[384,1018,419],{"class":398},[384,1020,1021],{"class":386,"line":422},[384,1022,475],{"emptyLinePlaceholder":474},[384,1024,1025,1027,1029,1032,1034,1036,1038],{"class":386,"line":444},[384,1026,482],{"class":481},[384,1028,485],{"class":481},[384,1030,1031],{"class":488}," AccessControlExtension",[384,1033,492],{"class":481},[384,1035,495],{"class":488},[384,1037,498],{"class":481},[384,1039,1040],{"class":488}," ProvidesPerimeter\n",[384,1042,1043],{"class":386,"line":471},[384,1044,507],{"class":398},[384,1046,1047],{"class":386,"line":478},[384,1048,1050],{"class":1049},"sHwdD","    \u002F\u002F name() and restrict(), as above\n",[384,1052,1053],{"class":386,"line":504},[384,1054,800],{"class":398},[802,1056,1057,1086,1089,1098],{},[805,1058,1059,1061,1062,1065,1066,1069,1070,1073,1074,1077,1078,1081,1082,871],{},[350,1060,970],{}," then accepts the resources that the extension applies to, with a ",[350,1063,1064],{},"perimeter from acl"," line and an entry of ",[350,1067,1068],{},"rows.extension_perimeter"," in ",[350,1071,1072],{},"--json",". Plain restrictions show as ",[350,1075,1076],{},"restricted by tenant"," lines and in ",[350,1079,1080],{},"rows.restricted",". See ",[359,1083,1085],{"href":1084},"\u002Fdigging-deeper\u002Fartisan#checking-the-application","Checking the application",[805,1087,1088],{},"It changes nothing at runtime.",[805,1090,1091,1093,1094,1097],{},[350,1092,970],{}," reads the config of the environment it runs in: where the extension is disabled, or its ",[350,1095,1096],{},"appliesTo()"," leaves a resource out, the problem comes back. Run it with the extensions of production.",[805,1099,1100,1101,1103,1104,1106,1107,1110,1111,1113],{},"A ",[350,1102,466],{}," extension whose ",[350,1105,1096],{}," throws for a resource is a ",[350,1108,1109],{},"rows"," problem of ",[350,1112,970],{}," that names it. The extensions that answer are still named for that resource, and the other resources are still checked.",[363,1115,1117],{"id":1116},"adding-to-rendered-rows","Adding to rendered rows",[346,1119,1120,1123],{},[350,1121,1122],{},"AugmentsQueries::augment(AugmentationContext $context)"," loads what the policies and gates of the rendered rows read, in the same query:",[374,1125,1128],{"className":376,"code":1126,"filename":1127,"language":379,"meta":380,"style":380},"use Lomkit\\Rest\\Extensions\\Contexts\\AugmentationContext;\nuse Lomkit\\Rest\\Extensions\\Extension;\nuse Lomkit\\Rest\\Extensions\\Kinds\\AugmentsQueries;\n\nfinal class LockColumnsExtension extends Extension implements AugmentsQueries\n{\n    #[\\Override]\n    public static function name(): string\n    {\n        return 'locks';\n    }\n\n    #[\\Override]\n    public function appliesTo(string $resource): bool\n    {\n        return is_a($resource, PostResource::class, true);\n    }\n\n    #[\\Override]\n    public function augment(AugmentationContext $context): void\n    {\n        if (! in_array('update', $context->gates, true)) {\n            return;\n        }\n\n        $context->column('owner_id');\n        $context->select('locked', Lock::query()->selectRaw('count(*) > 0')->whereColumn('locks.post_id', 'posts.id'));\n        $context->with('approvals');\n    }\n}\n","Vendor\u002FLocks\u002FLockColumnsExtension.php",[350,1129,1130,1155,1175,1200,1204,1222,1226,1234,1248,1252,1265,1269,1273,1281,1305,1309,1337,1341,1345,1353,1374,1378,1415,1421,1425,1429,1451,1523,1546,1551],{"__ignoreMap":380},[384,1131,1132,1134,1136,1138,1140,1142,1144,1146,1148,1150,1153],{"class":386,"line":387},[384,1133,391],{"class":390},[384,1135,395],{"class":394},[384,1137,399],{"class":398},[384,1139,402],{"class":394},[384,1141,399],{"class":398},[384,1143,208],{"class":394},[384,1145,399],{"class":398},[384,1147,411],{"class":394},[384,1149,399],{"class":398},[384,1151,1152],{"class":394},"AugmentationContext",[384,1154,419],{"class":398},[384,1156,1157,1159,1161,1163,1165,1167,1169,1171,1173],{"class":386,"line":422},[384,1158,391],{"class":390},[384,1160,395],{"class":394},[384,1162,399],{"class":398},[384,1164,402],{"class":394},[384,1166,399],{"class":398},[384,1168,208],{"class":394},[384,1170,399],{"class":398},[384,1172,439],{"class":394},[384,1174,419],{"class":398},[384,1176,1177,1179,1181,1183,1185,1187,1189,1191,1193,1195,1198],{"class":386,"line":444},[384,1178,391],{"class":390},[384,1180,395],{"class":394},[384,1182,399],{"class":398},[384,1184,402],{"class":394},[384,1186,399],{"class":398},[384,1188,208],{"class":394},[384,1190,399],{"class":398},[384,1192,461],{"class":394},[384,1194,399],{"class":398},[384,1196,1197],{"class":394},"AugmentsQueries",[384,1199,419],{"class":398},[384,1201,1202],{"class":386,"line":471},[384,1203,475],{"emptyLinePlaceholder":474},[384,1205,1206,1208,1210,1213,1215,1217,1219],{"class":386,"line":478},[384,1207,482],{"class":481},[384,1209,485],{"class":481},[384,1211,1212],{"class":488}," LockColumnsExtension",[384,1214,492],{"class":481},[384,1216,495],{"class":488},[384,1218,498],{"class":481},[384,1220,1221],{"class":488}," AugmentsQueries\n",[384,1223,1224],{"class":386,"line":504},[384,1225,507],{"class":398},[384,1227,1228,1230,1232],{"class":386,"line":510},[384,1229,555],{"class":394},[384,1231,399],{"class":398},[384,1233,560],{"class":394},[384,1235,1236,1238,1240,1242,1244,1246],{"class":386,"line":547},[384,1237,513],{"class":481},[384,1239,568],{"class":481},[384,1241,516],{"class":481},[384,1243,573],{"class":519},[384,1245,576],{"class":398},[384,1247,579],{"class":390},[384,1249,1250],{"class":386,"line":552},[384,1251,585],{"class":398},[384,1253,1254,1256,1258,1261,1263],{"class":386,"line":563},[384,1255,592],{"class":591},[384,1257,595],{"class":398},[384,1259,1260],{"class":598},"locks",[384,1262,601],{"class":398},[384,1264,419],{"class":398},[384,1266,1267],{"class":386,"line":582},[384,1268,609],{"class":398},[384,1270,1271],{"class":386,"line":588},[384,1272,475],{"emptyLinePlaceholder":474},[384,1274,1275,1277,1279],{"class":386,"line":606},[384,1276,555],{"class":394},[384,1278,399],{"class":398},[384,1280,560],{"class":394},[384,1282,1283,1285,1287,1290,1292,1295,1297,1300,1302],{"class":386,"line":612},[384,1284,513],{"class":481},[384,1286,516],{"class":481},[384,1288,1289],{"class":519}," appliesTo",[384,1291,523],{"class":398},[384,1293,1294],{"class":390},"string",[384,1296,535],{"class":398},[384,1298,1299],{"class":394},"resource",[384,1301,645],{"class":398},[384,1303,1304],{"class":390}," bool\n",[384,1306,1307],{"class":386,"line":617},[384,1308,585],{"class":398},[384,1310,1311,1313,1316,1318,1320,1323,1326,1329,1332,1334],{"class":386,"line":626},[384,1312,592],{"class":591},[384,1314,1315],{"class":519}," is_a",[384,1317,753],{"class":398},[384,1319,1299],{"class":394},[384,1321,1322],{"class":398},",",[384,1324,1325],{"class":488}," PostResource",[384,1327,1328],{"class":398},"::",[384,1330,1331],{"class":390},"class",[384,1333,1322],{"class":398},[384,1335,1336],{"class":398}," true);\n",[384,1338,1339],{"class":386,"line":651},[384,1340,609],{"class":398},[384,1342,1343],{"class":386,"line":656},[384,1344,475],{"emptyLinePlaceholder":474},[384,1346,1347,1349,1351],{"class":386,"line":682},[384,1348,555],{"class":394},[384,1350,399],{"class":398},[384,1352,560],{"class":394},[384,1354,1355,1357,1359,1362,1364,1366,1368,1370,1372],{"class":386,"line":712},[384,1356,513],{"class":481},[384,1358,516],{"class":481},[384,1360,1361],{"class":519}," augment",[384,1363,523],{"class":398},[384,1365,1152],{"class":488},[384,1367,535],{"class":398},[384,1369,642],{"class":394},[384,1371,645],{"class":398},[384,1373,648],{"class":390},[384,1375,1376],{"class":386,"line":717},[384,1377,585],{"class":398},[384,1379,1380,1382,1385,1388,1390,1392,1395,1397,1399,1401,1403,1405,1408,1410,1413],{"class":386,"line":725},[384,1381,659],{"class":591},[384,1383,1384],{"class":398}," (!",[384,1386,1387],{"class":519}," in_array",[384,1389,523],{"class":398},[384,1391,601],{"class":398},[384,1393,1394],{"class":598},"update",[384,1396,601],{"class":398},[384,1398,1322],{"class":398},[384,1400,535],{"class":398},[384,1402,642],{"class":394},[384,1404,667],{"class":398},[384,1406,1407],{"class":394},"gates",[384,1409,1322],{"class":398},[384,1411,1412],{"class":398}," true))",[384,1414,679],{"class":398},[384,1416,1417,1419],{"class":386,"line":731},[384,1418,720],{"class":591},[384,1420,419],{"class":398},[384,1422,1423],{"class":386,"line":736},[384,1424,728],{"class":398},[384,1426,1427],{"class":386,"line":792},[384,1428,475],{"emptyLinePlaceholder":474},[384,1430,1431,1433,1435,1437,1440,1442,1444,1447,1449],{"class":386,"line":797},[384,1432,739],{"class":398},[384,1434,642],{"class":394},[384,1436,667],{"class":398},[384,1438,1439],{"class":519},"column",[384,1441,523],{"class":398},[384,1443,601],{"class":398},[384,1445,1446],{"class":598},"owner_id",[384,1448,601],{"class":398},[384,1450,709],{"class":398},[384,1452,1454,1456,1458,1460,1463,1465,1467,1470,1472,1474,1477,1479,1481,1484,1487,1489,1491,1494,1496,1499,1502,1504,1506,1509,1511,1513,1515,1518,1520],{"class":386,"line":1453},27,[384,1455,739],{"class":398},[384,1457,642],{"class":394},[384,1459,667],{"class":398},[384,1461,1462],{"class":519},"select",[384,1464,523],{"class":398},[384,1466,601],{"class":398},[384,1468,1469],{"class":598},"locked",[384,1471,601],{"class":398},[384,1473,1322],{"class":398},[384,1475,1476],{"class":488}," Lock",[384,1478,1328],{"class":398},[384,1480,692],{"class":519},[384,1482,1483],{"class":398},"()->",[384,1485,1486],{"class":519},"selectRaw",[384,1488,523],{"class":398},[384,1490,601],{"class":398},[384,1492,1493],{"class":598},"count(*) > 0",[384,1495,601],{"class":398},[384,1497,1498],{"class":398},")->",[384,1500,1501],{"class":519},"whereColumn",[384,1503,523],{"class":398},[384,1505,601],{"class":398},[384,1507,1508],{"class":598},"locks.post_id",[384,1510,601],{"class":398},[384,1512,1322],{"class":398},[384,1514,595],{"class":398},[384,1516,1517],{"class":598},"posts.id",[384,1519,601],{"class":398},[384,1521,1522],{"class":398},"));\n",[384,1524,1526,1528,1530,1532,1535,1537,1539,1542,1544],{"class":386,"line":1525},28,[384,1527,739],{"class":398},[384,1529,642],{"class":394},[384,1531,667],{"class":398},[384,1533,1534],{"class":519},"with",[384,1536,523],{"class":398},[384,1538,601],{"class":398},[384,1540,1541],{"class":598},"approvals",[384,1543,601],{"class":398},[384,1545,709],{"class":398},[384,1547,1549],{"class":386,"line":1548},29,[384,1550,609],{"class":398},[384,1552,1554],{"class":386,"line":1553},30,[384,1555,800],{"class":398},[802,1557,1558,1564,1582,1599],{},[805,1559,1560,1563],{},[350,1561,1562],{},"column()"," adds a column of the model table, as is.",[805,1565,1566,1569,1570,1573,1574,1577,1578,1581],{},[350,1567,1568],{},"select()"," adds a subquery and returns its alias, ",[350,1571,1572],{},"{name}__{alias}",": here ",[350,1575,1576],{},"locks__locked",", the attribute that the policy reads. It takes a query builder, an Eloquent builder or a closure that builds the subquery on a fresh query builder, as ",[350,1579,1580],{},"addSelect()"," does.",[805,1583,1584,1587,1588,1591,1592,1595,1596,1598],{},[350,1585,1586],{},"with()"," eager loads a relation path of public relation methods declared with a ",[350,1589,1590],{},"Relation"," return type, never past a ",[350,1593,1594],{},"MorphTo",". It takes an optional constraint closure, as Laravel's ",[350,1597,1586],{},", which runs when the relation loads and cannot call the context.",[805,1600,1601,1604,1605,1608,1609,911,1611,1613],{},[350,1602,1603],{},"$context->gates"," lists the row gates rendered for these rows, ",[350,1606,1607],{},"[]"," on an include level that the client did not search. ",[350,1610,823],{},[350,1612,827],{}," are the resource of the level and the user of the request.",[844,1615,1617],{"id":1616},"guarantees","Guarantees",[802,1619,1620,1627,1633,1636,1653],{},[805,1621,1622,1623,1626],{},"It runs on the rows that a response renders only, at every include level: a search page, the rows of ",[350,1624,1625],{},"Rest::search()",", the records read after a write and the rows of a search engine page. Never on a count, an action, a metric, an aggregate or a key lookup.",[805,1628,1629,1632],{},[350,1630,1631],{},"fields()"," alone decides what renders: added columns, subqueries and eager loads never render.",[805,1634,1635],{},"An eager load on a relation that the client includes at that level under its own name is skipped: the policies read the relation as the client filtered and limited it. An include under an alias does not skip it.",[805,1637,1638,1639,911,1642,1645,1646,1648,1649,1652],{},"The default ",[350,1640,1641],{},"paginate()",[350,1643,1644],{},"PageQuery"," count without the augmentation. A ",[350,1647,1641],{}," override that counts with ",[350,1650,1651],{},"$query->paginate()"," counts the added columns.",[805,1654,1655,1656,1659,1660,1663,1664,1667],{},"On a query that groups rows, such as a scope with ",[350,1657,1658],{},"groupBy()",", add only a column that the ",[350,1661,1662],{},"GROUP BY"," holds or that depends on its key, or PostgreSQL and MySQL with ",[350,1665,1666],{},"ONLY_FULL_GROUP_BY"," refuse the query.",[844,1669,931],{"id":1670},"what-it-refuses-1",[802,1672,1673,1683,1689],{},[805,1674,1675,1676,911,1679,1682],{},"An alias that is not 1 to 32 lowercase letters or digits starting with a letter, with words joined by single underscores (",[350,1677,1678],{},"a__b",[350,1680,1681],{},"a_"," are refused), longer than 63 characters with its prefix, selected twice or equal to a field name.",[805,1684,1685,1686,1688],{},"A column that is not a column name of the model, a relation path that is not public relation methods, that goes past a ",[350,1687,1594],{},", or that two extensions load.",[805,1690,1691,1692,854,1694,974,1696,1698,1699,1702],{},"A call to ",[350,1693,1562],{},[350,1695,1568],{},[350,1697,1586],{}," after ",[350,1700,1701],{},"augment()"," returned.",[363,1704,1706],{"id":1705},"narrowing-limits","Narrowing limits",[346,1708,1709,1712],{},[350,1710,1711],{},"NarrowsLimits::narrowLimits(LimitsContext $context)"," narrows the page sizes, the total cap and the include limit of a resource for the user:",[374,1714,1717],{"className":376,"code":1715,"filename":1716,"language":379,"meta":380,"style":380},"use Lomkit\\Rest\\Extensions\\Contexts\\LimitsContext;\nuse Lomkit\\Rest\\Extensions\\Extension;\nuse Lomkit\\Rest\\Extensions\\Kinds\\NarrowsLimits;\n\nfinal class PlanLimitsExtension extends Extension implements NarrowsLimits\n{\n    #[\\Override]\n    public static function name(): string\n    {\n        return 'plan_limits';\n    }\n\n    #[\\Override]\n    public function narrowLimits(LimitsContext $context): void\n    {\n        $context->allowSizes([10, 25]);\n        $context->maxTotal(1000);\n        $context->includeLimit(10);\n    }\n}\n","Vendor\u002FPlans\u002FPlanLimitsExtension.php",[350,1718,1719,1744,1764,1789,1793,1811,1815,1823,1837,1841,1854,1858,1862,1870,1891,1895,1920,1938,1955,1959],{"__ignoreMap":380},[384,1720,1721,1723,1725,1727,1729,1731,1733,1735,1737,1739,1742],{"class":386,"line":387},[384,1722,391],{"class":390},[384,1724,395],{"class":394},[384,1726,399],{"class":398},[384,1728,402],{"class":394},[384,1730,399],{"class":398},[384,1732,208],{"class":394},[384,1734,399],{"class":398},[384,1736,411],{"class":394},[384,1738,399],{"class":398},[384,1740,1741],{"class":394},"LimitsContext",[384,1743,419],{"class":398},[384,1745,1746,1748,1750,1752,1754,1756,1758,1760,1762],{"class":386,"line":422},[384,1747,391],{"class":390},[384,1749,395],{"class":394},[384,1751,399],{"class":398},[384,1753,402],{"class":394},[384,1755,399],{"class":398},[384,1757,208],{"class":394},[384,1759,399],{"class":398},[384,1761,439],{"class":394},[384,1763,419],{"class":398},[384,1765,1766,1768,1770,1772,1774,1776,1778,1780,1782,1784,1787],{"class":386,"line":444},[384,1767,391],{"class":390},[384,1769,395],{"class":394},[384,1771,399],{"class":398},[384,1773,402],{"class":394},[384,1775,399],{"class":398},[384,1777,208],{"class":394},[384,1779,399],{"class":398},[384,1781,461],{"class":394},[384,1783,399],{"class":398},[384,1785,1786],{"class":394},"NarrowsLimits",[384,1788,419],{"class":398},[384,1790,1791],{"class":386,"line":471},[384,1792,475],{"emptyLinePlaceholder":474},[384,1794,1795,1797,1799,1802,1804,1806,1808],{"class":386,"line":478},[384,1796,482],{"class":481},[384,1798,485],{"class":481},[384,1800,1801],{"class":488}," PlanLimitsExtension",[384,1803,492],{"class":481},[384,1805,495],{"class":488},[384,1807,498],{"class":481},[384,1809,1810],{"class":488}," NarrowsLimits\n",[384,1812,1813],{"class":386,"line":504},[384,1814,507],{"class":398},[384,1816,1817,1819,1821],{"class":386,"line":510},[384,1818,555],{"class":394},[384,1820,399],{"class":398},[384,1822,560],{"class":394},[384,1824,1825,1827,1829,1831,1833,1835],{"class":386,"line":547},[384,1826,513],{"class":481},[384,1828,568],{"class":481},[384,1830,516],{"class":481},[384,1832,573],{"class":519},[384,1834,576],{"class":398},[384,1836,579],{"class":390},[384,1838,1839],{"class":386,"line":552},[384,1840,585],{"class":398},[384,1842,1843,1845,1847,1850,1852],{"class":386,"line":563},[384,1844,592],{"class":591},[384,1846,595],{"class":398},[384,1848,1849],{"class":598},"plan_limits",[384,1851,601],{"class":398},[384,1853,419],{"class":398},[384,1855,1856],{"class":386,"line":582},[384,1857,609],{"class":398},[384,1859,1860],{"class":386,"line":588},[384,1861,475],{"emptyLinePlaceholder":474},[384,1863,1864,1866,1868],{"class":386,"line":606},[384,1865,555],{"class":394},[384,1867,399],{"class":398},[384,1869,560],{"class":394},[384,1871,1872,1874,1876,1879,1881,1883,1885,1887,1889],{"class":386,"line":612},[384,1873,513],{"class":481},[384,1875,516],{"class":481},[384,1877,1878],{"class":519}," narrowLimits",[384,1880,523],{"class":398},[384,1882,1741],{"class":488},[384,1884,535],{"class":398},[384,1886,642],{"class":394},[384,1888,645],{"class":398},[384,1890,648],{"class":390},[384,1892,1893],{"class":386,"line":617},[384,1894,585],{"class":398},[384,1896,1897,1899,1901,1903,1906,1909,1912,1914,1917],{"class":386,"line":626},[384,1898,739],{"class":398},[384,1900,642],{"class":394},[384,1902,667],{"class":398},[384,1904,1905],{"class":519},"allowSizes",[384,1907,1908],{"class":398},"([",[384,1910,1911],{"class":390},"10",[384,1913,1322],{"class":398},[384,1915,1916],{"class":390}," 25",[384,1918,1919],{"class":398},"]);\n",[384,1921,1922,1924,1926,1928,1931,1933,1936],{"class":386,"line":651},[384,1923,739],{"class":398},[384,1925,642],{"class":394},[384,1927,667],{"class":398},[384,1929,1930],{"class":519},"maxTotal",[384,1932,523],{"class":398},[384,1934,1935],{"class":390},"1000",[384,1937,709],{"class":398},[384,1939,1940,1942,1944,1946,1949,1951,1953],{"class":386,"line":656},[384,1941,739],{"class":398},[384,1943,642],{"class":394},[384,1945,667],{"class":398},[384,1947,1948],{"class":519},"includeLimit",[384,1950,523],{"class":398},[384,1952,1911],{"class":390},[384,1954,709],{"class":398},[384,1956,1957],{"class":386,"line":682},[384,1958,609],{"class":398},[384,1960,1961],{"class":386,"line":712},[384,1962,800],{"class":398},[802,1964,1965,1989,1996,2005,2025,2035],{},[805,1966,1967,1968,1971,1972,1975,1976,911,1979,1982,1983,911,1985,1988],{},"Never upward, in any extension order. ",[350,1969,1970],{},"allowSizes()"," intersects the sizes of ",[350,1973,1974],{},"limits()",". ",[350,1977,1978],{},"maxSize()",[350,1980,1981],{},"maxTotal()"," drop the larger sizes. ",[350,1984,1981],{},[350,1986,1987],{},"includeLimit()"," take the minimum with the resource.",[805,1990,1991,1992,1995],{},"The default page size becomes the largest size left at or below ",[350,1993,1994],{},"$defaultLimit",", and the include limit the largest size left at or below the smaller include limit.",[805,1997,1998,1999,2002,2003,871],{},"Validation, paging, includes and ",[350,2000,2001],{},"\u002Fdetails"," use the limits of the current user, ",[350,2004,827],{},[805,2006,2007,2010,2011,854,2014,854,2017,911,2019,1975,2021,2024],{},[350,2008,2009],{},"$context->declared"," holds the limits that the resource declares, before any extension: ",[350,2012,2013],{},"allowed",[350,2015,2016],{},"defaultLimit",[350,2018,1948],{},[350,2020,1930],{},[350,2022,2023],{},"ResourceDefinition::declaredLimits()"," returns them too.",[805,2026,2027,2028,1975,2031,2034],{},"The OpenAPI document shows the declared limits and never calls ",[350,2029,2030],{},"narrowLimits()",[350,2032,2033],{},"total_capped"," is optional on the pages of a resource that an extension may cap.",[805,2036,2037,2038,2043],{},"A capped count prohibits ",[359,2039,2040],{"href":101},[350,2041,2042],{},"search.totals"," for that user.",[346,2045,2046,2047,2049,2050,2053,2054,2056,2057,1081,2059,871],{},"It refuses a value below 1, a narrowing that leaves no size, no size at or below ",[350,2048,1994],{}," or none at or below the include limit, and a read of ",[350,2051,2052],{},"definition()->limits()"," of the same resource inside ",[350,2055,2030],{},": read ",[350,2058,2009],{},[359,2060,58],{"href":59},[363,2062,2064],{"id":2063},"declaring-instructions","Declaring instructions",[346,2066,2067,2070],{},[350,2068,2069],{},"DeclaresInstructions::instructions(InstructionsContext $context)"," adds search instructions to a resource:",[374,2072,2075],{"className":376,"code":2073,"filename":2074,"language":379,"meta":380,"style":380},"use Lomkit\\Rest\\Extensions\\Contexts\\InstructionsContext;\nuse Lomkit\\Rest\\Extensions\\Extension;\nuse Lomkit\\Rest\\Extensions\\Kinds\\DeclaresInstructions;\n\nfinal class ArchiveInstructionsExtension extends Extension implements DeclaresInstructions\n{\n    #[\\Override]\n    public static function name(): string\n    {\n        return 'arc';\n    }\n\n    #[\\Override]\n    public function instructions(InstructionsContext $context): array\n    {\n        return is_subclass_of($context->resource, ArchivableResource::class) ? [WithArchivedInstruction::class] : [];\n    }\n}\n","Vendor\u002FArchive\u002FArchiveInstructionsExtension.php",[350,2076,2077,2102,2122,2147,2151,2169,2173,2181,2195,2199,2212,2216,2220,2228,2250,2254,2302,2306],{"__ignoreMap":380},[384,2078,2079,2081,2083,2085,2087,2089,2091,2093,2095,2097,2100],{"class":386,"line":387},[384,2080,391],{"class":390},[384,2082,395],{"class":394},[384,2084,399],{"class":398},[384,2086,402],{"class":394},[384,2088,399],{"class":398},[384,2090,208],{"class":394},[384,2092,399],{"class":398},[384,2094,411],{"class":394},[384,2096,399],{"class":398},[384,2098,2099],{"class":394},"InstructionsContext",[384,2101,419],{"class":398},[384,2103,2104,2106,2108,2110,2112,2114,2116,2118,2120],{"class":386,"line":422},[384,2105,391],{"class":390},[384,2107,395],{"class":394},[384,2109,399],{"class":398},[384,2111,402],{"class":394},[384,2113,399],{"class":398},[384,2115,208],{"class":394},[384,2117,399],{"class":398},[384,2119,439],{"class":394},[384,2121,419],{"class":398},[384,2123,2124,2126,2128,2130,2132,2134,2136,2138,2140,2142,2145],{"class":386,"line":444},[384,2125,391],{"class":390},[384,2127,395],{"class":394},[384,2129,399],{"class":398},[384,2131,402],{"class":394},[384,2133,399],{"class":398},[384,2135,208],{"class":394},[384,2137,399],{"class":398},[384,2139,461],{"class":394},[384,2141,399],{"class":398},[384,2143,2144],{"class":394},"DeclaresInstructions",[384,2146,419],{"class":398},[384,2148,2149],{"class":386,"line":471},[384,2150,475],{"emptyLinePlaceholder":474},[384,2152,2153,2155,2157,2160,2162,2164,2166],{"class":386,"line":478},[384,2154,482],{"class":481},[384,2156,485],{"class":481},[384,2158,2159],{"class":488}," ArchiveInstructionsExtension",[384,2161,492],{"class":481},[384,2163,495],{"class":488},[384,2165,498],{"class":481},[384,2167,2168],{"class":488}," DeclaresInstructions\n",[384,2170,2171],{"class":386,"line":504},[384,2172,507],{"class":398},[384,2174,2175,2177,2179],{"class":386,"line":510},[384,2176,555],{"class":394},[384,2178,399],{"class":398},[384,2180,560],{"class":394},[384,2182,2183,2185,2187,2189,2191,2193],{"class":386,"line":547},[384,2184,513],{"class":481},[384,2186,568],{"class":481},[384,2188,516],{"class":481},[384,2190,573],{"class":519},[384,2192,576],{"class":398},[384,2194,579],{"class":390},[384,2196,2197],{"class":386,"line":552},[384,2198,585],{"class":398},[384,2200,2201,2203,2205,2208,2210],{"class":386,"line":563},[384,2202,592],{"class":591},[384,2204,595],{"class":398},[384,2206,2207],{"class":598},"arc",[384,2209,601],{"class":398},[384,2211,419],{"class":398},[384,2213,2214],{"class":386,"line":582},[384,2215,609],{"class":398},[384,2217,2218],{"class":386,"line":588},[384,2219,475],{"emptyLinePlaceholder":474},[384,2221,2222,2224,2226],{"class":386,"line":606},[384,2223,555],{"class":394},[384,2225,399],{"class":398},[384,2227,560],{"class":394},[384,2229,2230,2232,2234,2237,2239,2241,2243,2245,2247],{"class":386,"line":612},[384,2231,513],{"class":481},[384,2233,516],{"class":481},[384,2235,2236],{"class":519}," instructions",[384,2238,523],{"class":398},[384,2240,2099],{"class":488},[384,2242,535],{"class":398},[384,2244,642],{"class":394},[384,2246,645],{"class":398},[384,2248,2249],{"class":390}," array\n",[384,2251,2252],{"class":386,"line":617},[384,2253,585],{"class":398},[384,2255,2256,2258,2261,2263,2265,2267,2269,2271,2274,2276,2278,2280,2283,2286,2289,2291,2293,2296,2299],{"class":386,"line":626},[384,2257,592],{"class":591},[384,2259,2260],{"class":519}," is_subclass_of",[384,2262,753],{"class":398},[384,2264,642],{"class":394},[384,2266,667],{"class":398},[384,2268,1299],{"class":394},[384,2270,1322],{"class":398},[384,2272,2273],{"class":488}," ArchivableResource",[384,2275,1328],{"class":398},[384,2277,1331],{"class":390},[384,2279,541],{"class":398},[384,2281,2282],{"class":398}," ?",[384,2284,2285],{"class":398}," [",[384,2287,2288],{"class":488},"WithArchivedInstruction",[384,2290,1328],{"class":398},[384,2292,1331],{"class":390},[384,2294,2295],{"class":398},"]",[384,2297,2298],{"class":398}," :",[384,2300,2301],{"class":398}," [];\n",[384,2303,2304],{"class":386,"line":651},[384,2305,609],{"class":398},[384,2307,2308],{"class":386,"line":656},[384,2309,800],{"class":398},[374,2311,2316],{"className":2312,"code":2313,"filename":2314,"language":2315,"meta":380,"style":380},"language-json shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","{\n  \"search\": {\n    \"instructions\": [{\"name\": \"arc.with-archived\"}]\n  }\n}\n","POST \u002Fapi\u002Fauthors\u002Fsearch","json",[350,2317,2318,2322,2338,2373,2378],{"__ignoreMap":380},[384,2319,2320],{"class":386,"line":387},[384,2321,507],{"class":398},[384,2323,2324,2327,2330,2333,2336],{"class":386,"line":422},[384,2325,2326],{"class":398},"  \"",[384,2328,2329],{"class":481},"search",[384,2331,2332],{"class":398},"\"",[384,2334,2335],{"class":398},":",[384,2337,679],{"class":398},[384,2339,2340,2343,2346,2348,2350,2353,2355,2358,2360,2362,2365,2368,2370],{"class":386,"line":444},[384,2341,2342],{"class":398},"    \"",[384,2344,2345],{"class":488},"instructions",[384,2347,2332],{"class":398},[384,2349,2335],{"class":398},[384,2351,2352],{"class":398}," [{",[384,2354,2332],{"class":398},[384,2356,2357],{"class":390},"name",[384,2359,2332],{"class":398},[384,2361,2335],{"class":398},[384,2363,2364],{"class":398}," \"",[384,2366,2367],{"class":598},"arc.with-archived",[384,2369,2332],{"class":398},[384,2371,2372],{"class":398},"}]\n",[384,2374,2375],{"class":386,"line":471},[384,2376,2377],{"class":398},"  }\n",[384,2379,2380],{"class":386,"line":478},[384,2381,800],{"class":398},[802,2383,2384,2387,2404,2409],{},[805,2385,2386],{},"It receives the resource class only, no user. Its instructions are read with those of the resource.",[805,2388,2389,2390,2393,2394,2396,2397,2399,2400,2403],{},"The key of each instruction is the extension name, a dot and its ",[350,2391,2392],{},"uriKey()",": ",[350,2395,2367],{},", in requests, ",[350,2398,2001],{},", search meta and the OpenAPI document. ",[350,2401,2402],{},"$instruction->publicUriKey()"," returns it.",[805,2405,2406,2407,871],{},"Like any instruction, it runs in its own where group, AND-ed with the rest of the search. See ",[359,2408,84],{"href":85},[805,2410,2411,2412,2415,2416,2418],{},"It refuses a key that another instruction of the resource or of an extension takes, and the entries that ",[350,2413,2414],{},"instructions()"," of a resource refuses. ",[350,2417,970],{}," reports both.",[2420,2421,2422],"note",{},[346,2423,2424,2427,2428,2431],{},[350,2425,2426],{},"Instruction"," gains the final method ",[350,2429,2430],{},"publicUriKey()",": an instruction that declares a method of that name renames it.",[2433,2434,2435],"style",{},"html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}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 .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}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 .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}",{"title":380,"searchDepth":387,"depth":422,"links":2437},[2438,2442,2443,2447,2448],{"id":365,"depth":422,"text":366,"children":2439},[2440,2441],{"id":846,"depth":444,"text":847},{"id":930,"depth":444,"text":931},{"id":964,"depth":422,"text":965},{"id":1116,"depth":422,"text":1117,"children":2444},[2445,2446],{"id":1616,"depth":444,"text":1617},{"id":1670,"depth":444,"text":931},{"id":1705,"depth":422,"text":1706},{"id":2063,"depth":422,"text":2064},"Restrict the perimeter of every resource, add columns for the policies, narrow page sizes per user and add search instructions from an extension.","md",null,{},{"title":217,"description":2449},{"loc":218,"lastmod":2455},"2026-11-21T13:04:54+01:00","nSV_s4yaHPqvF9S5L0hTtsx81ezZQ2Wo0Z_vTqsmdHY",[2458,2460],{"title":208,"path":214,"stem":215,"description":2459,"children":-1},"Add behavior to every resource from one class, registered by an app or a package, with a name, a list of kinds and checks at registration.",{"title":221,"path":222,"stem":223,"description":2461,"children":-1},"Restrict every search engine query, declare server-only index attributes and lists of strings, and provide the profile of a Scout engine.",1795277216910]