{"version":3,"file":"relation-table.mjs","names":[],"sources":["../../../../../src/libs/collection/custom-fields/storage/relation-table.ts"],"sourcesContent":["import type { RelationTableModeDefinition } from \"./types.js\";\n\nexport const relationTableSchemaColumns = {\n\tparentId: \"parent_id\",\n} as const;\n\nexport const relationTableMode: RelationTableModeDefinition = {\n\tmode: \"relation-table\",\n\tbaseTablePriority: 300,\n\tgetSchemaDefinition: (props) => {\n\t\treturn {\n\t\t\tcolumns: [\n\t\t\t\t{\n\t\t\t\t\tname: relationTableSchemaColumns.parentId,\n\t\t\t\t\ttype: props.db.getDataType(\"integer\"),\n\t\t\t\t\tnullable: false,\n\t\t\t\t\tforeignKey: {\n\t\t\t\t\t\ttable: props.table.parent,\n\t\t\t\t\t\tcolumn: \"id\",\n\t\t\t\t\t\tonDelete: \"cascade\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t},\n\tgetTableFieldPath: (props) => {\n\t\treturn [props.fieldKey];\n\t},\n\tclientTypeGen: (props) => ({\n\t\tfieldType:\n\t\t\tprops.fieldType ??\n\t\t\tprops.helpers.renderBaseFieldType({\n\t\t\t\tfield: props.field,\n\t\t\t\tmode: props.fieldMode,\n\t\t\t\tvalueType: props.valueType,\n\t\t\t\thasGroupRef: props.hasGroupRef,\n\t\t\t}),\n\t\tdeclarations: props.declarations ?? [],\n\t}),\n};\n"],"mappings":"AAEA,MAAa,EAA6B,CACzC,SAAU,WACX,EAEa,EAAiD,CAC7D,KAAM,iBACN,kBAAmB,IACnB,oBAAsB,IACd,CACN,QAAS,CACR,CACC,KAAM,EAA2B,SACjC,KAAM,EAAM,GAAG,YAAY,SAAS,EACpC,SAAU,GACV,WAAY,CACX,MAAO,EAAM,MAAM,OACnB,OAAQ,KACR,SAAU,SACX,CACD,CACD,CACD,GAED,kBAAoB,GACZ,CAAC,EAAM,QAAQ,EAEvB,cAAgB,IAAW,CAC1B,UACC,EAAM,WACN,EAAM,QAAQ,oBAAoB,CACjC,MAAO,EAAM,MACb,KAAM,EAAM,UACZ,UAAW,EAAM,UACjB,YAAa,EAAM,WACpB,CAAC,EACF,aAAc,EAAM,cAAgB,CAAC,CACtC,EACD"}