{"version":3,"file":"column-types.mjs","names":[],"sources":["../src/exports/column-types.ts"],"sourcesContent":["/**\n * Column type descriptors for the PostGIS extension.\n *\n * Use `geometryColumn` for an untyped `geometry` column, or\n * `geometry({ srid })` to declare an SRID-constrained column whose DDL\n * comes out as `geometry(Geometry, <srid>)`.\n */\n\nimport type { ColumnTypeDescriptor } from '@prisma-next/framework-components/codec';\nimport { POSTGIS_GEOMETRY_CODEC_ID } from '../core/constants';\n\nexport const geometryColumn = {\n  codecId: POSTGIS_GEOMETRY_CODEC_ID,\n  nativeType: 'geometry',\n} as const satisfies ColumnTypeDescriptor;\n\n/**\n * Build an SRID-constrained geometry column descriptor.\n *\n * @example\n *   .column('location', { type: geometry({ srid: 4326 }), nullable: false })\n *   // Produces: nativeType: 'geometry', typeParams: { srid: 4326 }\n *\n * @throws {RangeError} If `srid` is not a non-negative integer.\n */\nexport function geometry<S extends number>(options: {\n  readonly srid: S;\n}): ColumnTypeDescriptor & { readonly typeParams: { readonly srid: S } } {\n  const { srid } = options;\n  if (!Number.isInteger(srid) || srid < 0) {\n    throw new RangeError(`postgis: srid must be a non-negative integer, got ${srid}`);\n  }\n  return {\n    codecId: POSTGIS_GEOMETRY_CODEC_ID,\n    nativeType: 'geometry',\n    typeParams: { srid },\n  } as const;\n}\n"],"mappings":";;AAWA,MAAa,iBAAiB;CAC5B,SAAS;CACT,YAAY;AACd;;;;;;;;;;AAWA,SAAgB,SAA2B,SAE8B;CACvE,MAAM,EAAE,SAAS;CACjB,IAAI,CAAC,OAAO,UAAU,IAAI,KAAK,OAAO,GACpC,MAAM,IAAI,WAAW,qDAAqD,MAAM;CAElF,OAAO;EACL,SAAS;EACT,YAAY;EACZ,YAAY,EAAE,KAAK;CACrB;AACF"}