[{"data":1,"prerenderedAt":2193},["ShallowReactive",2],{"navigation_docs":3,"-models-defining-models":74,"-models-defining-models-surround":2188},[4,20,65],{"title":5,"path":6,"stem":7,"children":8,"page":19},"Getting Started","/getting-started","1.getting-started",[9,14],{"title":10,"path":11,"stem":12,"icon":13},"Introduction","/getting-started/introduction","1.getting-started/1.introduction","i-lucide-house",{"title":15,"path":16,"stem":17,"icon":18},"Installation","/getting-started/installation","1.getting-started/2.installation","i-lucide-download",false,{"title":21,"path":22,"stem":23,"children":24,"page":19},"Models","/models","2.models",[25,30,35,40,45,50,55,60],{"title":26,"path":27,"stem":28,"icon":29},"Defining Models","/models/defining-models","2.models/1.defining-models","i-lucide-database",{"title":31,"path":32,"stem":33,"icon":34},"Retrieving Models","/models/retrieving","2.models/2.retrieving","i-lucide-database-search",{"title":36,"path":37,"stem":38,"icon":39},"Inserting & Updating Models","/models/inserting-and-updating","2.models/3.inserting-and-updating","i-lucide-between-horizontal-start",{"title":41,"path":42,"stem":43,"icon":44},"Deleting Models","/models/deleting","2.models/4.deleting","i-lucide-trash",{"title":46,"path":47,"stem":48,"icon":49},"Relationships","/models/relationships","2.models/5.relationships","i-lucide-share-2",{"title":51,"path":52,"stem":53,"icon":54},"Events","/models/events","2.models/6.events","i-lucide-bell",{"title":56,"path":57,"stem":58,"icon":59},"Migrations & Seeders","/models/migrations-and-seeders","2.models/7.migrations-and-seeders","i-lucide-wrench",{"title":61,"path":62,"stem":63,"icon":64},"Transactions","/models/transactions","2.models/8.transactions","i-lucide-git-commit-horizontal",{"title":66,"path":67,"stem":68,"children":69,"page":19},"Contributing","/contributing","3.contributing",[70],{"title":71,"path":72,"stem":73},"Local Development","/contributing/local-development","3.contributing/1.local-development",{"id":75,"title":26,"body":76,"description":2180,"extension":2181,"links":2182,"meta":2183,"navigation":2184,"path":27,"seo":2185,"stem":28,"__hash__":2187},"docs/2.models/1.defining-models.md",{"type":77,"value":78,"toc":2165},"minimark",[79,84,96,107,110,114,122,128,153,322,326,347,358,499,503,506,620,624,630,635,741,843,850,874,878,974,1052,1059,1095,1099,1106,1196,1199,1226,1229,1369,1373,1377,1380,1383,1507,1510,1561,1565,1571,1574,1580,1847,1945,1948,2161],[80,81,83],"h2",{"id":82},"define-your-kysely-instance-and-types","Define your Kysely instance and types",[85,86,87,88,95],"p",{},"Begin by following the Kysely instructions for setting up your ",[89,90,94],"a",{"href":91,"rel":92},"https://kysely.dev/docs/getting-started#dialects",[93],"nofollow","database Types"," and connection.",[85,97,98,99,102,103,106],{},"You can see an example of database types used by this repository for testing in ",[89,100,101],{"href":101},"test/types/database.ts",". An example database connection can be found in ",[89,104,105],{"href":105},"test/database/db.ts",".",[85,108,109],{},"This is all just standard Kysely setup up to this point, so follow their instructions for this part!",[80,111,113],{"id":112},"define-your-vasta-models","Define your Vasta Models",[85,115,116,117,121],{},"You'll need to create new classes for each of your models, extending the ",[118,119,120],"code",{},"defineModel"," function provided by Vasta. Each model should specify the corresponding table name and define its attributes.",[85,123,124,125,127],{},"The ",[118,126,120],{}," function takes a configuration object as a paramter. Here are some minumum properties for the configuration object:",[129,130,131,138,147],"ul",{},[132,133,134,137],"li",{},[118,135,136],{},"db",": This should be set to your Kysely database instance.",[132,139,140,143,144,106],{},[118,141,142],{},"table",": This should be set to the name of the table in your database that this model represents. This should be a string typed ",[118,145,146],{},"as const",[132,148,149,152],{},[118,150,151],{},"primaryKey",": (optional) the primary key column for the table, defaults to \"id\".",[154,155,161],"pre",{"className":156,"code":157,"filename":158,"language":159,"meta":160,"style":160},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { defineModel } from \"vasta-orm\";\nimport db from \"@/database/db\";\n\nexport default class Person extends defineModel({\n  db, // Your Kysely database instance\n  table: \"people\", // the name of the table in your Kysely database type that this model represents\n  id: \"id\", // optional, defaults to \"id\"\n}) {}\n","database/models/Person.ts","ts","",[118,162,163,199,219,226,255,268,290,310],{"__ignoreMap":160},[164,165,168,172,176,180,183,186,189,193,196],"span",{"class":166,"line":167},"line",1,[164,169,171],{"class":170},"s7zQu","import",[164,173,175],{"class":174},"sMK4o"," {",[164,177,179],{"class":178},"sTEyZ"," defineModel",[164,181,182],{"class":174}," }",[164,184,185],{"class":170}," from",[164,187,188],{"class":174}," \"",[164,190,192],{"class":191},"sfazB","vasta-orm",[164,194,195],{"class":174},"\"",[164,197,198],{"class":174},";\n",[164,200,202,204,207,210,212,215,217],{"class":166,"line":201},2,[164,203,171],{"class":170},[164,205,206],{"class":178}," db ",[164,208,209],{"class":170},"from",[164,211,188],{"class":174},[164,213,214],{"class":191},"@/database/db",[164,216,195],{"class":174},[164,218,198],{"class":174},[164,220,222],{"class":166,"line":221},3,[164,223,225],{"emptyLinePlaceholder":224},true,"\n",[164,227,229,232,235,239,243,246,249,252],{"class":166,"line":228},4,[164,230,231],{"class":170},"export",[164,233,234],{"class":170}," default",[164,236,238],{"class":237},"spNyl"," class",[164,240,242],{"class":241},"sBMFI"," Person",[164,244,245],{"class":237}," extends",[164,247,179],{"class":248},"s2Zo4",[164,250,251],{"class":178},"(",[164,253,254],{"class":174},"{\n",[164,256,258,261,264],{"class":166,"line":257},5,[164,259,260],{"class":178},"  db",[164,262,263],{"class":174},",",[164,265,267],{"class":266},"sHwdD"," // Your Kysely database instance\n",[164,269,271,275,278,280,283,285,287],{"class":166,"line":270},6,[164,272,274],{"class":273},"swJcz","  table",[164,276,277],{"class":174},":",[164,279,188],{"class":174},[164,281,282],{"class":191},"people",[164,284,195],{"class":174},[164,286,263],{"class":174},[164,288,289],{"class":266}," // the name of the table in your Kysely database type that this model represents\n",[164,291,293,296,298,300,303,305,307],{"class":166,"line":292},7,[164,294,295],{"class":273},"  id",[164,297,277],{"class":174},[164,299,188],{"class":174},[164,301,302],{"class":191},"id",[164,304,195],{"class":174},[164,306,263],{"class":174},[164,308,309],{"class":266}," // optional, defaults to \"id\"\n",[164,311,313,316,319],{"class":166,"line":312},8,[164,314,315],{"class":174},"}",[164,317,318],{"class":178},") ",[164,320,321],{"class":174},"{}\n",[80,323,325],{"id":324},"hidden-fields","Hidden Fields",[85,327,328,329,332,333,335,336,339,340,343,344,106],{},"Use the ",[118,330,331],{},"hidden"," option for an attribute to keep sensitive columns out of serialized model output. When a field is listed in ",[118,334,331],{},", it is omitted from ",[118,337,338],{},"toJSON()"," and ",[118,341,342],{},"JSON.stringify(model)",", but it still exists on ",[118,345,346],{},"model.attributes",[85,348,349,350,353,354,357],{},"A good example of this is a ",[118,351,352],{},"password"," field on a ",[118,355,356],{},"User"," model. You want to be able to access the password when you need to, but you don't want it to be included when you serialize the model to JSON.",[154,359,362],{"className":156,"code":360,"filename":361,"language":159,"meta":160,"style":160},"import { defineModel } from \"vasta-orm\";\nimport db from \"@/database/db\";\n\nexport default class User extends defineModel({\n  db,\n  table: \"users\",\n  attributes: {\n    password: {\n      hidden: true,\n    },\n  },\n}) {}\n","database/models/User.ts",[118,363,364,384,400,404,423,430,445,455,464,478,484,490],{"__ignoreMap":160},[164,365,366,368,370,372,374,376,378,380,382],{"class":166,"line":167},[164,367,171],{"class":170},[164,369,175],{"class":174},[164,371,179],{"class":178},[164,373,182],{"class":174},[164,375,185],{"class":170},[164,377,188],{"class":174},[164,379,192],{"class":191},[164,381,195],{"class":174},[164,383,198],{"class":174},[164,385,386,388,390,392,394,396,398],{"class":166,"line":201},[164,387,171],{"class":170},[164,389,206],{"class":178},[164,391,209],{"class":170},[164,393,188],{"class":174},[164,395,214],{"class":191},[164,397,195],{"class":174},[164,399,198],{"class":174},[164,401,402],{"class":166,"line":221},[164,403,225],{"emptyLinePlaceholder":224},[164,405,406,408,410,412,415,417,419,421],{"class":166,"line":228},[164,407,231],{"class":170},[164,409,234],{"class":170},[164,411,238],{"class":237},[164,413,414],{"class":241}," User",[164,416,245],{"class":237},[164,418,179],{"class":248},[164,420,251],{"class":178},[164,422,254],{"class":174},[164,424,425,427],{"class":166,"line":257},[164,426,260],{"class":178},[164,428,429],{"class":174},",\n",[164,431,432,434,436,438,441,443],{"class":166,"line":270},[164,433,274],{"class":273},[164,435,277],{"class":174},[164,437,188],{"class":174},[164,439,440],{"class":191},"users",[164,442,195],{"class":174},[164,444,429],{"class":174},[164,446,447,450,452],{"class":166,"line":292},[164,448,449],{"class":273},"  attributes",[164,451,277],{"class":174},[164,453,454],{"class":174}," {\n",[164,456,457,460,462],{"class":166,"line":312},[164,458,459],{"class":273},"    password",[164,461,277],{"class":174},[164,463,454],{"class":174},[164,465,467,470,472,476],{"class":166,"line":466},9,[164,468,469],{"class":273},"      hidden",[164,471,277],{"class":174},[164,473,475],{"class":474},"sfNiH"," true",[164,477,429],{"class":174},[164,479,481],{"class":166,"line":480},10,[164,482,483],{"class":174},"    },\n",[164,485,487],{"class":166,"line":486},11,[164,488,489],{"class":174},"  },\n",[164,491,493,495,497],{"class":166,"line":492},12,[164,494,315],{"class":174},[164,496,318],{"class":178},[164,498,321],{"class":174},[80,500,502],{"id":501},"default-attributes","Default Attributes",[85,504,505],{},"You can also specify default attributes for your models. These attributes will be applied to the model instance if they are not provided in the new model constructor when creating a new instance of a model. Creating a new instance without passing in attributes included in the defaults will not throw a type error since they are provided by the default attributes setting.",[154,507,510],{"className":156,"code":508,"filename":509,"language":159,"meta":160,"style":160},"export default class Pet extends defineModel({\n  // ...other config\n  attributes: {\n    counter: {\n      default: 0\n    },\n    type: {\n      // You can also use a function to set dynamic defaults\n      default: () => \"dragon\",\n    }\n  },\n}) {\n","database/models/Pet.ts",[118,511,512,531,536,544,553,564,568,577,582,603,608,612],{"__ignoreMap":160},[164,513,514,516,518,520,523,525,527,529],{"class":166,"line":167},[164,515,231],{"class":170},[164,517,234],{"class":170},[164,519,238],{"class":237},[164,521,522],{"class":241}," Pet",[164,524,245],{"class":237},[164,526,179],{"class":248},[164,528,251],{"class":178},[164,530,254],{"class":174},[164,532,533],{"class":166,"line":201},[164,534,535],{"class":266},"  // ...other config\n",[164,537,538,540,542],{"class":166,"line":221},[164,539,449],{"class":273},[164,541,277],{"class":174},[164,543,454],{"class":174},[164,545,546,549,551],{"class":166,"line":228},[164,547,548],{"class":273},"    counter",[164,550,277],{"class":174},[164,552,454],{"class":174},[164,554,555,558,560],{"class":166,"line":257},[164,556,557],{"class":273},"      default",[164,559,277],{"class":174},[164,561,563],{"class":562},"sbssI"," 0\n",[164,565,566],{"class":166,"line":270},[164,567,483],{"class":174},[164,569,570,573,575],{"class":166,"line":292},[164,571,572],{"class":273},"    type",[164,574,277],{"class":174},[164,576,454],{"class":174},[164,578,579],{"class":166,"line":312},[164,580,581],{"class":266},"      // You can also use a function to set dynamic defaults\n",[164,583,584,586,588,591,594,596,599,601],{"class":166,"line":466},[164,585,557],{"class":248},[164,587,277],{"class":174},[164,589,590],{"class":174}," ()",[164,592,593],{"class":237}," =>",[164,595,188],{"class":174},[164,597,598],{"class":191},"dragon",[164,600,195],{"class":174},[164,602,429],{"class":174},[164,604,605],{"class":166,"line":480},[164,606,607],{"class":174},"    }\n",[164,609,610],{"class":166,"line":486},[164,611,489],{"class":174},[164,613,614,616,618],{"class":166,"line":492},[164,615,315],{"class":174},[164,617,318],{"class":178},[164,619,254],{"class":174},[80,621,623],{"id":622},"accessors-and-mutators-getset","Accessors and Mutators (get/set)",[85,625,626,627,629],{},"Model attributes can be modified with get and set functions to change the value which will be retrieved and stored in your database. These functions are defined on the ",[118,628,120],{}," config for the attribute, and should return the matching type for the attribute being modified",[631,632,634],"h3",{"id":633},"accessors-get","Accessors (get)",[154,636,639],{"className":156,"code":637,"filename":638,"language":159,"meta":160,"style":160},"class Person extends defineModel({\n  db,\n  table: \"people\",\n  attributes: {\n    name: {\n      get: (value) => value.toUpperCase(),\n    },\n  },\n}) {}\n","/database/models/Person.ts",[118,640,641,656,662,676,684,693,725,729,733],{"__ignoreMap":160},[164,642,643,646,648,650,652,654],{"class":166,"line":167},[164,644,645],{"class":237},"class",[164,647,242],{"class":241},[164,649,245],{"class":237},[164,651,179],{"class":248},[164,653,251],{"class":178},[164,655,254],{"class":174},[164,657,658,660],{"class":166,"line":201},[164,659,260],{"class":178},[164,661,429],{"class":174},[164,663,664,666,668,670,672,674],{"class":166,"line":221},[164,665,274],{"class":273},[164,667,277],{"class":174},[164,669,188],{"class":174},[164,671,282],{"class":191},[164,673,195],{"class":174},[164,675,429],{"class":174},[164,677,678,680,682],{"class":166,"line":228},[164,679,449],{"class":273},[164,681,277],{"class":174},[164,683,454],{"class":174},[164,685,686,689,691],{"class":166,"line":257},[164,687,688],{"class":273},"    name",[164,690,277],{"class":174},[164,692,454],{"class":174},[164,694,695,698,700,703,707,710,712,715,717,720,723],{"class":166,"line":270},[164,696,697],{"class":248},"      get",[164,699,277],{"class":174},[164,701,702],{"class":174}," (",[164,704,706],{"class":705},"sHdIc","value",[164,708,709],{"class":174},")",[164,711,593],{"class":237},[164,713,714],{"class":178}," value",[164,716,106],{"class":174},[164,718,719],{"class":248},"toUpperCase",[164,721,722],{"class":178},"()",[164,724,429],{"class":174},[164,726,727],{"class":166,"line":292},[164,728,483],{"class":174},[164,730,731],{"class":166,"line":312},[164,732,489],{"class":174},[164,734,735,737,739],{"class":166,"line":466},[164,736,315],{"class":174},[164,738,318],{"class":178},[164,740,321],{"class":174},[154,742,744],{"className":156,"code":743,"language":159,"meta":160,"style":160},"const person = new Person({ name: \"Joe\" }); // the name value is not modified\n\n// reading the name attribute runs the get function and returns \"JOE\"\n// even though the actual attribute value is \"Joe\"\nconst allCapsPersonName = person.name;\n\nperson.save(); // The string \"Joe\" is written to the database\n",[118,745,746,789,793,798,803,822,826],{"__ignoreMap":160},[164,747,748,751,754,757,760,762,764,767,770,772,774,777,779,781,783,786],{"class":166,"line":167},[164,749,750],{"class":237},"const",[164,752,753],{"class":178}," person ",[164,755,756],{"class":174},"=",[164,758,759],{"class":174}," new",[164,761,242],{"class":248},[164,763,251],{"class":178},[164,765,766],{"class":174},"{",[164,768,769],{"class":273}," name",[164,771,277],{"class":174},[164,773,188],{"class":174},[164,775,776],{"class":191},"Joe",[164,778,195],{"class":174},[164,780,182],{"class":174},[164,782,709],{"class":178},[164,784,785],{"class":174},";",[164,787,788],{"class":266}," // the name value is not modified\n",[164,790,791],{"class":166,"line":201},[164,792,225],{"emptyLinePlaceholder":224},[164,794,795],{"class":166,"line":221},[164,796,797],{"class":266},"// reading the name attribute runs the get function and returns \"JOE\"\n",[164,799,800],{"class":166,"line":228},[164,801,802],{"class":266},"// even though the actual attribute value is \"Joe\"\n",[164,804,805,807,810,812,815,817,820],{"class":166,"line":257},[164,806,750],{"class":237},[164,808,809],{"class":178}," allCapsPersonName ",[164,811,756],{"class":174},[164,813,814],{"class":178}," person",[164,816,106],{"class":174},[164,818,819],{"class":178},"name",[164,821,198],{"class":174},[164,823,824],{"class":166,"line":270},[164,825,225],{"emptyLinePlaceholder":224},[164,827,828,831,833,836,838,840],{"class":166,"line":292},[164,829,830],{"class":178},"person",[164,832,106],{"class":174},[164,834,835],{"class":248},"save",[164,837,722],{"class":178},[164,839,785],{"class":174},[164,841,842],{"class":266}," // The string \"Joe\" is written to the database\n",[85,844,845,846,849],{},"Accessors can be bypassed by using the ",[118,847,848],{},"getRawAttributes"," function to retrieve all of the unmodified attribute values",[154,851,853],{"className":156,"code":852,"language":159,"meta":160,"style":160},"const rawAttributes = person.getRawAttributes();\n",[118,854,855],{"__ignoreMap":160},[164,856,857,859,862,864,866,868,870,872],{"class":166,"line":167},[164,858,750],{"class":237},[164,860,861],{"class":178}," rawAttributes ",[164,863,756],{"class":174},[164,865,814],{"class":178},[164,867,106],{"class":174},[164,869,848],{"class":248},[164,871,722],{"class":178},[164,873,198],{"class":174},[631,875,877],{"id":876},"mutators-set","Mutators (set)",[154,879,881],{"className":156,"code":880,"filename":638,"language":159,"meta":160,"style":160},"class Person extends defineModel({\n  db,\n  table: \"people\",\n  attributes: {\n    name: {\n      set: (value) => value.toUpperCase(),\n    },\n  },\n}) {}\n",[118,882,883,897,903,917,925,933,958,962,966],{"__ignoreMap":160},[164,884,885,887,889,891,893,895],{"class":166,"line":167},[164,886,645],{"class":237},[164,888,242],{"class":241},[164,890,245],{"class":237},[164,892,179],{"class":248},[164,894,251],{"class":178},[164,896,254],{"class":174},[164,898,899,901],{"class":166,"line":201},[164,900,260],{"class":178},[164,902,429],{"class":174},[164,904,905,907,909,911,913,915],{"class":166,"line":221},[164,906,274],{"class":273},[164,908,277],{"class":174},[164,910,188],{"class":174},[164,912,282],{"class":191},[164,914,195],{"class":174},[164,916,429],{"class":174},[164,918,919,921,923],{"class":166,"line":228},[164,920,449],{"class":273},[164,922,277],{"class":174},[164,924,454],{"class":174},[164,926,927,929,931],{"class":166,"line":257},[164,928,688],{"class":273},[164,930,277],{"class":174},[164,932,454],{"class":174},[164,934,935,938,940,942,944,946,948,950,952,954,956],{"class":166,"line":270},[164,936,937],{"class":248},"      set",[164,939,277],{"class":174},[164,941,702],{"class":174},[164,943,706],{"class":705},[164,945,709],{"class":174},[164,947,593],{"class":237},[164,949,714],{"class":178},[164,951,106],{"class":174},[164,953,719],{"class":248},[164,955,722],{"class":178},[164,957,429],{"class":174},[164,959,960],{"class":166,"line":292},[164,961,483],{"class":174},[164,963,964],{"class":166,"line":312},[164,965,489],{"class":174},[164,967,968,970,972],{"class":166,"line":466},[164,969,315],{"class":174},[164,971,318],{"class":178},[164,973,321],{"class":174},[154,975,977],{"className":156,"code":976,"language":159,"meta":160,"style":160},"const person = new Person({ name: \"Joe\" }); // the set function is run and the value is stored in uppercase in the model\nconst allCapsPersonName = person.name; // returns \"JOE\" which is the actual value of the attribute\n\nperson.save(); // The string \"JOE\" is written to the database\n",[118,978,979,1014,1033,1037],{"__ignoreMap":160},[164,980,981,983,985,987,989,991,993,995,997,999,1001,1003,1005,1007,1009,1011],{"class":166,"line":167},[164,982,750],{"class":237},[164,984,753],{"class":178},[164,986,756],{"class":174},[164,988,759],{"class":174},[164,990,242],{"class":248},[164,992,251],{"class":178},[164,994,766],{"class":174},[164,996,769],{"class":273},[164,998,277],{"class":174},[164,1000,188],{"class":174},[164,1002,776],{"class":191},[164,1004,195],{"class":174},[164,1006,182],{"class":174},[164,1008,709],{"class":178},[164,1010,785],{"class":174},[164,1012,1013],{"class":266}," // the set function is run and the value is stored in uppercase in the model\n",[164,1015,1016,1018,1020,1022,1024,1026,1028,1030],{"class":166,"line":201},[164,1017,750],{"class":237},[164,1019,809],{"class":178},[164,1021,756],{"class":174},[164,1023,814],{"class":178},[164,1025,106],{"class":174},[164,1027,819],{"class":178},[164,1029,785],{"class":174},[164,1031,1032],{"class":266}," // returns \"JOE\" which is the actual value of the attribute\n",[164,1034,1035],{"class":166,"line":221},[164,1036,225],{"emptyLinePlaceholder":224},[164,1038,1039,1041,1043,1045,1047,1049],{"class":166,"line":228},[164,1040,830],{"class":178},[164,1042,106],{"class":174},[164,1044,835],{"class":248},[164,1046,722],{"class":178},[164,1048,785],{"class":174},[164,1050,1051],{"class":266}," // The string \"JOE\" is written to the database\n",[85,1053,1054,1055,1058],{},"Mutators can be bypassed by using the ",[118,1056,1057],{},"setRawAttributes"," function",[154,1060,1062],{"className":156,"code":1061,"language":159,"meta":160,"style":160},"person.setRawAttributes({ name: \"Joe\" }); // this will not trigger the mutator\n",[118,1063,1064],{"__ignoreMap":160},[164,1065,1066,1068,1070,1072,1074,1076,1078,1080,1082,1084,1086,1088,1090,1092],{"class":166,"line":167},[164,1067,830],{"class":178},[164,1069,106],{"class":174},[164,1071,1057],{"class":248},[164,1073,251],{"class":178},[164,1075,766],{"class":174},[164,1077,769],{"class":273},[164,1079,277],{"class":174},[164,1081,188],{"class":174},[164,1083,776],{"class":191},[164,1085,195],{"class":174},[164,1087,182],{"class":174},[164,1089,709],{"class":178},[164,1091,785],{"class":174},[164,1093,1094],{"class":266}," // this will not trigger the mutator\n",[80,1096,1098],{"id":1097},"computed-values","Computed Values",[85,1100,1101,1102,1105],{},"If you have a computed value which you'd like to add to a model, you can do so by adding a ",[118,1103,1104],{},"get"," function for that \"fake\" attribute. This attribute will be defined as read-only, and will show a type error if you try to modify it.",[154,1107,1109],{"className":156,"code":1108,"filename":509,"language":159,"meta":160,"style":160},"export default class Pet extends defineModel({\n  // ... model config\n}) {\n  // this is in the class, not the defineModel config\n\n  get upperName() {\n    // returns the name of the pet in all uppercase\n    return this.name.toUpperCase();\n  }\n}\n",[118,1110,1111,1129,1134,1142,1147,1151,1163,1168,1186,1191],{"__ignoreMap":160},[164,1112,1113,1115,1117,1119,1121,1123,1125,1127],{"class":166,"line":167},[164,1114,231],{"class":170},[164,1116,234],{"class":170},[164,1118,238],{"class":237},[164,1120,522],{"class":241},[164,1122,245],{"class":237},[164,1124,179],{"class":248},[164,1126,251],{"class":178},[164,1128,254],{"class":174},[164,1130,1131],{"class":166,"line":201},[164,1132,1133],{"class":266},"  // ... model config\n",[164,1135,1136,1138,1140],{"class":166,"line":221},[164,1137,315],{"class":174},[164,1139,318],{"class":178},[164,1141,254],{"class":174},[164,1143,1144],{"class":166,"line":228},[164,1145,1146],{"class":266},"  // this is in the class, not the defineModel config\n",[164,1148,1149],{"class":166,"line":257},[164,1150,225],{"emptyLinePlaceholder":224},[164,1152,1153,1156,1159,1161],{"class":166,"line":270},[164,1154,1155],{"class":237},"  get",[164,1157,1158],{"class":273}," upperName",[164,1160,722],{"class":174},[164,1162,454],{"class":174},[164,1164,1165],{"class":166,"line":292},[164,1166,1167],{"class":266},"    // returns the name of the pet in all uppercase\n",[164,1169,1170,1173,1176,1178,1180,1182,1184],{"class":166,"line":312},[164,1171,1172],{"class":170},"    return",[164,1174,1175],{"class":174}," this.",[164,1177,819],{"class":178},[164,1179,106],{"class":174},[164,1181,719],{"class":248},[164,1183,722],{"class":273},[164,1185,198],{"class":174},[164,1187,1188],{"class":166,"line":466},[164,1189,1190],{"class":174},"  }\n",[164,1192,1193],{"class":166,"line":480},[164,1194,1195],{"class":174},"}\n",[85,1197,1198],{},"The attribute can then be read directly on the model object",[154,1200,1202],{"className":156,"code":1201,"language":159,"meta":160,"style":160},"const upperName = pet.upperName; // upperName shows in intellisense and appears as read-only attribute on the model\n",[118,1203,1204],{"__ignoreMap":160},[164,1205,1206,1208,1211,1213,1216,1218,1221,1223],{"class":166,"line":167},[164,1207,750],{"class":237},[164,1209,1210],{"class":178}," upperName ",[164,1212,756],{"class":174},[164,1214,1215],{"class":178}," pet",[164,1217,106],{"class":174},[164,1219,1220],{"class":178},"upperName",[164,1222,785],{"class":174},[164,1224,1225],{"class":266}," // upperName shows in intellisense and appears as read-only attribute on the model\n",[85,1227,1228],{},"While accessors and mutators (get/set) on an attribute need to accept and return the original type, computed attributes can return anything you want!",[154,1230,1232],{"className":156,"code":1231,"filename":638,"language":159,"meta":160,"style":160},"class Person extends defineModel({\n  db,\n  table: \"people\",\n}) {\n  get splitName() {\n    return {\n      firstName: this.name.split(\" \")[0],\n      lastName: this.name.split(\" \")[1],\n    };\n  }\n}\n",[118,1233,1234,1248,1254,1268,1276,1287,1293,1326,1356,1361,1365],{"__ignoreMap":160},[164,1235,1236,1238,1240,1242,1244,1246],{"class":166,"line":167},[164,1237,645],{"class":237},[164,1239,242],{"class":241},[164,1241,245],{"class":237},[164,1243,179],{"class":248},[164,1245,251],{"class":178},[164,1247,254],{"class":174},[164,1249,1250,1252],{"class":166,"line":201},[164,1251,260],{"class":178},[164,1253,429],{"class":174},[164,1255,1256,1258,1260,1262,1264,1266],{"class":166,"line":221},[164,1257,274],{"class":273},[164,1259,277],{"class":174},[164,1261,188],{"class":174},[164,1263,282],{"class":191},[164,1265,195],{"class":174},[164,1267,429],{"class":174},[164,1269,1270,1272,1274],{"class":166,"line":228},[164,1271,315],{"class":174},[164,1273,318],{"class":178},[164,1275,254],{"class":174},[164,1277,1278,1280,1283,1285],{"class":166,"line":257},[164,1279,1155],{"class":237},[164,1281,1282],{"class":273}," splitName",[164,1284,722],{"class":174},[164,1286,454],{"class":174},[164,1288,1289,1291],{"class":166,"line":270},[164,1290,1172],{"class":170},[164,1292,454],{"class":174},[164,1294,1295,1298,1300,1302,1304,1306,1309,1311,1313,1315,1318,1321,1324],{"class":166,"line":292},[164,1296,1297],{"class":273},"      firstName",[164,1299,277],{"class":174},[164,1301,1175],{"class":174},[164,1303,819],{"class":178},[164,1305,106],{"class":174},[164,1307,1308],{"class":248},"split",[164,1310,251],{"class":273},[164,1312,195],{"class":174},[164,1314,188],{"class":174},[164,1316,1317],{"class":273},")[",[164,1319,1320],{"class":562},"0",[164,1322,1323],{"class":273},"]",[164,1325,429],{"class":174},[164,1327,1328,1331,1333,1335,1337,1339,1341,1343,1345,1347,1349,1352,1354],{"class":166,"line":312},[164,1329,1330],{"class":273},"      lastName",[164,1332,277],{"class":174},[164,1334,1175],{"class":174},[164,1336,819],{"class":178},[164,1338,106],{"class":174},[164,1340,1308],{"class":248},[164,1342,251],{"class":273},[164,1344,195],{"class":174},[164,1346,188],{"class":174},[164,1348,1317],{"class":273},[164,1350,1351],{"class":562},"1",[164,1353,1323],{"class":273},[164,1355,429],{"class":174},[164,1357,1358],{"class":166,"line":466},[164,1359,1360],{"class":174},"    };\n",[164,1362,1363],{"class":166,"line":480},[164,1364,1190],{"class":174},[164,1366,1367],{"class":166,"line":486},[164,1368,1195],{"class":174},[80,1370,1372],{"id":1371},"model-functions","Model Functions",[631,1374,1376],{"id":1375},"basic-model-functions","Basic Model Functions",[85,1378,1379],{},"You can define your own functions on your models to handle common operations.",[85,1381,1382],{},"As an example, let's say we want to have a function to increment a counter on our model. We can define this function on our model like so:",[154,1384,1386],{"className":156,"code":1385,"language":159,"meta":160,"style":160},"export default class Pet extends defineModel({\n  // ...model config\n}) {\n  // increment a counter and save the model in a single call\n  incrementCounter() {\n    console.log(\"Incrementing counter for pet:\", this.attributes.name);\n    this.attributes.counter += 1;\n    return this.save();\n  }\n}\n",[118,1387,1388,1406,1411,1419,1424,1433,1467,1487,1499,1503],{"__ignoreMap":160},[164,1389,1390,1392,1394,1396,1398,1400,1402,1404],{"class":166,"line":167},[164,1391,231],{"class":170},[164,1393,234],{"class":170},[164,1395,238],{"class":237},[164,1397,522],{"class":241},[164,1399,245],{"class":237},[164,1401,179],{"class":248},[164,1403,251],{"class":178},[164,1405,254],{"class":174},[164,1407,1408],{"class":166,"line":201},[164,1409,1410],{"class":266},"  // ...model config\n",[164,1412,1413,1415,1417],{"class":166,"line":221},[164,1414,315],{"class":174},[164,1416,318],{"class":178},[164,1418,254],{"class":174},[164,1420,1421],{"class":166,"line":228},[164,1422,1423],{"class":266},"  // increment a counter and save the model in a single call\n",[164,1425,1426,1429,1431],{"class":166,"line":257},[164,1427,1428],{"class":273},"  incrementCounter",[164,1430,722],{"class":174},[164,1432,454],{"class":174},[164,1434,1435,1438,1440,1443,1445,1447,1450,1452,1454,1456,1459,1461,1463,1465],{"class":166,"line":270},[164,1436,1437],{"class":178},"    console",[164,1439,106],{"class":174},[164,1441,1442],{"class":248},"log",[164,1444,251],{"class":273},[164,1446,195],{"class":174},[164,1448,1449],{"class":191},"Incrementing counter for pet:",[164,1451,195],{"class":174},[164,1453,263],{"class":174},[164,1455,1175],{"class":174},[164,1457,1458],{"class":178},"attributes",[164,1460,106],{"class":174},[164,1462,819],{"class":178},[164,1464,709],{"class":273},[164,1466,198],{"class":174},[164,1468,1469,1472,1474,1476,1479,1482,1485],{"class":166,"line":292},[164,1470,1471],{"class":174},"    this.",[164,1473,1458],{"class":178},[164,1475,106],{"class":174},[164,1477,1478],{"class":178},"counter",[164,1480,1481],{"class":174}," +=",[164,1483,1484],{"class":562}," 1",[164,1486,198],{"class":174},[164,1488,1489,1491,1493,1495,1497],{"class":166,"line":312},[164,1490,1172],{"class":170},[164,1492,1175],{"class":174},[164,1494,835],{"class":248},[164,1496,722],{"class":273},[164,1498,198],{"class":174},[164,1500,1501],{"class":166,"line":466},[164,1502,1190],{"class":174},[164,1504,1505],{"class":166,"line":480},[164,1506,1195],{"class":174},[85,1508,1509],{},"And then that function can be called on the model instance directly.",[154,1511,1513],{"className":156,"code":1512,"language":159,"meta":160,"style":160},"const pet = await Pet.findOrFail(1);\nawait pet.incrementCounter(); // This function will increment the counter and save the model in a single call\n",[118,1514,1515,1542],{"__ignoreMap":160},[164,1516,1517,1519,1522,1524,1527,1529,1531,1534,1536,1538,1540],{"class":166,"line":167},[164,1518,750],{"class":237},[164,1520,1521],{"class":178}," pet ",[164,1523,756],{"class":174},[164,1525,1526],{"class":170}," await",[164,1528,522],{"class":178},[164,1530,106],{"class":174},[164,1532,1533],{"class":248},"findOrFail",[164,1535,251],{"class":178},[164,1537,1351],{"class":562},[164,1539,709],{"class":178},[164,1541,198],{"class":174},[164,1543,1544,1547,1549,1551,1554,1556,1558],{"class":166,"line":201},[164,1545,1546],{"class":170},"await",[164,1548,1215],{"class":178},[164,1550,106],{"class":174},[164,1552,1553],{"class":248},"incrementCounter",[164,1555,722],{"class":178},[164,1557,785],{"class":174},[164,1559,1560],{"class":266}," // This function will increment the counter and save the model in a single call\n",[631,1562,1564],{"id":1563},"type-safety-in-model-functions","Type Safety in Model Functions",[85,1566,1567,1568,1570],{},"Custom functions on a model that you write may require specific columns to have been selected. In the example above, the ",[118,1569,1553],{}," function wouldn't work if you hadn't selected the counter field when retrieving your model.",[85,1572,1573],{},"This can be resolved by adding requirements to your function so that it will only work on models which have been selected with the required fields.",[85,1575,328,1576,1579],{},[118,1577,1578],{},"RequireSelected"," utility type to specify that a function will require that certain fields are selected.",[154,1581,1584],{"className":156,"code":1582,"filename":1583,"language":159,"meta":160,"style":160},"import { defineModel, RequireSelected } from \"vasta-orm\";\n...\n\nexport default class Pet extends defineModel({\n// config ...\n  },\n}) {\n  // Restrict 'this' to require the 'counter' attribute\n  incrementCounter(this: RequireSelected\u003CPet, \"counter\">) {\n    this.attributes.counter += 1;\n  }\n\n  // Restrict 'this' to require BOTH 'counter' and 'id', since id is required to save the model back to the database\n  async incrementAndSave(this: RequireSelected\u003CPet, \"counter\" | \"id\">) {\n    this.incrementCounter(); // Valid, because we required \"counter\"\n    await this.save(); // Valid, because we required \"id\" (the primary key)\n  }\n\n  // This function will not show any type errors if you attempt to call this on a model without the required 'counter' field\n  incrementCounterWithoutSafety() {\n    this.attributes.counter += 1;\n  }\n}\n","Pet.ts",[118,1585,1586,1611,1616,1620,1638,1643,1647,1654,1659,1691,1707,1711,1715,1721,1763,1777,1794,1799,1804,1810,1820,1837,1842],{"__ignoreMap":160},[164,1587,1588,1590,1592,1594,1596,1599,1601,1603,1605,1607,1609],{"class":166,"line":167},[164,1589,171],{"class":170},[164,1591,175],{"class":174},[164,1593,179],{"class":178},[164,1595,263],{"class":174},[164,1597,1598],{"class":178}," RequireSelected",[164,1600,182],{"class":174},[164,1602,185],{"class":170},[164,1604,188],{"class":174},[164,1606,192],{"class":191},[164,1608,195],{"class":174},[164,1610,198],{"class":174},[164,1612,1613],{"class":166,"line":201},[164,1614,1615],{"class":174},"...\n",[164,1617,1618],{"class":166,"line":221},[164,1619,225],{"emptyLinePlaceholder":224},[164,1621,1622,1624,1626,1628,1630,1632,1634,1636],{"class":166,"line":228},[164,1623,231],{"class":170},[164,1625,234],{"class":170},[164,1627,238],{"class":237},[164,1629,522],{"class":241},[164,1631,245],{"class":237},[164,1633,179],{"class":248},[164,1635,251],{"class":178},[164,1637,254],{"class":174},[164,1639,1640],{"class":166,"line":257},[164,1641,1642],{"class":266},"// config ...\n",[164,1644,1645],{"class":166,"line":270},[164,1646,489],{"class":174},[164,1648,1649,1652],{"class":166,"line":292},[164,1650,1651],{"class":178},"}) ",[164,1653,254],{"class":174},[164,1655,1656],{"class":166,"line":312},[164,1657,1658],{"class":266},"  // Restrict 'this' to require the 'counter' attribute\n",[164,1660,1661,1663,1665,1668,1670,1672,1675,1678,1680,1682,1684,1686,1689],{"class":166,"line":466},[164,1662,1428],{"class":273},[164,1664,251],{"class":174},[164,1666,1667],{"class":170},"this",[164,1669,277],{"class":174},[164,1671,1598],{"class":241},[164,1673,1674],{"class":174},"\u003C",[164,1676,1677],{"class":241},"Pet",[164,1679,263],{"class":174},[164,1681,188],{"class":174},[164,1683,1478],{"class":191},[164,1685,195],{"class":174},[164,1687,1688],{"class":174},">)",[164,1690,454],{"class":174},[164,1692,1693,1695,1697,1699,1701,1703,1705],{"class":166,"line":480},[164,1694,1471],{"class":174},[164,1696,1458],{"class":178},[164,1698,106],{"class":174},[164,1700,1478],{"class":178},[164,1702,1481],{"class":174},[164,1704,1484],{"class":562},[164,1706,198],{"class":174},[164,1708,1709],{"class":166,"line":486},[164,1710,1190],{"class":174},[164,1712,1713],{"class":166,"line":492},[164,1714,225],{"emptyLinePlaceholder":224},[164,1716,1718],{"class":166,"line":1717},13,[164,1719,1720],{"class":266},"  // Restrict 'this' to require BOTH 'counter' and 'id', since id is required to save the model back to the database\n",[164,1722,1724,1727,1730,1732,1734,1736,1738,1740,1742,1744,1746,1748,1750,1753,1755,1757,1759,1761],{"class":166,"line":1723},14,[164,1725,1726],{"class":237},"  async",[164,1728,1729],{"class":273}," incrementAndSave",[164,1731,251],{"class":174},[164,1733,1667],{"class":170},[164,1735,277],{"class":174},[164,1737,1598],{"class":241},[164,1739,1674],{"class":174},[164,1741,1677],{"class":241},[164,1743,263],{"class":174},[164,1745,188],{"class":174},[164,1747,1478],{"class":191},[164,1749,195],{"class":174},[164,1751,1752],{"class":174}," |",[164,1754,188],{"class":174},[164,1756,302],{"class":191},[164,1758,195],{"class":174},[164,1760,1688],{"class":174},[164,1762,454],{"class":174},[164,1764,1766,1768,1770,1772,1774],{"class":166,"line":1765},15,[164,1767,1471],{"class":174},[164,1769,1553],{"class":248},[164,1771,722],{"class":273},[164,1773,785],{"class":174},[164,1775,1776],{"class":266}," // Valid, because we required \"counter\"\n",[164,1778,1780,1783,1785,1787,1789,1791],{"class":166,"line":1779},16,[164,1781,1782],{"class":170},"    await",[164,1784,1175],{"class":174},[164,1786,835],{"class":248},[164,1788,722],{"class":273},[164,1790,785],{"class":174},[164,1792,1793],{"class":266}," // Valid, because we required \"id\" (the primary key)\n",[164,1795,1797],{"class":166,"line":1796},17,[164,1798,1190],{"class":174},[164,1800,1802],{"class":166,"line":1801},18,[164,1803,225],{"emptyLinePlaceholder":224},[164,1805,1807],{"class":166,"line":1806},19,[164,1808,1809],{"class":266},"  // This function will not show any type errors if you attempt to call this on a model without the required 'counter' field\n",[164,1811,1813,1816,1818],{"class":166,"line":1812},20,[164,1814,1815],{"class":273},"  incrementCounterWithoutSafety",[164,1817,722],{"class":174},[164,1819,454],{"class":174},[164,1821,1823,1825,1827,1829,1831,1833,1835],{"class":166,"line":1822},21,[164,1824,1471],{"class":174},[164,1826,1458],{"class":178},[164,1828,106],{"class":174},[164,1830,1478],{"class":178},[164,1832,1481],{"class":174},[164,1834,1484],{"class":562},[164,1836,198],{"class":174},[164,1838,1840],{"class":166,"line":1839},22,[164,1841,1190],{"class":174},[164,1843,1845],{"class":166,"line":1844},23,[164,1846,1195],{"class":174},[1848,1849,1850,1853],"tip",{},[85,1851,1852],{},"If you're using RequireSelected frequently in a model and want to make a shortcut, you can write your own utility type to shorten the syntax!",[154,1854,1856],{"className":156,"code":1855,"language":159,"meta":160,"style":160},"type Requires\u003CK extends keyof Pet[\"attributes\"] & string> = RequireSelected\u003CPet, K>;\n// ...\nincrementCounter(this: Requires\u003C\"counter\">)\n",[118,1857,1858,1916,1921],{"__ignoreMap":160},[164,1859,1860,1863,1866,1868,1871,1873,1876,1878,1881,1883,1885,1887,1890,1893,1896,1899,1902,1904,1906,1908,1910,1913],{"class":166,"line":167},[164,1861,1862],{"class":237},"type",[164,1864,1865],{"class":241}," Requires",[164,1867,1674],{"class":174},[164,1869,1870],{"class":241},"K",[164,1872,245],{"class":237},[164,1874,1875],{"class":174}," keyof",[164,1877,522],{"class":241},[164,1879,1880],{"class":178},"[",[164,1882,195],{"class":174},[164,1884,1458],{"class":191},[164,1886,195],{"class":174},[164,1888,1889],{"class":178},"] ",[164,1891,1892],{"class":174},"&",[164,1894,1895],{"class":241}," string",[164,1897,1898],{"class":174},">",[164,1900,1901],{"class":174}," =",[164,1903,1598],{"class":241},[164,1905,1674],{"class":174},[164,1907,1677],{"class":241},[164,1909,263],{"class":174},[164,1911,1912],{"class":241}," K",[164,1914,1915],{"class":174},">;\n",[164,1917,1918],{"class":166,"line":201},[164,1919,1920],{"class":266},"// ...\n",[164,1922,1923,1925,1927,1929,1932,1934,1936,1938,1940,1942],{"class":166,"line":221},[164,1924,1553],{"class":248},[164,1926,251],{"class":178},[164,1928,1667],{"class":174},[164,1930,1931],{"class":178},": Requires",[164,1933,1674],{"class":174},[164,1935,195],{"class":174},[164,1937,1478],{"class":191},[164,1939,195],{"class":174},[164,1941,1898],{"class":174},[164,1943,1944],{"class":178},")\n",[85,1946,1947],{},"Here's an example of how this would work:",[154,1949,1952],{"className":156,"code":1950,"filename":1951,"language":159,"meta":160,"style":160},"// We haven't selected the counter field\nconst pet = await Pet.select([\"name\"]).where(\"name\", \"Zuko\").firstOrFail();\n\n// This will show a type error because the counter field was not selected and it is required for this function\npet.incrementCounter();\n\n// This will not show a type error because there are no columns specified as required\npet.incrementCounterWithoutSafety();\n\n// Select the pet with the 'counter' field\nconst goodPet = await Pet.select([\"name\", \"counter\"]).where(\"name\", \"Zuko\").firstOrFail();\n\n// This will not show a type error because we have the required fields.\ngoodPet.incrementCounter();\n","index.ts",[118,1953,1954,1959,2021,2025,2030,2043,2047,2052,2065,2069,2074,2139,2143,2148],{"__ignoreMap":160},[164,1955,1956],{"class":166,"line":167},[164,1957,1958],{"class":266},"// We haven't selected the counter field\n",[164,1960,1961,1963,1965,1967,1969,1971,1973,1976,1979,1981,1983,1985,1988,1990,1993,1995,1997,1999,2001,2003,2005,2008,2010,2012,2014,2017,2019],{"class":166,"line":201},[164,1962,750],{"class":237},[164,1964,1521],{"class":178},[164,1966,756],{"class":174},[164,1968,1526],{"class":170},[164,1970,522],{"class":178},[164,1972,106],{"class":174},[164,1974,1975],{"class":248},"select",[164,1977,1978],{"class":178},"([",[164,1980,195],{"class":174},[164,1982,819],{"class":191},[164,1984,195],{"class":174},[164,1986,1987],{"class":178},"])",[164,1989,106],{"class":174},[164,1991,1992],{"class":248},"where",[164,1994,251],{"class":178},[164,1996,195],{"class":174},[164,1998,819],{"class":191},[164,2000,195],{"class":174},[164,2002,263],{"class":174},[164,2004,188],{"class":174},[164,2006,2007],{"class":191},"Zuko",[164,2009,195],{"class":174},[164,2011,709],{"class":178},[164,2013,106],{"class":174},[164,2015,2016],{"class":248},"firstOrFail",[164,2018,722],{"class":178},[164,2020,198],{"class":174},[164,2022,2023],{"class":166,"line":221},[164,2024,225],{"emptyLinePlaceholder":224},[164,2026,2027],{"class":166,"line":228},[164,2028,2029],{"class":266},"// This will show a type error because the counter field was not selected and it is required for this function\n",[164,2031,2032,2035,2037,2039,2041],{"class":166,"line":257},[164,2033,2034],{"class":178},"pet",[164,2036,106],{"class":174},[164,2038,1553],{"class":248},[164,2040,722],{"class":178},[164,2042,198],{"class":174},[164,2044,2045],{"class":166,"line":270},[164,2046,225],{"emptyLinePlaceholder":224},[164,2048,2049],{"class":166,"line":292},[164,2050,2051],{"class":266},"// This will not show a type error because there are no columns specified as required\n",[164,2053,2054,2056,2058,2061,2063],{"class":166,"line":312},[164,2055,2034],{"class":178},[164,2057,106],{"class":174},[164,2059,2060],{"class":248},"incrementCounterWithoutSafety",[164,2062,722],{"class":178},[164,2064,198],{"class":174},[164,2066,2067],{"class":166,"line":466},[164,2068,225],{"emptyLinePlaceholder":224},[164,2070,2071],{"class":166,"line":480},[164,2072,2073],{"class":266},"// Select the pet with the 'counter' field\n",[164,2075,2076,2078,2081,2083,2085,2087,2089,2091,2093,2095,2097,2099,2101,2103,2105,2107,2109,2111,2113,2115,2117,2119,2121,2123,2125,2127,2129,2131,2133,2135,2137],{"class":166,"line":486},[164,2077,750],{"class":237},[164,2079,2080],{"class":178}," goodPet ",[164,2082,756],{"class":174},[164,2084,1526],{"class":170},[164,2086,522],{"class":178},[164,2088,106],{"class":174},[164,2090,1975],{"class":248},[164,2092,1978],{"class":178},[164,2094,195],{"class":174},[164,2096,819],{"class":191},[164,2098,195],{"class":174},[164,2100,263],{"class":174},[164,2102,188],{"class":174},[164,2104,1478],{"class":191},[164,2106,195],{"class":174},[164,2108,1987],{"class":178},[164,2110,106],{"class":174},[164,2112,1992],{"class":248},[164,2114,251],{"class":178},[164,2116,195],{"class":174},[164,2118,819],{"class":191},[164,2120,195],{"class":174},[164,2122,263],{"class":174},[164,2124,188],{"class":174},[164,2126,2007],{"class":191},[164,2128,195],{"class":174},[164,2130,709],{"class":178},[164,2132,106],{"class":174},[164,2134,2016],{"class":248},[164,2136,722],{"class":178},[164,2138,198],{"class":174},[164,2140,2141],{"class":166,"line":492},[164,2142,225],{"emptyLinePlaceholder":224},[164,2144,2145],{"class":166,"line":1717},[164,2146,2147],{"class":266},"// This will not show a type error because we have the required fields.\n",[164,2149,2150,2153,2155,2157,2159],{"class":166,"line":1723},[164,2151,2152],{"class":178},"goodPet",[164,2154,106],{"class":174},[164,2156,1553],{"class":248},[164,2158,722],{"class":178},[164,2160,198],{"class":174},[2162,2163,2164],"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 .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 .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 pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}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}",{"title":160,"searchDepth":201,"depth":201,"links":2166},[2167,2168,2169,2170,2171,2175,2176],{"id":82,"depth":201,"text":83},{"id":112,"depth":201,"text":113},{"id":324,"depth":201,"text":325},{"id":501,"depth":201,"text":502},{"id":622,"depth":201,"text":623,"children":2172},[2173,2174],{"id":633,"depth":221,"text":634},{"id":876,"depth":221,"text":877},{"id":1097,"depth":201,"text":1098},{"id":1371,"depth":201,"text":1372,"children":2177},[2178,2179],{"id":1375,"depth":221,"text":1376},{"id":1563,"depth":221,"text":1564},"Building models with Vasta.","md",null,{},{"icon":29},{"description":2186,"title":15},"Get started with Vasta ORM for Node.js.","x3KPtpK20aD5vcz4OPzoytdf3Oa93GAtmeSW40iFLmI",[2189,2191],{"title":15,"path":16,"stem":17,"description":2190,"icon":18,"children":-1},"Get started with Vasta.",{"title":31,"path":32,"stem":33,"description":2192,"icon":34,"children":-1},"Retrieving models with Vasta.",1784320847711]