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