@prisma/orm-extension-postgis 8.0.0-rc.2-dev.2 → 8.0.0-rc.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @prisma/orm-extension-postgis
2
2
 
3
- Geospatial columns, operators, and indexes for Prisma Next on PostgreSQL, powered by [PostGIS](https://postgis.net).
3
+ Geospatial columns, operators, and indexes for Prisma 8 on PostgreSQL, powered by [PostGIS](https://postgis.net).
4
4
 
5
5
  ```bash
6
6
  pnpm add @prisma/orm-extension-postgis
@@ -21,12 +21,6 @@ Model points, lines, and polygons as first-class columns, query them with a type
21
21
 
22
22
  ## Responsibilities
23
23
 
24
- Geometry storage and query semantics: the `geometry` column type and its SRID parameter, GeoJSON-shaped runtime values, seven query operations (`distance`, `distanceSphere`, `dwithin`, `contains`, `within`, `intersects`, `intersectsBbox`), and the database-dependency declaration that makes `prisma-next db init` enable PostGIS before the first migration runs. Works with both PSL and TypeScript contract authoring.
24
+ Geometry storage and query semantics: the `geometry` column type and its SRID parameter, GeoJSON-shaped runtime values, seven query operations (`distance`, `distanceSphere`, `dwithin`, `contains`, `within`, `intersects`, `intersectsBbox`), and the database-dependency declaration that makes `prisma db init` enable PostGIS before the first migration runs. Works with both PSL and TypeScript contract authoring.
25
25
 
26
26
  The PostGIS server extension must be installable on your PostgreSQL server. Most managed providers include it; locally, the `postgis/postgis` Docker image is the shortest route.
27
-
28
- ## Dependencies
29
-
30
- `@prisma/orm-framework`, `@prisma/orm-family-sql`, and `@prisma/orm-toolchain` at exact lockstep versions, plus `arktype` and `@standard-schema/spec`.
31
-
32
- `@prisma/orm-target-postgres` is an exact-pinned **peer** dependency: the application supplies it, directly or through a facade, and everyone shares that one copy. A hard dependency would let an application upgrade the facade without upgrading this pack and end up with two target copies whose codec and operation registries have quietly diverged; as a peer that combination fails to install instead.
@@ -1,32 +1,29 @@
1
1
  import { t as Geometry$1 } from "./geojson-L3qRlIZY-DLhY3CUa.mjs";
2
- import { AnyCodecDescriptor, CodecCallContext, CodecImpl, CodecInstanceContext } from "@prisma/orm-framework/components/codec";
3
- import { PostgresCodecDescriptor } from "@prisma/orm-target-postgres/target/codec-descriptor";
4
- import { JsonValue } from "@prisma/orm-framework/contract/types";
2
+ import { t as POSTGIS_GEOMETRY_CODEC_ID } from "./constants-BBTF6Gw--B94FQPoj.mjs";
3
+ import { AnyCodecDescriptor, CodecCallContext, CodecImpl, CodecInstanceContext, DataTypeValue } from "@prisma/orm-framework/components/codec";
5
4
  import { ExtractCodecTypes, ProjectionExpr } from "@prisma/orm-family-sql/relational-core/ast";
5
+ import { PostgresCodecDescriptor } from "@prisma/orm-target-postgres/target/codec-descriptor";
6
6
  import { StandardSchemaV1 } from "@standard-schema/spec";
7
- //#region ../../../3-extensions/postgis/dist/codec-types-M7J4vkfS.d.mts
8
- //#region src/core/constants.d.ts
9
- declare const POSTGIS_GEOMETRY_CODEC_ID: "pg/geometry@1";
10
- //#endregion
7
+ //#region ../../../3-extensions/postgis/dist/codec-types-z7Np9YhQ.d.mts
11
8
  //#region src/core/codecs.d.ts
12
9
  type GeometryParams = {
13
10
  readonly srid?: number;
14
11
  };
15
12
  declare class PostgisGeometryCodec extends CodecImpl<typeof POSTGIS_GEOMETRY_CODEC_ID, readonly ['equality'], string, Geometry$1> {
16
- constructor(descriptor: AnyCodecDescriptor);
17
- encode(value: Geometry$1, _ctx: CodecCallContext): Promise<string>;
18
- decode(wire: string, _ctx: CodecCallContext): Promise<Geometry$1>;
19
- encodeJson(value: Geometry$1): JsonValue;
20
- decodeJson(json: JsonValue): Geometry$1;
13
+ constructor(descriptor: AnyCodecDescriptor, params: GeometryParams);
14
+ toWire(value: Geometry$1, _ctx: CodecCallContext): Promise<string>;
15
+ fromWire(wire: string, _ctx: CodecCallContext): Promise<Geometry$1>;
16
+ fromDataTypeValue(value: DataTypeValue<string>): Geometry$1;
17
+ toDataTypeValue(input: Geometry$1): DataTypeValue;
21
18
  }
22
19
  declare class PostgisGeometryDescriptor extends PostgresCodecDescriptor<GeometryParams> {
23
- protected nativeType(): string;
20
+ /** The HEXEWKB text PostgreSQL prints for a geometry, which `fromWire` reads as it reads a row. A JSON constructor handed the geometry itself may write GeoJSON instead. */
24
21
  protected jsonProjection(expression: ProjectionExpr): ProjectionExpr;
22
+ readonly dataType: import("@prisma/orm-framework/components/codec").DataTypeId;
25
23
  readonly codecId: "pg/geometry@1";
26
24
  readonly traits: readonly ["equality"];
27
- readonly targetTypes: readonly ["geometry"];
25
+ readonly enumRefusal = "Enums over a geometry codec are not supported yet, because no test proves that a shape reads back as its member. Use a text enum that names each shape instead.";
28
26
  readonly paramsSchema: StandardSchemaV1<GeometryParams>;
29
- renderOutputType(params: GeometryParams): string;
30
27
  /**
31
28
  * Runtime materialization uses an empty parameter object for the
32
29
  * existing unparameterized `geometryColumn` variant and `{ srid }` for
@@ -34,7 +31,7 @@ declare class PostgisGeometryDescriptor extends PostgresCodecDescriptor<Geometry
34
31
  * the wire format already carries SRID inside the EWKT/EWKB payload,
35
32
  * so codec behavior is parameter-independent.
36
33
  */
37
- factory(_params: GeometryParams): (ctx: CodecInstanceContext) => PostgisGeometryCodec;
34
+ factory(params: GeometryParams): (ctx: CodecInstanceContext) => PostgisGeometryCodec;
38
35
  }
39
36
  declare const codecDescriptorMap: {
40
37
  readonly geometry: PostgisGeometryDescriptor;
@@ -46,4 +43,4 @@ type Geometry<_Srid extends number = number> = Geometry$1;
46
43
  type CodecTypes = CodecTypes$1;
47
44
  //#endregion
48
45
  export { Geometry as n, CodecTypes as t };
49
- //# sourceMappingURL=codec-types-M7J4vkfS-DOzWmEmw.d.mts.map
46
+ //# sourceMappingURL=codec-types-z7Np9YhQ-Bu0aHOzI.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-types-z7Np9YhQ-Bu0aHOzI.d.mts","names":[],"sources":["../../../../3-extensions/postgis/dist/codec-types-z7Np9YhQ.d.mts"],"mappings":";;;;;;;;KAOK;WACM;;cAEG,6BAA6B,iBAAiB,0DAA0D;EACpH,YAAY,YAAY,oBAAoB,QAAQ;EACpD,OAAO,OAAO,YAAY,MAAM,mBAAmB;EACnD,SAAS,cAAc,MAAM,mBAAmB,QAAQ;EACxD,kBAAkB,OAAO,wBAAwB;EACjD,gBAAgB,OAAO,aAAa;;cAExB,kCAAkC,wBAAwB;;YAE5D,eAAe,YAAY,iBAAiB;WAC7C,yDAAyD;WACzD;WACA;WACA;WACA,cAAc,iBAAiB;;;;;;;;EAQxC,QAAQ,QAAQ,kBAAkB,KAAK,yBAAyB;;cAEpD;WACH,UAAU;;KAEhB,eAAe,yBAAyB;;;KAGxC,SAAS,iCAAiC;KAC1C,aAAa"}
@@ -1,2 +1,3 @@
1
- import { n as Geometry, t as CodecTypes } from "./codec-types-M7J4vkfS-DOzWmEmw.mjs";
2
- export type { CodecTypes, Geometry };
1
+ import { t as Geometry$1 } from "./geojson-L3qRlIZY-DLhY3CUa.mjs";
2
+ import { n as Geometry, t as CodecTypes } from "./codec-types-z7Np9YhQ-Bu0aHOzI.mjs";
3
+ export type { CodecTypes, Geometry, Geometry$1 as GeometryValue };
@@ -1,23 +1,20 @@
1
+ import { t as POSTGIS_GEOMETRY_CODEC_ID } from "./constants-BBTF6Gw--B94FQPoj.mjs";
1
2
  import { ColumnTypeDescriptor } from "@prisma/orm-framework/components/codec";
2
3
  //#region ../../../3-extensions/postgis/dist/column-types.d.mts
3
4
  //#region src/exports/column-types.d.ts
4
5
  declare const geometryColumn: {
5
6
  readonly codecId: "pg/geometry@1";
6
- readonly nativeType: "geometry";
7
7
  };
8
8
  /**
9
9
  * Build an SRID-constrained geometry column descriptor.
10
10
  *
11
11
  * @example
12
12
  * .column('location', { type: geometry({ srid: 4326 }), nullable: false })
13
- * // Produces: nativeType: 'geometry', typeParams: { srid: 4326 }
14
- *
15
- * @throws If `srid` is not a non-negative integer
16
- * (structured `CONTRACT.ARGUMENT_INVALID`).
13
+ * // Produces: codecId: 'pg/geometry@1', typeParams: { srid: 4326 }
17
14
  */
18
15
  declare function geometry<S extends number>(options: {
19
16
  readonly srid: S;
20
- }): ColumnTypeDescriptor & {
17
+ }): ColumnTypeDescriptor<typeof POSTGIS_GEOMETRY_CODEC_ID> & {
21
18
  readonly typeParams: {
22
19
  readonly srid: S;
23
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"column-types.d.mts","names":[],"sources":["../../../../3-extensions/postgis/dist/column-types.d.mts"],"mappings":";;;cAEc;WACH;WACA;;;;;;;;;;;;iBAYM,SAAS,kBAAkB;WACjC,MAAM;IACb;WACO;aACE,MAAM"}
1
+ {"version":3,"file":"column-types.d.mts","names":[],"sources":["../../../../3-extensions/postgis/dist/column-types.d.mts"],"mappings":";;;;cAGc;WACH;;;;;;;;;iBASM,SAAS,kBAAkB;WACjC,MAAM;IACb,4BAA4B;WACrB;aACE,MAAM"}
@@ -1,30 +1,17 @@
1
1
  import { t as POSTGIS_GEOMETRY_CODEC_ID } from "./constants-CWW72xGt-hJye3Dua.mjs";
2
- import { t as postgisError } from "./errors-Bg6kDFR--BUzKMn1A.mjs";
3
2
  //#region ../../../3-extensions/postgis/dist/column-types.mjs
4
- const geometryColumn = {
5
- codecId: POSTGIS_GEOMETRY_CODEC_ID,
6
- nativeType: "geometry"
7
- };
3
+ const geometryColumn = { codecId: POSTGIS_GEOMETRY_CODEC_ID };
8
4
  /**
9
5
  * Build an SRID-constrained geometry column descriptor.
10
6
  *
11
7
  * @example
12
8
  * .column('location', { type: geometry({ srid: 4326 }), nullable: false })
13
- * // Produces: nativeType: 'geometry', typeParams: { srid: 4326 }
14
- *
15
- * @throws If `srid` is not a non-negative integer
16
- * (structured `CONTRACT.ARGUMENT_INVALID`).
9
+ * // Produces: codecId: 'pg/geometry@1', typeParams: { srid: 4326 }
17
10
  */
18
11
  function geometry(options) {
19
12
  const { srid } = options;
20
- if (!Number.isInteger(srid) || srid < 0) throw postgisError("CONTRACT.ARGUMENT_INVALID", `postgis: srid must be a non-negative integer, got ${srid}`, { meta: {
21
- helperPath: "geometry",
22
- expected: "non-negative integer",
23
- received: srid
24
- } });
25
13
  return {
26
14
  codecId: POSTGIS_GEOMETRY_CODEC_ID,
27
- nativeType: "geometry",
28
15
  typeParams: { srid }
29
16
  };
30
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"column-types.mjs","names":[],"sources":["../../../../3-extensions/postgis/dist/column-types.mjs"],"sourcesContent":["import { t as POSTGIS_GEOMETRY_CODEC_ID } from \"./constants-CWW72xGt.mjs\";\nimport { t as postgisError } from \"./errors-Bg6kDFR-.mjs\";\n//#region src/exports/column-types.ts\nconst geometryColumn = {\n\tcodecId: POSTGIS_GEOMETRY_CODEC_ID,\n\tnativeType: \"geometry\"\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 If `srid` is not a non-negative integer\n* (structured `CONTRACT.ARGUMENT_INVALID`).\n*/\nfunction geometry(options) {\n\tconst { srid } = options;\n\tif (!Number.isInteger(srid) || srid < 0) throw postgisError(\"CONTRACT.ARGUMENT_INVALID\", `postgis: srid must be a non-negative integer, got ${srid}`, { meta: {\n\t\thelperPath: \"geometry\",\n\t\texpected: \"non-negative integer\",\n\t\treceived: srid\n\t} });\n\treturn {\n\t\tcodecId: POSTGIS_GEOMETRY_CODEC_ID,\n\t\tnativeType: \"geometry\",\n\t\ttypeParams: { srid }\n\t};\n}\n//#endregion\nexport { geometry, geometryColumn };\n\n//# sourceMappingURL=column-types.mjs.map"],"mappings":";;;AAGA,MAAM,iBAAiB;CACtB,SAAS;CACT,YAAY;AACb;;;;;;;;;;;AAWA,SAAS,SAAS,SAAS;CAC1B,MAAM,EAAE,SAAS;CACjB,IAAI,CAAC,OAAO,UAAU,IAAI,KAAK,OAAO,GAAG,MAAM,aAAa,6BAA6B,qDAAqD,QAAQ,EAAE,MAAM;EAC7J,YAAY;EACZ,UAAU;EACV,UAAU;CACX,EAAE,CAAC;CACH,OAAO;EACN,SAAS;EACT,YAAY;EACZ,YAAY,EAAE,KAAK;CACpB;AACD"}
1
+ {"version":3,"file":"column-types.mjs","names":[],"sources":["../../../../3-extensions/postgis/dist/column-types.mjs"],"sourcesContent":["import { t as POSTGIS_GEOMETRY_CODEC_ID } from \"./constants-CWW72xGt.mjs\";\n//#region src/exports/column-types.ts\nconst geometryColumn = { codecId: POSTGIS_GEOMETRY_CODEC_ID };\n/**\n* Build an SRID-constrained geometry column descriptor.\n*\n* @example\n* .column('location', { type: geometry({ srid: 4326 }), nullable: false })\n* // Produces: codecId: 'pg/geometry@1', typeParams: { srid: 4326 }\n*/\nfunction geometry(options) {\n\tconst { srid } = options;\n\treturn {\n\t\tcodecId: POSTGIS_GEOMETRY_CODEC_ID,\n\t\ttypeParams: { srid }\n\t};\n}\n//#endregion\nexport { geometry, geometryColumn };\n\n//# sourceMappingURL=column-types.mjs.map"],"mappings":";;AAEA,MAAM,iBAAiB,EAAE,SAAS,0BAA0B;;;;;;;;AAQ5D,SAAS,SAAS,SAAS;CAC1B,MAAM,EAAE,SAAS;CACjB,OAAO;EACN,SAAS;EACT,YAAY,EAAE,KAAK;CACpB;AACD"}
@@ -0,0 +1,6 @@
1
+ //#region ../../../3-extensions/postgis/dist/constants-BBTF6Gw-.d.mts
2
+ //#region src/core/constants.d.ts
3
+ declare const POSTGIS_GEOMETRY_CODEC_ID: "pg/geometry@1";
4
+ //#endregion
5
+ export { POSTGIS_GEOMETRY_CODEC_ID as t };
6
+ //# sourceMappingURL=constants-BBTF6Gw--B94FQPoj.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants-BBTF6Gw--B94FQPoj.d.mts","names":[],"sources":["../../../../3-extensions/postgis/dist/constants-BBTF6Gw-.d.mts"],"mappings":";;cACc"}
package/dist/control.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import { t as POSTGIS_GEOMETRY_CODEC_ID } from "./constants-CWW72xGt-hJye3Dua.mjs";
2
- import { n as postgisPackMeta, r as postgisQueryOperations } from "./descriptor-meta-deM0Qc_b-FRxKhllA.mjs";
2
+ import { n as postgisPackMeta, r as postgisQueryOperations } from "./descriptor-meta-CtaX_u3u-DVoekCn0.mjs";
3
3
  import { contractSpaceFromJson } from "@prisma/orm-toolchain/migration-tools/spaces";
4
4
  //#region ../../../3-extensions/postgis/dist/control.mjs
5
5
  var migration_default = {
6
6
  from: null,
7
- to: "7e98a4d9437e6be2f2fa7fca02fbc01c245586997a937f97cab60788612512e5",
7
+ to: "2db551a8a5619d0d97710f29130eaea0eccbdd5238f015ee9d18408d438e0f8a",
8
8
  providedInvariants: ["postgis:install-postgis-v1"],
9
9
  createdAt: "2026-06-01T00:00:00.000Z",
10
- migrationHash: "f91b562a2f1a82f299a3690c001027729607c631c9b2d847aa3f6162539f0eff"
10
+ migrationHash: "5dd437b3077585a4e39b1be8ebc30b699e75c4ff30c5ee4177659e0d0de948bd"
11
11
  };
12
12
  var ops_default = [{
13
13
  "id": "postgis.install-postgis-extension",
@@ -38,7 +38,7 @@ var ops_default = [{
38
38
  }]
39
39
  }];
40
40
  var head_default = {
41
- hash: "7e98a4d9437e6be2f2fa7fca02fbc01c245586997a937f97cab60788612512e5",
41
+ hash: "2db551a8a5619d0d97710f29130eaea0eccbdd5238f015ee9d18408d438e0f8a",
42
42
  invariants: ["postgis:install-postgis-v1"]
43
43
  };
44
44
  var contract_default = {
@@ -54,16 +54,18 @@ var contract_default = {
54
54
  "id": "public",
55
55
  "kind": "postgres-schema"
56
56
  } },
57
- "storageHash": "7e98a4d9437e6be2f2fa7fca02fbc01c245586997a937f97cab60788612512e5",
57
+ "storageHash": "2db551a8a5619d0d97710f29130eaea0eccbdd5238f015ee9d18408d438e0f8a",
58
58
  "types": { "geometry": {
59
59
  "codecId": "pg/geometry@1",
60
- "kind": "codec-instance",
61
- "nativeType": "geometry"
60
+ "dataType": "postgis/geometry",
61
+ "kind": "codec-instance"
62
62
  } }
63
63
  },
64
64
  capabilities: {
65
65
  "postgres": {
66
66
  "distinctOn": true,
67
+ "forKeyShare": true,
68
+ "forNoKeyUpdate": true,
67
69
  "jsonAgg": true,
68
70
  "lateral": true,
69
71
  "limit": true,
@@ -74,7 +76,14 @@ var contract_default = {
74
76
  "checkConstraint": true,
75
77
  "defaultInInsert": true,
76
78
  "enums": true,
79
+ "forShare": true,
80
+ "forUpdate": true,
81
+ "insertOnConflictSkip": true,
82
+ "insertOnConflictWithoutTarget": true,
77
83
  "lateral": true,
84
+ "lockNowait": true,
85
+ "lockOf": true,
86
+ "lockSkipLocked": true,
78
87
  "returning": true,
79
88
  "scalarList": true
80
89
  }
@@ -83,8 +92,8 @@ var contract_default = {
83
92
  meta: {},
84
93
  _generated: {
85
94
  "warning": "⚠️ GENERATED FILE - DO NOT EDIT",
86
- "message": "This file is automatically generated by \"prisma-next contract emit\".",
87
- "regenerate": "To regenerate, run: prisma-next contract emit"
95
+ "message": "This file is automatically generated by \"prisma contract emit\".",
96
+ "regenerate": "To regenerate, run: prisma contract emit"
88
97
  }
89
98
  };
90
99
  /**
@@ -104,14 +113,7 @@ var contract_default = {
104
113
  */
105
114
  const POSTGIS_SPACE_ID = "postgis";
106
115
  const POSTGIS_BASELINE_MIGRATION_NAME = "20260601T0000_install_postgis_extension";
107
- const geometryControlPlaneHooks = {
108
- expandNativeType: ({ nativeType, typeParams }) => {
109
- const srid = typeParams?.["srid"];
110
- if (typeof srid === "number" && Number.isInteger(srid) && srid >= 0) return `${nativeType}(Geometry,${srid})`;
111
- return nativeType;
112
- },
113
- resolveIdentityValue: () => null
114
- };
116
+ const geometryControlPlaneHooks = { resolveIdentityValue: () => null };
115
117
  const postgisContractSpace = contractSpaceFromJson({
116
118
  contractJson: contract_default,
117
119
  migrations: [{
@@ -1 +1 @@
1
- {"version":3,"file":"control.mjs","names":[],"sources":["../../../../3-extensions/postgis/dist/control.mjs"],"sourcesContent":["import { t as POSTGIS_GEOMETRY_CODEC_ID } from \"./constants-CWW72xGt.mjs\";\nimport { n as postgisQueryOperations, t as postgisPackMeta } from \"./descriptor-meta-deM0Qc_b.mjs\";\nimport { contractSpaceFromJson } from \"@internal/migration-tools/spaces\";\n//#region migrations/20260601T0000_install_postgis_extension/migration.json\nvar migration_default = {\n\tfrom: null,\n\tto: \"7e98a4d9437e6be2f2fa7fca02fbc01c245586997a937f97cab60788612512e5\",\n\tprovidedInvariants: [\"postgis:install-postgis-v1\"],\n\tcreatedAt: \"2026-06-01T00:00:00.000Z\",\n\tmigrationHash: \"f91b562a2f1a82f299a3690c001027729607c631c9b2d847aa3f6162539f0eff\"\n};\n//#endregion\n//#region migrations/20260601T0000_install_postgis_extension/ops.json\nvar ops_default = [{\n\t\"id\": \"postgis.install-postgis-extension\",\n\t\"label\": \"Enable extension \\\"postgis\\\"\",\n\t\"operationClass\": \"additive\",\n\t\"invariantId\": \"postgis:install-postgis-v1\",\n\t\"target\": {\n\t\t\"id\": \"postgres\",\n\t\t\"details\": {\n\t\t\t\"schema\": \"public\",\n\t\t\t\"objectType\": \"dependency\",\n\t\t\t\"name\": \"postgis\"\n\t\t}\n\t},\n\t\"precheck\": [{\n\t\t\"description\": \"verify extension \\\"postgis\\\" is not already enabled\",\n\t\t\"sql\": \"SELECT NOT EXISTS (SELECT 1 AS \\\"one\\\" FROM \\\"pg_extension\\\" WHERE \\\"extname\\\" = $1) AS \\\"result\\\"\",\n\t\t\"params\": [\"postgis\"]\n\t}],\n\t\"execute\": [{\n\t\t\"description\": \"create extension \\\"postgis\\\"\",\n\t\t\"sql\": \"CREATE EXTENSION IF NOT EXISTS postgis\"\n\t}],\n\t\"postcheck\": [{\n\t\t\"description\": \"confirm extension \\\"postgis\\\" is enabled\",\n\t\t\"sql\": \"SELECT EXISTS (SELECT 1 AS \\\"one\\\" FROM \\\"pg_extension\\\" WHERE \\\"extname\\\" = $1) AS \\\"result\\\"\",\n\t\t\"params\": [\"postgis\"]\n\t}]\n}];\n//#endregion\n//#region migrations/refs/head.json\nvar head_default = {\n\thash: \"7e98a4d9437e6be2f2fa7fca02fbc01c245586997a937f97cab60788612512e5\",\n\tinvariants: [\"postgis:install-postgis-v1\"]\n};\n//#endregion\n//#region src/contract.json\nvar contract_default = {\n\tschemaVersion: \"1\",\n\ttargetFamily: \"sql\",\n\ttarget: \"postgres\",\n\tprofileHash: \"3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2\",\n\troots: {},\n\tdomain: { \"namespaces\": { \"public\": { \"models\": {} } } },\n\tstorage: {\n\t\t\"namespaces\": { \"public\": {\n\t\t\t\"entries\": { \"table\": {} },\n\t\t\t\"id\": \"public\",\n\t\t\t\"kind\": \"postgres-schema\"\n\t\t} },\n\t\t\"storageHash\": \"7e98a4d9437e6be2f2fa7fca02fbc01c245586997a937f97cab60788612512e5\",\n\t\t\"types\": { \"geometry\": {\n\t\t\t\"codecId\": \"pg/geometry@1\",\n\t\t\t\"kind\": \"codec-instance\",\n\t\t\t\"nativeType\": \"geometry\"\n\t\t} }\n\t},\n\tcapabilities: {\n\t\t\"postgres\": {\n\t\t\t\"distinctOn\": true,\n\t\t\t\"jsonAgg\": true,\n\t\t\t\"lateral\": true,\n\t\t\t\"limit\": true,\n\t\t\t\"orderBy\": true,\n\t\t\t\"returning\": true\n\t\t},\n\t\t\"sql\": {\n\t\t\t\"checkConstraint\": true,\n\t\t\t\"defaultInInsert\": true,\n\t\t\t\"enums\": true,\n\t\t\t\"lateral\": true,\n\t\t\t\"returning\": true,\n\t\t\t\"scalarList\": true\n\t\t}\n\t},\n\textensions: {},\n\tmeta: {},\n\t_generated: {\n\t\t\"warning\": \"⚠️ GENERATED FILE - DO NOT EDIT\",\n\t\t\"message\": \"This file is automatically generated by \\\"prisma-next contract emit\\\".\",\n\t\t\"regenerate\": \"To regenerate, run: prisma-next contract emit\"\n\t}\n};\n//#endregion\n//#region src/core/contract-space-constants.ts\n/**\n* Static names and identifiers used across postgis's contract space.\n*\n* Centralised here so the contract IR (`./contract`), the baseline\n* migration ops (`./migrations`), the head ref, and the descriptor\n* (`../exports/control`) all reference the same values without typos.\n*\n* The space identifier `'postgis'` is what the framework writes to\n* `migrations/` in the user's repo and what the marker table's\n* `space` column carries for postgis-owned rows.\n*\n* The `postgis:*` invariantId namespace is locked here — once\n* published, an invariantId is immutable so downstream consumers can\n* reference it by literal string match.\n*/\nconst POSTGIS_SPACE_ID = \"postgis\";\nconst POSTGIS_BASELINE_MIGRATION_NAME = \"20260601T0000_install_postgis_extension\";\n//#endregion\n//#region src/exports/control.ts\nconst geometryControlPlaneHooks = {\n\texpandNativeType: ({ nativeType, typeParams }) => {\n\t\tconst srid = typeParams?.[\"srid\"];\n\t\tif (typeof srid === \"number\" && Number.isInteger(srid) && srid >= 0) return `${nativeType}(Geometry,${srid})`;\n\t\treturn nativeType;\n\t},\n\tresolveIdentityValue: () => null\n};\nconst postgisContractSpace = contractSpaceFromJson({\n\tcontractJson: contract_default,\n\tmigrations: [{\n\t\tdirName: POSTGIS_BASELINE_MIGRATION_NAME,\n\t\tmetadata: migration_default,\n\t\tops: ops_default\n\t}],\n\theadRef: head_default\n});\nconst postgisExtensionDescriptor = {\n\t...postgisPackMeta,\n\tid: POSTGIS_SPACE_ID,\n\tcontractSpace: postgisContractSpace,\n\ttypes: {\n\t\t...postgisPackMeta.types,\n\t\tcodecTypes: {\n\t\t\t...postgisPackMeta.types.codecTypes,\n\t\t\tcontrolPlaneHooks: { [POSTGIS_GEOMETRY_CODEC_ID]: geometryControlPlaneHooks }\n\t\t}\n\t},\n\tqueryOperations: () => postgisQueryOperations(),\n\tcreate: () => ({\n\t\tfamilyId: \"sql\",\n\t\ttargetId: \"postgres\"\n\t})\n};\n//#endregion\nexport { postgisExtensionDescriptor as default, postgisExtensionDescriptor };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;AAIA,IAAI,oBAAoB;CACvB,MAAM;CACN,IAAI;CACJ,oBAAoB,CAAC,4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AAS,YAAY,OAAO,UAAU,IAAI,KAAK,QAAQ,GAAG,OAAO,GAAG,WAAW,YAAY,KAAK;EAC3G,OAAO;CACR;CACA,4BAA4B;AAC7B;AACA,MAAM,uBAAuB,sBAAsB;CAClD,cAAc;CACd,YAAY,CAAC;EACZ,SAAS;EACT,UAAU;EACV,KAAK;CACN,CAAC;CACD,SAAS;AACV,CAAC;AACD,MAAM,6BAA6B;CAClC,GAAG;CACH,IAAI;CACJ,eAAe;CACf,OAAO;EACN,GAAG,gBAAgB;EACnB,YAAY;GACX,GAAG,gBAAgB,MAAM;GACzB,mBAAmB,GAAG,4BAA4B,0BAA0B;EAC7E;CACD;CACA,uBAAuB,uBAAuB;CAC9C,eAAe;EACd,UAAU;EACV,UAAU;CACX;AACD"}
1
+ {"version":3,"file":"control.mjs","names":[],"sources":["../../../../3-extensions/postgis/dist/control.mjs"],"sourcesContent":["import { t as POSTGIS_GEOMETRY_CODEC_ID } from \"./constants-CWW72xGt.mjs\";\nimport { n as postgisQueryOperations, t as postgisPackMeta } from \"./descriptor-meta-CtaX_u3u.mjs\";\nimport { contractSpaceFromJson } from \"@internal/migration-tools/spaces\";\n//#region migrations/20260601T0000_install_postgis_extension/migration.json\nvar migration_default = {\n\tfrom: null,\n\tto: \"2db551a8a5619d0d97710f29130eaea0eccbdd5238f015ee9d18408d438e0f8a\",\n\tprovidedInvariants: [\"postgis:install-postgis-v1\"],\n\tcreatedAt: \"2026-06-01T00:00:00.000Z\",\n\tmigrationHash: \"5dd437b3077585a4e39b1be8ebc30b699e75c4ff30c5ee4177659e0d0de948bd\"\n};\n//#endregion\n//#region migrations/20260601T0000_install_postgis_extension/ops.json\nvar ops_default = [{\n\t\"id\": \"postgis.install-postgis-extension\",\n\t\"label\": \"Enable extension \\\"postgis\\\"\",\n\t\"operationClass\": \"additive\",\n\t\"invariantId\": \"postgis:install-postgis-v1\",\n\t\"target\": {\n\t\t\"id\": \"postgres\",\n\t\t\"details\": {\n\t\t\t\"schema\": \"public\",\n\t\t\t\"objectType\": \"dependency\",\n\t\t\t\"name\": \"postgis\"\n\t\t}\n\t},\n\t\"precheck\": [{\n\t\t\"description\": \"verify extension \\\"postgis\\\" is not already enabled\",\n\t\t\"sql\": \"SELECT NOT EXISTS (SELECT 1 AS \\\"one\\\" FROM \\\"pg_extension\\\" WHERE \\\"extname\\\" = $1) AS \\\"result\\\"\",\n\t\t\"params\": [\"postgis\"]\n\t}],\n\t\"execute\": [{\n\t\t\"description\": \"create extension \\\"postgis\\\"\",\n\t\t\"sql\": \"CREATE EXTENSION IF NOT EXISTS postgis\"\n\t}],\n\t\"postcheck\": [{\n\t\t\"description\": \"confirm extension \\\"postgis\\\" is enabled\",\n\t\t\"sql\": \"SELECT EXISTS (SELECT 1 AS \\\"one\\\" FROM \\\"pg_extension\\\" WHERE \\\"extname\\\" = $1) AS \\\"result\\\"\",\n\t\t\"params\": [\"postgis\"]\n\t}]\n}];\n//#endregion\n//#region migrations/refs/head.json\nvar head_default = {\n\thash: \"2db551a8a5619d0d97710f29130eaea0eccbdd5238f015ee9d18408d438e0f8a\",\n\tinvariants: [\"postgis:install-postgis-v1\"]\n};\n//#endregion\n//#region src/contract.json\nvar contract_default = {\n\tschemaVersion: \"1\",\n\ttargetFamily: \"sql\",\n\ttarget: \"postgres\",\n\tprofileHash: \"3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2\",\n\troots: {},\n\tdomain: { \"namespaces\": { \"public\": { \"models\": {} } } },\n\tstorage: {\n\t\t\"namespaces\": { \"public\": {\n\t\t\t\"entries\": { \"table\": {} },\n\t\t\t\"id\": \"public\",\n\t\t\t\"kind\": \"postgres-schema\"\n\t\t} },\n\t\t\"storageHash\": \"2db551a8a5619d0d97710f29130eaea0eccbdd5238f015ee9d18408d438e0f8a\",\n\t\t\"types\": { \"geometry\": {\n\t\t\t\"codecId\": \"pg/geometry@1\",\n\t\t\t\"dataType\": \"postgis/geometry\",\n\t\t\t\"kind\": \"codec-instance\"\n\t\t} }\n\t},\n\tcapabilities: {\n\t\t\"postgres\": {\n\t\t\t\"distinctOn\": true,\n\t\t\t\"forKeyShare\": true,\n\t\t\t\"forNoKeyUpdate\": true,\n\t\t\t\"jsonAgg\": true,\n\t\t\t\"lateral\": true,\n\t\t\t\"limit\": true,\n\t\t\t\"orderBy\": true,\n\t\t\t\"returning\": true\n\t\t},\n\t\t\"sql\": {\n\t\t\t\"checkConstraint\": true,\n\t\t\t\"defaultInInsert\": true,\n\t\t\t\"enums\": true,\n\t\t\t\"forShare\": true,\n\t\t\t\"forUpdate\": true,\n\t\t\t\"insertOnConflictSkip\": true,\n\t\t\t\"insertOnConflictWithoutTarget\": true,\n\t\t\t\"lateral\": true,\n\t\t\t\"lockNowait\": true,\n\t\t\t\"lockOf\": true,\n\t\t\t\"lockSkipLocked\": true,\n\t\t\t\"returning\": true,\n\t\t\t\"scalarList\": true\n\t\t}\n\t},\n\textensions: {},\n\tmeta: {},\n\t_generated: {\n\t\t\"warning\": \"⚠️ GENERATED FILE - DO NOT EDIT\",\n\t\t\"message\": \"This file is automatically generated by \\\"prisma contract emit\\\".\",\n\t\t\"regenerate\": \"To regenerate, run: prisma contract emit\"\n\t}\n};\n//#endregion\n//#region src/core/contract-space-constants.ts\n/**\n* Static names and identifiers used across postgis's contract space.\n*\n* Centralised here so the contract IR (`./contract`), the baseline\n* migration ops (`./migrations`), the head ref, and the descriptor\n* (`../exports/control`) all reference the same values without typos.\n*\n* The space identifier `'postgis'` is what the framework writes to\n* `migrations/` in the user's repo and what the marker table's\n* `space` column carries for postgis-owned rows.\n*\n* The `postgis:*` invariantId namespace is locked here — once\n* published, an invariantId is immutable so downstream consumers can\n* reference it by literal string match.\n*/\nconst POSTGIS_SPACE_ID = \"postgis\";\nconst POSTGIS_BASELINE_MIGRATION_NAME = \"20260601T0000_install_postgis_extension\";\n//#endregion\n//#region src/exports/control.ts\nconst geometryControlPlaneHooks = { resolveIdentityValue: () => null };\nconst postgisContractSpace = contractSpaceFromJson({\n\tcontractJson: contract_default,\n\tmigrations: [{\n\t\tdirName: POSTGIS_BASELINE_MIGRATION_NAME,\n\t\tmetadata: migration_default,\n\t\tops: ops_default\n\t}],\n\theadRef: head_default\n});\nconst postgisExtensionDescriptor = {\n\t...postgisPackMeta,\n\tid: POSTGIS_SPACE_ID,\n\tcontractSpace: postgisContractSpace,\n\ttypes: {\n\t\t...postgisPackMeta.types,\n\t\tcodecTypes: {\n\t\t\t...postgisPackMeta.types.codecTypes,\n\t\t\tcontrolPlaneHooks: { [POSTGIS_GEOMETRY_CODEC_ID]: geometryControlPlaneHooks }\n\t\t}\n\t},\n\tqueryOperations: () => postgisQueryOperations(),\n\tcreate: () => ({\n\t\tfamilyId: \"sql\",\n\t\ttargetId: \"postgres\"\n\t})\n};\n//#endregion\nexport { postgisExtensionDescriptor as default, postgisExtensionDescriptor };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;AAIA,IAAI,oBAAoB;CACvB,MAAM;CACN,IAAI;CACJ,oBAAoB,CAAC,4BAA4B;CACjD,WAAW;CACX,eAAe;AAChB;AAGA,IAAI,cAAc,CAAC;CAClB,MAAM;CACN,SAAS;CACT,kBAAkB;CAClB,eAAe;CACf,UAAU;EACT,MAAM;EACN,WAAW;GACV,UAAU;GACV,cAAc;GACd,QAAQ;EACT;CACD;CACA,YAAY,CAAC;EACZ,eAAe;EACf,OAAO;EACP,UAAU,CAAC,SAAS;CACrB,CAAC;CACD,WAAW,CAAC;EACX,eAAe;EACf,OAAO;CACR,CAAC;CACD,aAAa,CAAC;EACb,eAAe;EACf,OAAO;EACP,UAAU,CAAC,SAAS;CACrB,CAAC;AACF,CAAC;AAGD,IAAI,eAAe;CAClB,MAAM;CACN,YAAY,CAAC,4BAA4B;AAC1C;AAGA,IAAI,mBAAmB;CACtB,eAAe;CACf,cAAc;CACd,QAAQ;CACR,aAAa;CACb,OAAO,CAAC;CACR,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,CAAC,EAAE,EAAE,EAAE;CACvD,SAAS;EACR,cAAc,EAAE,UAAU;GACzB,WAAW,EAAE,SAAS,CAAC,EAAE;GACzB,MAAM;GACN,QAAQ;EACT,EAAE;EACF,eAAe;EACf,SAAS,EAAE,YAAY;GACtB,WAAW;GACX,YAAY;GACZ,QAAQ;EACT,EAAE;CACH;CACA,cAAc;EACb,YAAY;GACX,cAAc;GACd,eAAe;GACf,kBAAkB;GAClB,WAAW;GACX,WAAW;GACX,SAAS;GACT,WAAW;GACX,aAAa;EACd;EACA,OAAO;GACN,mBAAmB;GACnB,mBAAmB;GACnB,SAAS;GACT,YAAY;GACZ,aAAa;GACb,wBAAwB;GACxB,iCAAiC;GACjC,WAAW;GACX,cAAc;GACd,UAAU;GACV,kBAAkB;GAClB,aAAa;GACb,cAAc;EACf;CACD;CACA,YAAY,CAAC;CACb,MAAM,CAAC;CACP,YAAY;EACX,WAAW;EACX,WAAW;EACX,cAAc;CACf;AACD;;;;;;;;;;;;;;;;AAkBA,MAAM,mBAAmB;AACzB,MAAM,kCAAkC;AAGxC,MAAM,4BAA4B,EAAE,4BAA4B,KAAK;AACrE,MAAM,uBAAuB,sBAAsB;CAClD,cAAc;CACd,YAAY,CAAC;EACZ,SAAS;EACT,UAAU;EACV,KAAK;CACN,CAAC;CACD,SAAS;AACV,CAAC;AACD,MAAM,6BAA6B;CAClC,GAAG;CACH,IAAI;CACJ,eAAe;CACf,OAAO;EACN,GAAG,gBAAgB;EACnB,YAAY;GACX,GAAG,gBAAgB,MAAM;GACzB,mBAAmB,GAAG,4BAA4B,0BAA0B;EAC7E;CACD;CACA,uBAAuB,uBAAuB;CAC9C,eAAe;EACd,UAAU;EACV,UAAU;CACX;AACD"}
@@ -1,22 +1,26 @@
1
1
  import { t as POSTGIS_GEOMETRY_CODEC_ID } from "./constants-CWW72xGt-hJye3Dua.mjs";
2
2
  import { t as postgisError } from "./errors-Bg6kDFR--BUzKMn1A.mjs";
3
3
  import { buildOperation, codecOf, toExpr } from "@prisma/orm-family-sql/relational-core/expression";
4
+ import { CodecImpl, readJsonMatching, refuseJsonValue } from "@prisma/orm-framework/components/codec";
5
+ import { sqlDataType } from "@prisma/orm-family-sql/contract/data-type";
6
+ import { pgText } from "@prisma/orm-target-postgres/target/data-types";
7
+ import { isInternalError } from "@prisma/orm-framework/utils/internal-error";
8
+ import { type } from "arktype";
4
9
  import { buildCodecDescriptorRegistry } from "@prisma/orm-family-sql/relational-core/codec-descriptor-registry";
5
- import { CodecImpl } from "@prisma/orm-framework/components/codec";
10
+ import { CastExpr } from "@prisma/orm-family-sql/relational-core/ast";
6
11
  import { PostgresCodecDescriptor, definePostgresCodecs } from "@prisma/orm-target-postgres/target/codec-descriptor";
7
- import { type } from "arktype";
8
- //#region ../../../3-extensions/postgis/dist/descriptor-meta-deM0Qc_b.mjs
12
+ //#region ../../../3-extensions/postgis/dist/descriptor-meta-CtaX_u3u.mjs
9
13
  const postgisAuthoringTypes = { postgis: { Geometry: {
10
14
  kind: "typeConstructor",
15
+ inferred: true,
11
16
  args: [{
12
- kind: "number",
17
+ kind: "value",
18
+ dataType: "pg/int4",
13
19
  name: "srid",
14
- integer: true,
15
- minimum: 0
20
+ optional: true
16
21
  }],
17
22
  output: {
18
23
  codecId: POSTGIS_GEOMETRY_CODEC_ID,
19
- nativeType: "geometry",
20
24
  typeParams: { srid: {
21
25
  kind: "arg",
22
26
  index: 0
@@ -332,14 +336,72 @@ function formatPosition(p) {
332
336
  function formatRings(rings) {
333
337
  return rings.map((ring) => `(${ring.map(formatPosition).join(",")})`).join(",");
334
338
  }
335
- const geometryParamsSchema = type({ "srid?": "number" }).narrow((params, ctx) => {
336
- const { srid } = params;
337
- if (srid === void 0) return true;
338
- if (!Number.isInteger(srid)) return ctx.mustBe("an integer");
339
- if (srid < 0) return ctx.mustBe("a non-negative integer");
340
- return true;
339
+ const postgisGeometryParams = type({ "srid?": "number.integer >= 1" });
340
+ const HEX_TEXT = /^(?:[0-9A-Fa-f]{2})*$/;
341
+ /** The geometry HEXEWKB holds, or `undefined` when it is not EWKB. */
342
+ function geometryOf(hex) {
343
+ try {
344
+ return decodeEWKBHex(hex);
345
+ } catch (error) {
346
+ if (isInternalError(error)) throw error;
347
+ return;
348
+ }
349
+ }
350
+ /**
351
+ * Reads HEXEWKB in either case and byte order; {@link spellGeometry} writes the upper-case little-endian HEXEWKB PostGIS prints. A column with an SRID holds only geometries in that SRID, as PostGIS refuses any other.
352
+ */
353
+ const readGeometry = (json, params) => {
354
+ const hex = readJsonMatching("postgis/geometry", json, HEX_TEXT, "a HEXEWKB string");
355
+ const srid = params["srid"];
356
+ const geometry = geometryOf(hex);
357
+ if (geometry === void 0 || typeof srid === "number" && geometry.srid !== srid) return refuseJsonValue("postgis/geometry", typeof srid === "number" ? `a HEXEWKB string of a geometry with SRID ${srid}` : "a HEXEWKB string", json);
358
+ return json;
359
+ };
360
+ /** The upper-case little-endian HEXEWKB PostGIS prints for the geometry. */
361
+ const spellGeometry = (json) => {
362
+ const geometry = typeof json === "string" ? geometryOf(json) : void 0;
363
+ return geometry === void 0 ? json : encodeEWKBHex(geometry);
364
+ };
365
+ const postgisGeometry = sqlDataType("postgis/geometry", {
366
+ params: postgisGeometryParams,
367
+ read: readGeometry,
368
+ spell: spellGeometry,
369
+ texts: [{
370
+ text: "geometry",
371
+ written: true,
372
+ catalog: true
373
+ }, {
374
+ text: "geometry(geometry,{srid})",
375
+ written: true,
376
+ catalog: true,
377
+ display: "geometry(Geometry,{srid})"
378
+ }],
379
+ casts: { [pgText.id]: (value) => value }
341
380
  });
342
- const POSTGIS_GEOMETRY_NATIVE_TYPE = "geometry";
381
+ const postgisDataTypes = [postgisGeometry];
382
+ /**
383
+ * Geometry codec for the PostGIS extension.
384
+ *
385
+ * Mirrors the descriptor + class pattern used by other codec-shipping
386
+ * packages (e.g. pgvector). Three artefacts:
387
+ *
388
+ * 1. `PostgisGeometryCodec` extends {@link CodecImpl} with the runtime
389
+ * encode/decode conversions. Wire formats:
390
+ * - encode: EWKT (`'SRID=4326;POINT(...)'`) — PostgreSQL parses
391
+ * this when cast to `::geometry`.
392
+ * - decode: hex EWKB — the default representation `node-postgres`
393
+ * hands back for `geometry` columns. We parse it into a
394
+ * GeoJSON-shaped object so callers see structured data, not
395
+ * opaque hex.
396
+ * 2. `PostgisGeometryDescriptor` extends {@link PostgresCodecDescriptor} with the codec id, traits, the `postgis/geometry` data type and its params schema (`{ srid?: number }`), and explicit target behavior. Every column reads as `Geometry`, whatever its SRID. The data type declares the type's name and the bound of `srid`.
397
+ * 3. `pgGeometryColumn({ srid })` per-codec column helper invoking `descriptor.factory({ srid })`.
398
+ *
399
+ * The geometry codec's encode/decode is parameter-independent — the
400
+ * wire format already carries SRID inside the EWKT/EWKB payload, so the
401
+ * resolved codec for every `(srid)` instance is the same shared codec
402
+ * today. The factory threads the closure for future per-instance state
403
+ * (e.g. SRID cross-checks) without rewriting the constructor.
404
+ */
343
405
  const allowedGeometryTypes = /* @__PURE__ */ new Set([
344
406
  "Point",
345
407
  "LineString",
@@ -355,42 +417,35 @@ function assertGeometry(value) {
355
417
  if (!Array.isArray(value.coordinates)) throw postgisError("RUNTIME.ENCODE_FAILED", "Geometry value: \"coordinates\" must be an array", { meta: { codecId: POSTGIS_GEOMETRY_CODEC_ID } });
356
418
  }
357
419
  var PostgisGeometryCodec = class extends CodecImpl {
358
- constructor(descriptor) {
359
- super(descriptor);
420
+ constructor(descriptor, params) {
421
+ super(descriptor, postgisGeometry, params);
360
422
  }
361
- async encode(value, _ctx) {
423
+ async toWire(value, _ctx) {
362
424
  assertGeometry(value);
363
425
  return encodeEWKT(value);
364
426
  }
365
- async decode(wire, _ctx) {
427
+ async fromWire(wire, _ctx) {
366
428
  if (typeof wire !== "string") throw postgisError("RUNTIME.DECODE_FAILED", "Geometry wire value must be a string", { meta: { codecId: POSTGIS_GEOMETRY_CODEC_ID } });
367
429
  return decodeEWKBHex(wire);
368
430
  }
369
- encodeJson(value) {
370
- assertGeometry(value);
371
- return encodeEWKBHex(value);
431
+ fromDataTypeValue(value) {
432
+ return decodeEWKBHex(value.value);
372
433
  }
373
- decodeJson(json) {
374
- if (typeof json !== "string") throw postgisError("RUNTIME.DECODE_FAILED", "Geometry database JSON value must be a HEXEWKB string", { meta: { codecId: POSTGIS_GEOMETRY_CODEC_ID } });
375
- return decodeEWKBHex(json);
434
+ toDataTypeValue(input) {
435
+ assertGeometry(input);
436
+ return this.dataTypeValueOf(encodeEWKBHex(input));
376
437
  }
377
438
  };
378
439
  var PostgisGeometryDescriptor = class extends PostgresCodecDescriptor {
379
- nativeType() {
380
- return POSTGIS_GEOMETRY_NATIVE_TYPE;
381
- }
440
+ /** The HEXEWKB text PostgreSQL prints for a geometry, which `fromWire` reads as it reads a row. A JSON constructor handed the geometry itself may write GeoJSON instead. */
382
441
  jsonProjection(expression) {
383
- return expression;
442
+ return CastExpr.as(expression, "text");
384
443
  }
444
+ dataType = postgisGeometry.id;
385
445
  codecId = POSTGIS_GEOMETRY_CODEC_ID;
386
446
  traits = ["equality"];
387
- targetTypes = ["geometry"];
388
- paramsSchema = geometryParamsSchema;
389
- renderOutputType(params) {
390
- const { srid } = params;
391
- if (srid === void 0) return "Geometry";
392
- return `Geometry<${srid}>`;
393
- }
447
+ enumRefusal = "Enums over a geometry codec are not supported yet, because no test proves that a shape reads back as its member. Use a text enum that names each shape instead.";
448
+ paramsSchema = postgisGeometryParams;
394
449
  /**
395
450
  * Runtime materialization uses an empty parameter object for the
396
451
  * existing unparameterized `geometryColumn` variant and `{ srid }` for
@@ -398,8 +453,8 @@ var PostgisGeometryDescriptor = class extends PostgresCodecDescriptor {
398
453
  * the wire format already carries SRID inside the EWKT/EWKB payload,
399
454
  * so codec behavior is parameter-independent.
400
455
  */
401
- factory(_params) {
402
- return () => new PostgisGeometryCodec(this);
456
+ factory(params) {
457
+ return () => new PostgisGeometryCodec(this, params ?? {});
403
458
  }
404
459
  };
405
460
  const codecDescriptorMap = { geometry: new PostgisGeometryDescriptor() };
@@ -437,7 +492,6 @@ function postgisQueryOperations() {
437
492
  },
438
493
  lowering: {
439
494
  targetFamily: "sql",
440
- strategy: "function",
441
495
  template: "ST_Distance({{self}}, {{arg0}})"
442
496
  }
443
497
  });
@@ -456,7 +510,6 @@ function postgisQueryOperations() {
456
510
  },
457
511
  lowering: {
458
512
  targetFamily: "sql",
459
- strategy: "function",
460
513
  template: "ST_DistanceSphere({{self}}, {{arg0}})"
461
514
  }
462
515
  });
@@ -479,7 +532,6 @@ function postgisQueryOperations() {
479
532
  },
480
533
  lowering: {
481
534
  targetFamily: "sql",
482
- strategy: "function",
483
535
  template: "ST_DWithin({{self}}, {{arg0}}, {{arg1}})"
484
536
  }
485
537
  });
@@ -498,7 +550,6 @@ function postgisQueryOperations() {
498
550
  },
499
551
  lowering: {
500
552
  targetFamily: "sql",
501
- strategy: "function",
502
553
  template: "ST_Contains({{self}}, {{arg0}})"
503
554
  }
504
555
  });
@@ -517,7 +568,6 @@ function postgisQueryOperations() {
517
568
  },
518
569
  lowering: {
519
570
  targetFamily: "sql",
520
- strategy: "function",
521
571
  template: "ST_Within({{self}}, {{arg0}})"
522
572
  }
523
573
  });
@@ -536,7 +586,6 @@ function postgisQueryOperations() {
536
586
  },
537
587
  lowering: {
538
588
  targetFamily: "sql",
539
- strategy: "function",
540
589
  template: "ST_Intersects({{self}}, {{arg0}})"
541
590
  }
542
591
  });
@@ -555,7 +604,6 @@ function postgisQueryOperations() {
555
604
  },
556
605
  lowering: {
557
606
  targetFamily: "sql",
558
- strategy: "function",
559
607
  template: "({{self}} && {{arg0}})"
560
608
  }
561
609
  });
@@ -571,6 +619,7 @@ const postgisPackMeta = {
571
619
  version: "0.0.1",
572
620
  capabilities: { postgres: { "postgis.geometry": true } },
573
621
  authoring: { type: postgisAuthoringTypes },
622
+ dataTypes: postgisDataTypes,
574
623
  types: {
575
624
  codecTypes: {
576
625
  codecDescriptors: Array.from(postgisCodecRegistry.values()),
@@ -578,27 +627,16 @@ const postgisPackMeta = {
578
627
  package: "@internal/extension-postgis/codec-types",
579
628
  named: "CodecTypes",
580
629
  alias: "PostgisTypes"
581
- },
582
- typeImports: [{
583
- package: "@internal/extension-postgis/codec-types",
584
- named: "Geometry",
585
- alias: "Geometry"
586
- }]
630
+ }
587
631
  },
588
632
  queryOperationTypes: { import: {
589
633
  package: "@internal/extension-postgis/operation-types",
590
634
  named: "QueryOperationTypes",
591
635
  alias: "PostgisQueryOperationTypes"
592
- } },
593
- storage: [{
594
- typeId: postgisTypeId,
595
- familyId: "sql",
596
- targetId: "postgres",
597
- nativeType: "geometry"
598
- }]
636
+ } }
599
637
  }
600
638
  };
601
639
  //#endregion
602
640
  export { postgisPackMeta as n, postgisQueryOperations as r, postgisCodecRegistry as t };
603
641
 
604
- //# sourceMappingURL=descriptor-meta-deM0Qc_b-FRxKhllA.mjs.map
642
+ //# sourceMappingURL=descriptor-meta-CtaX_u3u-DVoekCn0.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor-meta-CtaX_u3u-DVoekCn0.mjs","names":[],"sources":["../../../../3-extensions/postgis/dist/descriptor-meta-CtaX_u3u.mjs"],"sourcesContent":["import { t as POSTGIS_GEOMETRY_CODEC_ID } from \"./constants-CWW72xGt.mjs\";\nimport { t as postgisError } from \"./errors-Bg6kDFR-.mjs\";\nimport { buildOperation, codecOf, toExpr } from \"@internal/sql-relational-core/expression\";\nimport { CodecImpl, readJsonMatching, refuseJsonValue } from \"@internal/framework-components/codec\";\nimport { sqlDataType } from \"@internal/sql-contract/data-type\";\nimport { pgText } from \"@internal/target-postgres/data-types\";\nimport { isInternalError } from \"@internal/utils/internal-error\";\nimport { type } from \"arktype\";\nimport { buildCodecDescriptorRegistry } from \"@internal/sql-relational-core/codec-descriptor-registry\";\nimport { CastExpr } from \"@internal/sql-relational-core/ast\";\nimport { PostgresCodecDescriptor, definePostgresCodecs } from \"@internal/target-postgres/codec-descriptor\";\n//#region src/core/authoring.ts\nconst postgisAuthoringTypes = { postgis: { Geometry: {\n\tkind: \"typeConstructor\",\n\tinferred: true,\n\targs: [{\n\t\tkind: \"value\",\n\t\tdataType: \"pg/int4\",\n\t\tname: \"srid\",\n\t\toptional: true\n\t}],\n\toutput: {\n\t\tcodecId: POSTGIS_GEOMETRY_CODEC_ID,\n\t\ttypeParams: { srid: {\n\t\t\tkind: \"arg\",\n\t\t\tindex: 0\n\t\t} }\n\t}\n} } };\n//#endregion\n//#region src/core/ewkb.ts\n/**\n* Minimal EWKB (Extended Well-Known Binary) reader for the PostGIS codec.\n*\n* `node-postgres` returns geometry columns as hex-encoded EWKB strings by\n* default. This reader parses the subset we ship with the extension —\n* Point, LineString, Polygon, and the Multi* counterparts — into GeoJSON\n* objects. Z and M coordinates are not supported; if a wire value carries\n* them, decoding throws so the caller can detect the mismatch instead of\n* silently dropping data.\n*/\nconst FLAG_Z = 2147483648;\nconst FLAG_M = 1073741824;\nconst FLAG_SRID = 536870912;\nconst TYPE_MASK = 536870911;\nconst TYPE_POINT = 1;\nconst TYPE_LINESTRING = 2;\nconst TYPE_POLYGON = 3;\nconst TYPE_MULTIPOINT = 4;\nconst TYPE_MULTILINESTRING = 5;\nconst TYPE_MULTIPOLYGON = 6;\nconst HEX_PAIR_RE = /^[0-9a-fA-F]{2}$/;\nfunction hexToBytes(hex) {\n\tif (hex.length % 2 !== 0) throw postgisError(\"RUNTIME.DECODE_FAILED\", \"Geometry wire value: odd-length hex string\", { meta: { wirePreview: hex.slice(0, 32) } });\n\tconst bytes = new Uint8Array(hex.length / 2);\n\tfor (let i = 0; i < bytes.length; i++) {\n\t\tconst pair = hex.slice(i * 2, i * 2 + 2);\n\t\tif (!HEX_PAIR_RE.test(pair)) throw postgisError(\"RUNTIME.DECODE_FAILED\", `Geometry wire value: invalid hex byte at offset ${i * 2}`, { meta: { wirePreview: hex.slice(0, 32) } });\n\t\tbytes[i] = Number.parseInt(pair, 16);\n\t}\n\treturn bytes;\n}\nvar Reader = class {\n\toffset = 0;\n\tview;\n\tconstructor(bytes) {\n\t\tthis.view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n\t}\n\trequireBytes(needed) {\n\t\tif (this.offset + needed > this.view.byteLength) throw postgisError(\"RUNTIME.DECODE_FAILED\", `Geometry wire value: unexpected end of buffer (need ${needed} bytes at offset ${this.offset}, ${this.view.byteLength - this.offset} available)`);\n\t}\n\treadUint8() {\n\t\tthis.requireBytes(1);\n\t\tconst v = this.view.getUint8(this.offset);\n\t\tthis.offset += 1;\n\t\treturn v;\n\t}\n\treadUint32(littleEndian) {\n\t\tthis.requireBytes(4);\n\t\tconst v = this.view.getUint32(this.offset, littleEndian);\n\t\tthis.offset += 4;\n\t\treturn v >>> 0;\n\t}\n\treadFloat64(littleEndian) {\n\t\tthis.requireBytes(8);\n\t\tconst v = this.view.getFloat64(this.offset, littleEndian);\n\t\tthis.offset += 8;\n\t\treturn v;\n\t}\n\thasRemaining() {\n\t\treturn this.offset !== this.view.byteLength;\n\t}\n\tremainingBytes() {\n\t\treturn this.view.byteLength - this.offset;\n\t}\n};\nvar Writer = class {\n\tbytes = [];\n\twriteUint8(value) {\n\t\tthis.bytes.push(value);\n\t}\n\twriteUint32(value) {\n\t\tconst buffer = /* @__PURE__ */ new ArrayBuffer(4);\n\t\tnew DataView(buffer).setUint32(0, value, true);\n\t\tthis.bytes.push(...new Uint8Array(buffer));\n\t}\n\twriteFloat64(value) {\n\t\tconst buffer = /* @__PURE__ */ new ArrayBuffer(8);\n\t\tnew DataView(buffer).setFloat64(0, value, true);\n\t\tthis.bytes.push(...new Uint8Array(buffer));\n\t}\n\ttoHex() {\n\t\treturn this.bytes.map((byte) => byte.toString(16).padStart(2, \"0\")).join(\"\").toUpperCase();\n\t}\n};\nfunction readHeader(reader) {\n\tconst byteOrder = reader.readUint8();\n\tif (byteOrder !== 0 && byteOrder !== 1) throw postgisError(\"RUNTIME.DECODE_FAILED\", `Geometry wire value: invalid byte order ${byteOrder}`);\n\tconst littleEndian = byteOrder === 1;\n\tconst typeCode = reader.readUint32(littleEndian);\n\tif ((typeCode & FLAG_Z) !== 0 || (typeCode & FLAG_M) !== 0) throw postgisError(\"RUNTIME.DECODE_FAILED\", \"Geometry wire value: Z/M coordinates are not supported\");\n\tconst geomType = typeCode & TYPE_MASK;\n\tif ((typeCode & FLAG_SRID) !== 0) return {\n\t\tgeomType,\n\t\tlittleEndian,\n\t\tsrid: reader.readUint32(littleEndian)\n\t};\n\treturn {\n\t\tgeomType,\n\t\tlittleEndian\n\t};\n}\nfunction readPosition(reader, littleEndian) {\n\treturn [reader.readFloat64(littleEndian), reader.readFloat64(littleEndian)];\n}\nfunction readPoint(reader, header) {\n\tconst coords = readPosition(reader, header.littleEndian);\n\treturn header.srid !== void 0 ? {\n\t\ttype: \"Point\",\n\t\tcoordinates: coords,\n\t\tsrid: header.srid\n\t} : {\n\t\ttype: \"Point\",\n\t\tcoordinates: coords\n\t};\n}\nfunction readLineString(reader, header) {\n\tconst n = reader.readUint32(header.littleEndian);\n\tconst coords = [];\n\tfor (let i = 0; i < n; i++) coords.push(readPosition(reader, header.littleEndian));\n\treturn header.srid !== void 0 ? {\n\t\ttype: \"LineString\",\n\t\tcoordinates: coords,\n\t\tsrid: header.srid\n\t} : {\n\t\ttype: \"LineString\",\n\t\tcoordinates: coords\n\t};\n}\nfunction readPolygon(reader, header) {\n\tconst numRings = reader.readUint32(header.littleEndian);\n\tconst rings = [];\n\tfor (let r = 0; r < numRings; r++) {\n\t\tconst n = reader.readUint32(header.littleEndian);\n\t\tconst ring = [];\n\t\tfor (let i = 0; i < n; i++) ring.push(readPosition(reader, header.littleEndian));\n\t\trings.push(ring);\n\t}\n\treturn header.srid !== void 0 ? {\n\t\ttype: \"Polygon\",\n\t\tcoordinates: rings,\n\t\tsrid: header.srid\n\t} : {\n\t\ttype: \"Polygon\",\n\t\tcoordinates: rings\n\t};\n}\nfunction readSubGeometry(reader) {\n\tconst header = readHeader(reader);\n\tswitch (header.geomType) {\n\t\tcase TYPE_POINT: return readPoint(reader, header);\n\t\tcase TYPE_LINESTRING: return readLineString(reader, header);\n\t\tcase TYPE_POLYGON: return readPolygon(reader, header);\n\t\tdefault: throw postgisError(\"RUNTIME.DECODE_FAILED\", `Geometry wire value: unsupported sub-type ${header.geomType}`);\n\t}\n}\nfunction readMultiPoint(reader, header) {\n\tconst n = reader.readUint32(header.littleEndian);\n\tconst coords = [];\n\tfor (let i = 0; i < n; i++) {\n\t\tconst sub = readSubGeometry(reader);\n\t\tif (sub.type !== \"Point\") throw postgisError(\"RUNTIME.DECODE_FAILED\", \"Geometry wire value: MultiPoint contains non-Point sub-geometry\");\n\t\tcoords.push(sub.coordinates);\n\t}\n\treturn header.srid !== void 0 ? {\n\t\ttype: \"MultiPoint\",\n\t\tcoordinates: coords,\n\t\tsrid: header.srid\n\t} : {\n\t\ttype: \"MultiPoint\",\n\t\tcoordinates: coords\n\t};\n}\nfunction readMultiLineString(reader, header) {\n\tconst n = reader.readUint32(header.littleEndian);\n\tconst lines = [];\n\tfor (let i = 0; i < n; i++) {\n\t\tconst sub = readSubGeometry(reader);\n\t\tif (sub.type !== \"LineString\") throw postgisError(\"RUNTIME.DECODE_FAILED\", \"Geometry wire value: MultiLineString contains non-LineString sub-geometry\");\n\t\tlines.push(sub.coordinates);\n\t}\n\treturn header.srid !== void 0 ? {\n\t\ttype: \"MultiLineString\",\n\t\tcoordinates: lines,\n\t\tsrid: header.srid\n\t} : {\n\t\ttype: \"MultiLineString\",\n\t\tcoordinates: lines\n\t};\n}\nfunction readMultiPolygon(reader, header) {\n\tconst n = reader.readUint32(header.littleEndian);\n\tconst polys = [];\n\tfor (let i = 0; i < n; i++) {\n\t\tconst sub = readSubGeometry(reader);\n\t\tif (sub.type !== \"Polygon\") throw postgisError(\"RUNTIME.DECODE_FAILED\", \"Geometry wire value: MultiPolygon contains non-Polygon sub-geometry\");\n\t\tpolys.push(sub.coordinates);\n\t}\n\treturn header.srid !== void 0 ? {\n\t\ttype: \"MultiPolygon\",\n\t\tcoordinates: polys,\n\t\tsrid: header.srid\n\t} : {\n\t\ttype: \"MultiPolygon\",\n\t\tcoordinates: polys\n\t};\n}\nfunction decodeEWKBHex(hex) {\n\tconst reader = new Reader(hexToBytes(hex));\n\tconst geometry = readGeometryBody(reader, readHeader(reader));\n\tif (reader.hasRemaining()) throw postgisError(\"RUNTIME.DECODE_FAILED\", `Geometry wire value: trailing data after geometry (${reader.remainingBytes()} bytes)`, { meta: { wirePreview: hex.slice(0, 32) } });\n\treturn geometry;\n}\nfunction encodeEWKBHex(value) {\n\tconst writer = new Writer();\n\twriteGeometry(writer, value);\n\treturn writer.toHex();\n}\nfunction writeHeader(writer, geomType, srid) {\n\twriter.writeUint8(1);\n\twriter.writeUint32(srid === void 0 ? geomType : geomType | FLAG_SRID);\n\tif (srid !== void 0) writer.writeUint32(srid);\n}\nfunction writePosition(writer, position) {\n\tif (!Number.isFinite(position[0]) || !Number.isFinite(position[1])) throw postgisError(\"RUNTIME.ENCODE_FAILED\", \"Geometry encode: coordinates must be finite numbers\");\n\twriter.writeFloat64(position[0]);\n\twriter.writeFloat64(position[1]);\n}\nfunction writeLineStringBody(writer, positions) {\n\twriter.writeUint32(positions.length);\n\tfor (const position of positions) writePosition(writer, position);\n}\nfunction writePolygonBody(writer, rings) {\n\twriter.writeUint32(rings.length);\n\tfor (const ring of rings) writeLineStringBody(writer, ring);\n}\nfunction writeGeometry(writer, value) {\n\tswitch (value.type) {\n\t\tcase \"Point\":\n\t\t\twriteHeader(writer, TYPE_POINT, value.srid);\n\t\t\twritePosition(writer, value.coordinates);\n\t\t\tbreak;\n\t\tcase \"LineString\":\n\t\t\twriteHeader(writer, TYPE_LINESTRING, value.srid);\n\t\t\twriteLineStringBody(writer, value.coordinates);\n\t\t\tbreak;\n\t\tcase \"Polygon\":\n\t\t\twriteHeader(writer, TYPE_POLYGON, value.srid);\n\t\t\twritePolygonBody(writer, value.coordinates);\n\t\t\tbreak;\n\t\tcase \"MultiPoint\":\n\t\t\twriteHeader(writer, TYPE_MULTIPOINT, value.srid);\n\t\t\twriter.writeUint32(value.coordinates.length);\n\t\t\tfor (const position of value.coordinates) {\n\t\t\t\twriteHeader(writer, TYPE_POINT);\n\t\t\t\twritePosition(writer, position);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"MultiLineString\":\n\t\t\twriteHeader(writer, TYPE_MULTILINESTRING, value.srid);\n\t\t\twriter.writeUint32(value.coordinates.length);\n\t\t\tfor (const line of value.coordinates) {\n\t\t\t\twriteHeader(writer, TYPE_LINESTRING);\n\t\t\t\twriteLineStringBody(writer, line);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"MultiPolygon\":\n\t\t\twriteHeader(writer, TYPE_MULTIPOLYGON, value.srid);\n\t\t\twriter.writeUint32(value.coordinates.length);\n\t\t\tfor (const polygon of value.coordinates) {\n\t\t\t\twriteHeader(writer, TYPE_POLYGON);\n\t\t\t\twritePolygonBody(writer, polygon);\n\t\t\t}\n\t\t\tbreak;\n\t}\n}\nfunction readGeometryBody(reader, header) {\n\tswitch (header.geomType) {\n\t\tcase TYPE_POINT: return readPoint(reader, header);\n\t\tcase TYPE_LINESTRING: return readLineString(reader, header);\n\t\tcase TYPE_POLYGON: return readPolygon(reader, header);\n\t\tcase TYPE_MULTIPOINT: return readMultiPoint(reader, header);\n\t\tcase TYPE_MULTILINESTRING: return readMultiLineString(reader, header);\n\t\tcase TYPE_MULTIPOLYGON: return readMultiPolygon(reader, header);\n\t\tdefault: throw postgisError(\"RUNTIME.DECODE_FAILED\", `Geometry wire value: unsupported geometry type ${header.geomType}`);\n\t}\n}\n/**\n* Encode a GeoJSON-shaped geometry to an EWKT string PostGIS understands\n* via `'<ewkt>'::geometry`. We use EWKT (not EWKB) on the way in so the\n* generated SQL stays human-readable.\n*/\nfunction encodeEWKT(value) {\n\tconst sridPrefix = value.srid !== void 0 ? `SRID=${value.srid};` : \"\";\n\tswitch (value.type) {\n\t\tcase \"Point\": return `${sridPrefix}POINT(${formatPosition(value.coordinates)})`;\n\t\tcase \"LineString\": return `${sridPrefix}LINESTRING(${value.coordinates.map(formatPosition).join(\",\")})`;\n\t\tcase \"Polygon\": return `${sridPrefix}POLYGON(${formatRings(value.coordinates)})`;\n\t\tcase \"MultiPoint\": return `${sridPrefix}MULTIPOINT(${value.coordinates.map(formatPosition).join(\",\")})`;\n\t\tcase \"MultiLineString\": return `${sridPrefix}MULTILINESTRING(${value.coordinates.map((line) => `(${line.map(formatPosition).join(\",\")})`).join(\",\")})`;\n\t\tcase \"MultiPolygon\": return `${sridPrefix}MULTIPOLYGON(${value.coordinates.map((poly) => `(${formatRings(poly)})`).join(\",\")})`;\n\t}\n}\nfunction formatPosition(p) {\n\tif (!Number.isFinite(p[0]) || !Number.isFinite(p[1])) throw postgisError(\"RUNTIME.ENCODE_FAILED\", \"Geometry encode: coordinates must be finite numbers\");\n\treturn `${p[0]} ${p[1]}`;\n}\nfunction formatRings(rings) {\n\treturn rings.map((ring) => `(${ring.map(formatPosition).join(\",\")})`).join(\",\");\n}\n//#endregion\n//#region src/core/data-types.ts\nconst postgisGeometryParams = type({ \"srid?\": \"number.integer >= 1\" });\nconst HEX_TEXT = /^(?:[0-9A-Fa-f]{2})*$/;\n/** The geometry HEXEWKB holds, or `undefined` when it is not EWKB. */\nfunction geometryOf(hex) {\n\ttry {\n\t\treturn decodeEWKBHex(hex);\n\t} catch (error) {\n\t\tif (isInternalError(error)) throw error;\n\t\treturn;\n\t}\n}\n/**\n* Reads HEXEWKB in either case and byte order; {@link spellGeometry} writes the upper-case little-endian HEXEWKB PostGIS prints. A column with an SRID holds only geometries in that SRID, as PostGIS refuses any other.\n*/\nconst readGeometry = (json, params) => {\n\tconst hex = readJsonMatching(\"postgis/geometry\", json, HEX_TEXT, \"a HEXEWKB string\");\n\tconst srid = params[\"srid\"];\n\tconst geometry = geometryOf(hex);\n\tif (geometry === void 0 || typeof srid === \"number\" && geometry.srid !== srid) return refuseJsonValue(\"postgis/geometry\", typeof srid === \"number\" ? `a HEXEWKB string of a geometry with SRID ${srid}` : \"a HEXEWKB string\", json);\n\treturn json;\n};\n/** The upper-case little-endian HEXEWKB PostGIS prints for the geometry. */\nconst spellGeometry = (json) => {\n\tconst geometry = typeof json === \"string\" ? geometryOf(json) : void 0;\n\treturn geometry === void 0 ? json : encodeEWKBHex(geometry);\n};\nconst postgisGeometry = sqlDataType(\"postgis/geometry\", {\n\tparams: postgisGeometryParams,\n\tread: readGeometry,\n\tspell: spellGeometry,\n\ttexts: [{\n\t\ttext: \"geometry\",\n\t\twritten: true,\n\t\tcatalog: true\n\t}, {\n\t\ttext: \"geometry(geometry,{srid})\",\n\t\twritten: true,\n\t\tcatalog: true,\n\t\tdisplay: \"geometry(Geometry,{srid})\"\n\t}],\n\tcasts: { [pgText.id]: (value) => value }\n});\nconst postgisDataTypes = [postgisGeometry];\n//#endregion\n//#region src/core/codecs.ts\n/**\n* Geometry codec for the PostGIS extension.\n*\n* Mirrors the descriptor + class pattern used by other codec-shipping\n* packages (e.g. pgvector). Three artefacts:\n*\n* 1. `PostgisGeometryCodec` extends {@link CodecImpl} with the runtime\n* encode/decode conversions. Wire formats:\n* - encode: EWKT (`'SRID=4326;POINT(...)'`) — PostgreSQL parses\n* this when cast to `::geometry`.\n* - decode: hex EWKB — the default representation `node-postgres`\n* hands back for `geometry` columns. We parse it into a\n* GeoJSON-shaped object so callers see structured data, not\n* opaque hex.\n* 2. `PostgisGeometryDescriptor` extends {@link PostgresCodecDescriptor} with the codec id, traits, the `postgis/geometry` data type and its params schema (`{ srid?: number }`), and explicit target behavior. Every column reads as `Geometry`, whatever its SRID. The data type declares the type's name and the bound of `srid`.\n* 3. `pgGeometryColumn({ srid })` per-codec column helper invoking `descriptor.factory({ srid })`.\n*\n* The geometry codec's encode/decode is parameter-independent — the\n* wire format already carries SRID inside the EWKT/EWKB payload, so the\n* resolved codec for every `(srid)` instance is the same shared codec\n* today. The factory threads the closure for future per-instance state\n* (e.g. SRID cross-checks) without rewriting the constructor.\n*/\nconst allowedGeometryTypes = /* @__PURE__ */ new Set([\n\t\"Point\",\n\t\"LineString\",\n\t\"Polygon\",\n\t\"MultiPoint\",\n\t\"MultiLineString\",\n\t\"MultiPolygon\"\n]);\nfunction assertGeometry(value) {\n\tif (!value || typeof value !== \"object\") throw postgisError(\"RUNTIME.ENCODE_FAILED\", \"Geometry value must be a GeoJSON-shaped object\", { meta: { codecId: POSTGIS_GEOMETRY_CODEC_ID } });\n\tconst type = value.type;\n\tif (typeof type !== \"string\" || !allowedGeometryTypes.has(type)) throw postgisError(\"RUNTIME.ENCODE_FAILED\", `Geometry value: unsupported type \"${String(type)}\" (expected Point, LineString, Polygon, MultiPoint, MultiLineString, or MultiPolygon)`, { meta: { codecId: POSTGIS_GEOMETRY_CODEC_ID } });\n\tif (!Array.isArray(value.coordinates)) throw postgisError(\"RUNTIME.ENCODE_FAILED\", \"Geometry value: \\\"coordinates\\\" must be an array\", { meta: { codecId: POSTGIS_GEOMETRY_CODEC_ID } });\n}\nvar PostgisGeometryCodec = class extends CodecImpl {\n\tconstructor(descriptor, params) {\n\t\tsuper(descriptor, postgisGeometry, params);\n\t}\n\tasync toWire(value, _ctx) {\n\t\tassertGeometry(value);\n\t\treturn encodeEWKT(value);\n\t}\n\tasync fromWire(wire, _ctx) {\n\t\tif (typeof wire !== \"string\") throw postgisError(\"RUNTIME.DECODE_FAILED\", \"Geometry wire value must be a string\", { meta: { codecId: POSTGIS_GEOMETRY_CODEC_ID } });\n\t\treturn decodeEWKBHex(wire);\n\t}\n\tfromDataTypeValue(value) {\n\t\treturn decodeEWKBHex(value.value);\n\t}\n\ttoDataTypeValue(input) {\n\t\tassertGeometry(input);\n\t\treturn this.dataTypeValueOf(encodeEWKBHex(input));\n\t}\n};\nvar PostgisGeometryDescriptor = class extends PostgresCodecDescriptor {\n\t/** The HEXEWKB text PostgreSQL prints for a geometry, which `fromWire` reads as it reads a row. A JSON constructor handed the geometry itself may write GeoJSON instead. */\n\tjsonProjection(expression) {\n\t\treturn CastExpr.as(expression, \"text\");\n\t}\n\tdataType = postgisGeometry.id;\n\tcodecId = POSTGIS_GEOMETRY_CODEC_ID;\n\ttraits = [\"equality\"];\n\tenumRefusal = \"Enums over a geometry codec are not supported yet, because no test proves that a shape reads back as its member. Use a text enum that names each shape instead.\";\n\tparamsSchema = postgisGeometryParams;\n\t/**\n\t* Runtime materialization uses an empty parameter object for the\n\t* existing unparameterized `geometryColumn` variant and `{ srid }` for\n\t* constrained columns. Both resolve to the same SRID-agnostic codec:\n\t* the wire format already carries SRID inside the EWKT/EWKB payload,\n\t* so codec behavior is parameter-independent.\n\t*/\n\tfactory(params) {\n\t\treturn () => new PostgisGeometryCodec(this, params ?? {});\n\t}\n};\nconst codecDescriptorMap = { geometry: new PostgisGeometryDescriptor() };\n//#endregion\n//#region src/core/registry.ts\n/**\n* Registry of every codec descriptor shipped by `@internal/extension-postgis`.\n*\n* Public consumer surface for the postgis codec set. Currently a single\n* entry (`pg/geometry@1`); the registry shape stays consistent with\n* the other codec-shipping packages so consumers don't need to\n* special-case extensions.\n*/\nconst postgisCodecRegistry = buildCodecDescriptorRegistry(definePostgresCodecs(Object.values(codecDescriptorMap)));\n//#endregion\n//#region src/core/descriptor-meta.ts\nconst postgisTypeId = \"pg/geometry@1\";\n/**\n* Build the PostGIS query operations exposed on `geometry` columns.\n*\n* Each operation lowers to a function-template that the SQL renderer\n* stitches into the surrounding statement (`{{self}}` is the receiver,\n* `{{argN}}` are the call arguments). All templates rely on the implicit\n* `geometry`/`float8`/`bool` casts already wired up by the SQL family —\n* we only add the PostGIS-specific function names.\n*/\nfunction postgisQueryOperations() {\n\treturn {\n\t\tdistance: {\n\t\t\tself: { codecId: postgisTypeId },\n\t\t\timpl: (self, other) => {\n\t\t\t\tconst selfCodec = codecOf(self);\n\t\t\t\treturn buildOperation({\n\t\t\t\t\tmethod: \"distance\",\n\t\t\t\t\targs: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n\t\t\t\t\treturns: {\n\t\t\t\t\t\tcodecId: \"pg/float8@1\",\n\t\t\t\t\t\tnullable: false\n\t\t\t\t\t},\n\t\t\t\t\tlowering: {\n\t\t\t\t\t\ttargetFamily: \"sql\",\n\t\t\t\t\t\ttemplate: \"ST_Distance({{self}}, {{arg0}})\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tdistanceSphere: {\n\t\t\tself: { codecId: postgisTypeId },\n\t\t\timpl: (self, other) => {\n\t\t\t\tconst selfCodec = codecOf(self);\n\t\t\t\treturn buildOperation({\n\t\t\t\t\tmethod: \"distanceSphere\",\n\t\t\t\t\targs: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n\t\t\t\t\treturns: {\n\t\t\t\t\t\tcodecId: \"pg/float8@1\",\n\t\t\t\t\t\tnullable: false\n\t\t\t\t\t},\n\t\t\t\t\tlowering: {\n\t\t\t\t\t\ttargetFamily: \"sql\",\n\t\t\t\t\t\ttemplate: \"ST_DistanceSphere({{self}}, {{arg0}})\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tdwithin: {\n\t\t\tself: { codecId: postgisTypeId },\n\t\t\timpl: (self, other, distance) => {\n\t\t\t\tconst selfCodec = codecOf(self);\n\t\t\t\treturn buildOperation({\n\t\t\t\t\tmethod: \"dwithin\",\n\t\t\t\t\targs: [\n\t\t\t\t\t\ttoExpr(self, selfCodec),\n\t\t\t\t\t\ttoExpr(other, selfCodec),\n\t\t\t\t\t\ttoExpr(distance, { codecId: \"pg/float8@1\" })\n\t\t\t\t\t],\n\t\t\t\t\treturns: {\n\t\t\t\t\t\tcodecId: \"pg/bool@1\",\n\t\t\t\t\t\tnullable: false\n\t\t\t\t\t},\n\t\t\t\t\tlowering: {\n\t\t\t\t\t\ttargetFamily: \"sql\",\n\t\t\t\t\t\ttemplate: \"ST_DWithin({{self}}, {{arg0}}, {{arg1}})\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tcontains: {\n\t\t\tself: { codecId: postgisTypeId },\n\t\t\timpl: (self, other) => {\n\t\t\t\tconst selfCodec = codecOf(self);\n\t\t\t\treturn buildOperation({\n\t\t\t\t\tmethod: \"contains\",\n\t\t\t\t\targs: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n\t\t\t\t\treturns: {\n\t\t\t\t\t\tcodecId: \"pg/bool@1\",\n\t\t\t\t\t\tnullable: false\n\t\t\t\t\t},\n\t\t\t\t\tlowering: {\n\t\t\t\t\t\ttargetFamily: \"sql\",\n\t\t\t\t\t\ttemplate: \"ST_Contains({{self}}, {{arg0}})\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\twithin: {\n\t\t\tself: { codecId: postgisTypeId },\n\t\t\timpl: (self, other) => {\n\t\t\t\tconst selfCodec = codecOf(self);\n\t\t\t\treturn buildOperation({\n\t\t\t\t\tmethod: \"within\",\n\t\t\t\t\targs: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n\t\t\t\t\treturns: {\n\t\t\t\t\t\tcodecId: \"pg/bool@1\",\n\t\t\t\t\t\tnullable: false\n\t\t\t\t\t},\n\t\t\t\t\tlowering: {\n\t\t\t\t\t\ttargetFamily: \"sql\",\n\t\t\t\t\t\ttemplate: \"ST_Within({{self}}, {{arg0}})\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tintersects: {\n\t\t\tself: { codecId: postgisTypeId },\n\t\t\timpl: (self, other) => {\n\t\t\t\tconst selfCodec = codecOf(self);\n\t\t\t\treturn buildOperation({\n\t\t\t\t\tmethod: \"intersects\",\n\t\t\t\t\targs: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n\t\t\t\t\treturns: {\n\t\t\t\t\t\tcodecId: \"pg/bool@1\",\n\t\t\t\t\t\tnullable: false\n\t\t\t\t\t},\n\t\t\t\t\tlowering: {\n\t\t\t\t\t\ttargetFamily: \"sql\",\n\t\t\t\t\t\ttemplate: \"ST_Intersects({{self}}, {{arg0}})\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tintersectsBbox: {\n\t\t\tself: { codecId: postgisTypeId },\n\t\t\timpl: (self, other) => {\n\t\t\t\tconst selfCodec = codecOf(self);\n\t\t\t\treturn buildOperation({\n\t\t\t\t\tmethod: \"intersectsBbox\",\n\t\t\t\t\targs: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n\t\t\t\t\treturns: {\n\t\t\t\t\t\tcodecId: \"pg/bool@1\",\n\t\t\t\t\t\tnullable: false\n\t\t\t\t\t},\n\t\t\t\t\tlowering: {\n\t\t\t\t\t\ttargetFamily: \"sql\",\n\t\t\t\t\t\ttemplate: \"({{self}} && {{arg0}})\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n}\nconst postgisPackMeta = {\n\tkind: \"extension\",\n\tid: \"postgis\",\n\tfamilyId: \"sql\",\n\ttargetId: \"postgres\",\n\tversion: \"0.0.1\",\n\tcapabilities: { postgres: { \"postgis.geometry\": true } },\n\tauthoring: { type: postgisAuthoringTypes },\n\tdataTypes: postgisDataTypes,\n\ttypes: {\n\t\tcodecTypes: {\n\t\t\tcodecDescriptors: Array.from(postgisCodecRegistry.values()),\n\t\t\timport: {\n\t\t\t\tpackage: \"@internal/extension-postgis/codec-types\",\n\t\t\t\tnamed: \"CodecTypes\",\n\t\t\t\talias: \"PostgisTypes\"\n\t\t\t}\n\t\t},\n\t\tqueryOperationTypes: { import: {\n\t\t\tpackage: \"@internal/extension-postgis/operation-types\",\n\t\t\tnamed: \"QueryOperationTypes\",\n\t\t\talias: \"PostgisQueryOperationTypes\"\n\t\t} }\n\t}\n};\n//#endregion\nexport { postgisQueryOperations as n, postgisCodecRegistry as r, postgisPackMeta as t };\n\n//# sourceMappingURL=descriptor-meta-CtaX_u3u.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,MAAM,wBAAwB,EAAE,SAAS,EAAE,UAAU;CACpD,MAAM;CACN,UAAU;CACV,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AAE;CACH;AACD"}
@@ -1,6 +1,6 @@
1
1
  import { CodecExpression, Expression } from "@prisma/orm-family-sql/relational-core/expression";
2
- import { SqlQueryOperationTypes } from "@prisma/orm-family-sql/contract/types";
3
- //#region ../../../3-extensions/postgis/dist/operation-types-_DWme6Gj.d.mts
2
+ import { QueryOperationTypesFunction, SqlQueryOperationTypes } from "@prisma/orm-family-sql/contract/types";
3
+ //#region ../../../3-extensions/postgis/dist/operation-types-Bp_qdbiq.d.mts
4
4
  //#region src/types/operation-types.d.ts
5
5
  type CodecTypesBase = Record<string, {
6
6
  readonly input: unknown;
@@ -118,6 +118,10 @@ type QueryOperationTypes<CT extends CodecTypesBase> = SqlQueryOperationTypes<CT,
118
118
  }>;
119
119
  };
120
120
  }>;
121
+ /** {@link QueryOperationTypes} as a function of the contract's codec types, for a contract written in TypeScript. */
122
+ interface QueryOperationTypesForCodecs extends QueryOperationTypesFunction {
123
+ readonly queryOperationTypes: QueryOperationTypes<this['codecTypes']>;
124
+ }
121
125
  //#endregion
122
- export { QueryOperationTypes as n, OperationTypes as t };
123
- //# sourceMappingURL=operation-types-_DWme6Gj-DddnbZus.d.mts.map
126
+ export { QueryOperationTypes as n, QueryOperationTypesForCodecs as r, OperationTypes as t };
127
+ //# sourceMappingURL=operation-types-Bp_qdbiq-V0NR-y_j.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"operation-types-_DWme6Gj-DddnbZus.d.mts","names":[],"sources":["../../../../3-extensions/postgis/dist/operation-types-_DWme6Gj.d.mts"],"mappings":";;;;KAGK,iBAAiB;WACX;WACA;;;;;;;;;;KAUN;WACM;aACE;eACE;iBACE;;;aAGJ;eACE;iBACE;;;aAGJ;eACE;iBACE;;;aAGJ;eACE;iBACE;;;aAGJ;eACE;iBACE;;;aAGJ;eACE;iBACE;;;aAGJ;eACE;iBACE;;;;;KAKZ,oBAAoB,WAAW,kBAAkB,uBAAuB;WAClE;aACE;eACE;;aAEF,OAAO,MAAM,0CAA0C,KAAK,OAAO,0CAA0C,QAAQ;MAC5H;MACA;;;WAGK;aACE;eACE;;aAEF,OAAO,MAAM,0CAA0C,KAAK,OAAO,0CAA0C,QAAQ;MAC5H;MACA;;;WAGK;aACE;eACE;;aAEF,OAAO,MAAM,0CAA0C,KAAK,OAAO,0CAA0C,KAAK,UAAU,wCAAwC,QAAQ;MACnL;MACA;;;WAGK;aACE;eACE;;aAEF,OAAO,MAAM,0CAA0C,KAAK,OAAO,0CAA0C,QAAQ;MAC5H;MACA;;;WAGK;aACE;eACE;;aAEF,OAAO,MAAM,0CAA0C,KAAK,OAAO,0CAA0C,QAAQ;MAC5H;MACA;;;WAGK;aACE;eACE;;aAEF,OAAO,MAAM,0CAA0C,KAAK,OAAO,0CAA0C,QAAQ;MAC5H;MACA;;;WAGK;aACE;eACE;;aAEF,OAAO,MAAM,0CAA0C,KAAK,OAAO,0CAA0C,QAAQ;MAC5H;MACA"}
1
+ {"version":3,"file":"operation-types-Bp_qdbiq-V0NR-y_j.d.mts","names":[],"sources":["../../../../3-extensions/postgis/dist/operation-types-Bp_qdbiq.d.mts"],"mappings":";;;;KAGK,iBAAiB;WACX;WACA;;;;;;;;;;KAUN;WACM;aACE;eACE;iBACE;;;aAGJ;eACE;iBACE;;;aAGJ;eACE;iBACE;;;aAGJ;eACE;iBACE;;;aAGJ;eACE;iBACE;;;aAGJ;eACE;iBACE;;;aAGJ;eACE;iBACE;;;;;KAKZ,oBAAoB,WAAW,kBAAkB,uBAAuB;WAClE;aACE;eACE;;aAEF,OAAO,MAAM,0CAA0C,KAAK,OAAO,0CAA0C,QAAQ;MAC5H;MACA;;;WAGK;aACE;eACE;;aAEF,OAAO,MAAM,0CAA0C,KAAK,OAAO,0CAA0C,QAAQ;MAC5H;MACA;;;WAGK;aACE;eACE;;aAEF,OAAO,MAAM,0CAA0C,KAAK,OAAO,0CAA0C,KAAK,UAAU,wCAAwC,QAAQ;MACnL;MACA;;;WAGK;aACE;eACE;;aAEF,OAAO,MAAM,0CAA0C,KAAK,OAAO,0CAA0C,QAAQ;MAC5H;MACA;;;WAGK;aACE;eACE;;aAEF,OAAO,MAAM,0CAA0C,KAAK,OAAO,0CAA0C,QAAQ;MAC5H;MACA;;;WAGK;aACE;eACE;;aAEF,OAAO,MAAM,0CAA0C,KAAK,OAAO,0CAA0C,QAAQ;MAC5H;MACA;;;WAGK;aACE;eACE;;aAEF,OAAO,MAAM,0CAA0C,KAAK,OAAO,0CAA0C,QAAQ;MAC5H;MACA;;;;;UAKI,qCAAqC;WACpC,qBAAqB"}
@@ -1,2 +1,2 @@
1
- import { n as QueryOperationTypes, t as OperationTypes } from "./operation-types-_DWme6Gj-DddnbZus.mjs";
2
- export type { OperationTypes, QueryOperationTypes };
1
+ import { n as QueryOperationTypes, r as QueryOperationTypesForCodecs, t as OperationTypes } from "./operation-types-Bp_qdbiq-V0NR-y_j.mjs";
2
+ export type { OperationTypes, QueryOperationTypes, QueryOperationTypesForCodecs };
package/dist/pack.d.mts CHANGED
@@ -1,5 +1,6 @@
1
- import { t as CodecTypes } from "./codec-types-M7J4vkfS-DOzWmEmw.mjs";
2
- import "./operation-types-_DWme6Gj-DddnbZus.mjs";
1
+ import { t as Geometry } from "./geojson-L3qRlIZY-DLhY3CUa.mjs";
2
+ import { t as CodecTypes } from "./codec-types-z7Np9YhQ-Bu0aHOzI.mjs";
3
+ import { r as QueryOperationTypesForCodecs } from "./operation-types-Bp_qdbiq-V0NR-y_j.mjs";
3
4
  //#region ../../../3-extensions/postgis/dist/pack.d.mts
4
5
  //#region src/core/descriptor-meta.d.ts
5
6
  declare const postgisPackMetaBase: {
@@ -18,15 +19,15 @@ declare const postgisPackMetaBase: {
18
19
  readonly postgis: {
19
20
  readonly Geometry: {
20
21
  readonly kind: "typeConstructor";
22
+ readonly inferred: true;
21
23
  readonly args: readonly [{
22
- readonly kind: "number";
24
+ readonly kind: "value";
25
+ readonly dataType: "pg/int4";
23
26
  readonly name: "srid";
24
- readonly integer: true;
25
- readonly minimum: 0;
27
+ readonly optional: true;
26
28
  }];
27
29
  readonly output: {
28
30
  readonly codecId: "pg/geometry@1";
29
- readonly nativeType: "geometry";
30
31
  readonly typeParams: {
31
32
  readonly srid: {
32
33
  readonly kind: "arg";
@@ -38,6 +39,7 @@ declare const postgisPackMetaBase: {
38
39
  };
39
40
  };
40
41
  };
42
+ readonly dataTypes: readonly import("@prisma/orm-framework/components/codec").DataType[];
41
43
  readonly types: {
42
44
  readonly codecTypes: {
43
45
  readonly codecDescriptors: import("@prisma/orm-framework/components/codec").CodecDescriptor<unknown>[];
@@ -46,11 +48,6 @@ declare const postgisPackMetaBase: {
46
48
  readonly named: "CodecTypes";
47
49
  readonly alias: "PostgisTypes";
48
50
  };
49
- readonly typeImports: readonly [{
50
- readonly package: "@internal/extension-postgis/codec-types";
51
- readonly named: "Geometry";
52
- readonly alias: "Geometry";
53
- }];
54
51
  };
55
52
  readonly queryOperationTypes: {
56
53
  readonly import: {
@@ -59,17 +56,12 @@ declare const postgisPackMetaBase: {
59
56
  readonly alias: "PostgisQueryOperationTypes";
60
57
  };
61
58
  };
62
- readonly storage: readonly [{
63
- readonly typeId: "pg/geometry@1";
64
- readonly familyId: "sql";
65
- readonly targetId: "postgres";
66
- readonly nativeType: "geometry";
67
- }];
68
59
  };
69
60
  };
70
61
  declare const postgisPackMeta: typeof postgisPackMetaBase & {
71
62
  readonly __codecTypes?: CodecTypes;
63
+ readonly __queryOperationTypes?: QueryOperationTypesForCodecs;
72
64
  };
73
65
  //#endregion
74
- export { postgisPackMeta as default };
66
+ export { type CodecTypes, type Geometry, type QueryOperationTypesForCodecs, postgisPackMeta as default };
75
67
  //# sourceMappingURL=pack.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pack.d.mts","names":[],"sources":["../../../../3-extensions/postgis/dist/pack.d.mts"],"mappings":";;;;cAGc;WACH;WACA;WACA;WACA;WACA;WACA;aACE;eACE;;;WAGJ;aACE;eACE;iBACE;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;;;;;;WAQd;aACE;eACE,iEAAiE;eACjE;iBACE;iBACA;iBACA;;eAEF;iBACE;iBACA;iBACA;;;aAGJ;eACE;iBACE;iBACA;iBACA;;;aAGJ;eACE;eACA;eACA;eACA;;;;cAID,wBAAwB;WAC3B,eAAe"}
1
+ {"version":3,"file":"pack.d.mts","names":[],"sources":["../../../../3-extensions/postgis/dist/pack.d.mts"],"mappings":";;;;;cAIc;WACH;WACA;WACA;WACA;WACA;WACA;aACE;eACE;;;WAGJ;aACE;eACE;iBACE;mBACE;mBACA;mBACA;qBACE;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;uBACE;yBACE;yBACA;;;;;;;;WAQd,mEAAmE;WACnE;aACE;eACE,iEAAiE;eACjE;iBACE;iBACA;iBACA;;;aAGJ;eACE;iBACE;iBACA;iBACA;;;;;cAKH,wBAAwB;WAC3B,eAAe;WACf,wBAAwB"}
package/dist/pack.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as postgisPackMeta } from "./descriptor-meta-deM0Qc_b-FRxKhllA.mjs";
1
+ import { n as postgisPackMeta } from "./descriptor-meta-CtaX_u3u-DVoekCn0.mjs";
2
2
  export { postgisPackMeta as default };
package/dist/runtime.mjs CHANGED
@@ -1,9 +1,10 @@
1
- import { n as postgisPackMeta, r as postgisQueryOperations, t as postgisCodecRegistry } from "./descriptor-meta-deM0Qc_b-FRxKhllA.mjs";
1
+ import { n as postgisPackMeta, r as postgisQueryOperations, t as postgisCodecRegistry } from "./descriptor-meta-CtaX_u3u-DVoekCn0.mjs";
2
2
  //#region ../../../3-extensions/postgis/dist/runtime.mjs
3
3
  const postgisRuntimeDescriptor = {
4
4
  kind: "extension",
5
5
  id: postgisPackMeta.id,
6
6
  version: postgisPackMeta.version,
7
+ dataTypes: postgisPackMeta.dataTypes,
7
8
  familyId: "sql",
8
9
  targetId: "postgres",
9
10
  types: { codecTypes: { codecDescriptors: Array.from(postgisCodecRegistry.values()) } },
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.mjs","names":[],"sources":["../../../../3-extensions/postgis/dist/runtime.mjs"],"sourcesContent":["import { n as postgisQueryOperations, r as postgisCodecRegistry, t as postgisPackMeta } from \"./descriptor-meta-deM0Qc_b.mjs\";\n//#region src/exports/runtime.ts\nconst postgisRuntimeDescriptor = {\n\tkind: \"extension\",\n\tid: postgisPackMeta.id,\n\tversion: postgisPackMeta.version,\n\tfamilyId: \"sql\",\n\ttargetId: \"postgres\",\n\ttypes: { codecTypes: { codecDescriptors: Array.from(postgisCodecRegistry.values()) } },\n\tcodecs: () => Array.from(postgisCodecRegistry.values()),\n\tqueryOperations: () => postgisQueryOperations(),\n\tcreate() {\n\t\treturn {\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"postgres\"\n\t\t};\n\t}\n};\n//#endregion\nexport { postgisRuntimeDescriptor as default, postgisCodecRegistry };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;AAEA,MAAM,2BAA2B;CAChC,MAAM;CACN,IAAI,gBAAgB;CACpB,SAAS,gBAAgB;CACzB,UAAU;CACV,UAAU;CACV,OAAO,EAAE,YAAY,EAAE,kBAAkB,MAAM,KAAK,qBAAqB,OAAO,CAAC,EAAE,EAAE;CACrF,cAAc,MAAM,KAAK,qBAAqB,OAAO,CAAC;CACtD,uBAAuB,uBAAuB;CAC9C,SAAS;EACR,OAAO;GACN,UAAU;GACV,UAAU;EACX;CACD;AACD"}
1
+ {"version":3,"file":"runtime.mjs","names":[],"sources":["../../../../3-extensions/postgis/dist/runtime.mjs"],"sourcesContent":["import { n as postgisQueryOperations, r as postgisCodecRegistry, t as postgisPackMeta } from \"./descriptor-meta-CtaX_u3u.mjs\";\n//#region src/exports/runtime.ts\nconst postgisRuntimeDescriptor = {\n\tkind: \"extension\",\n\tid: postgisPackMeta.id,\n\tversion: postgisPackMeta.version,\n\tdataTypes: postgisPackMeta.dataTypes,\n\tfamilyId: \"sql\",\n\ttargetId: \"postgres\",\n\ttypes: { codecTypes: { codecDescriptors: Array.from(postgisCodecRegistry.values()) } },\n\tcodecs: () => Array.from(postgisCodecRegistry.values()),\n\tqueryOperations: () => postgisQueryOperations(),\n\tcreate() {\n\t\treturn {\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"postgres\"\n\t\t};\n\t}\n};\n//#endregion\nexport { postgisRuntimeDescriptor as default, postgisCodecRegistry };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;AAEA,MAAM,2BAA2B;CAChC,MAAM;CACN,IAAI,gBAAgB;CACpB,SAAS,gBAAgB;CACzB,WAAW,gBAAgB;CAC3B,UAAU;CACV,UAAU;CACV,OAAO,EAAE,YAAY,EAAE,kBAAkB,MAAM,KAAK,qBAAqB,OAAO,CAAC,EAAE,EAAE;CACrF,cAAc,MAAM,KAAK,qBAAqB,OAAO,CAAC;CACtD,uBAAuB,uBAAuB;CAC9C,SAAS;EACR,OAAO;GACN,UAAU;GACV,UAAU;EACX;CACD;AACD"}
package/package.json CHANGED
@@ -1,30 +1,30 @@
1
1
  {
2
2
  "name": "@prisma/orm-extension-postgis",
3
- "version": "8.0.0-rc.2-dev.2",
3
+ "version": "8.0.0-rc.20",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
- "description": "PostGIS geometry types, operators, and indexes for Prisma Next",
7
+ "description": "PostGIS geometry types, operators, and indexes for Prisma 8",
8
8
  "files": [
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@prisma/orm-family-sql": "8.0.0-rc.2-dev.2",
13
- "@prisma/orm-framework": "8.0.0-rc.2-dev.2",
14
- "@prisma/orm-toolchain": "8.0.0-rc.2-dev.2",
12
+ "@prisma/orm-family-sql": "8.0.0-rc.20",
13
+ "@prisma/orm-framework": "8.0.0-rc.20",
14
+ "@prisma/orm-toolchain": "8.0.0-rc.20",
15
15
  "@standard-schema/spec": "^1.1.0",
16
16
  "arktype": "^2.2.2"
17
17
  },
18
18
  "devDependencies": {
19
- "@internal/extension-postgis": "8.0.0-rc.2-dev.2",
20
- "@repo/tsconfig": "8.0.0-rc.2-dev.2",
21
- "@repo/tsdown": "8.0.0-rc.2-dev.2",
22
- "@prisma/orm-target-postgres": "8.0.0-rc.2-dev.2",
19
+ "@internal/extension-postgis": "8.0.0-rc.20",
20
+ "@repo/tsconfig": "8.0.0-rc.20",
21
+ "@repo/tsdown": "8.0.0-rc.20",
22
+ "@prisma/orm-target-postgres": "8.0.0-rc.20",
23
23
  "tsdown": "0.22.14",
24
24
  "typescript": "5.9.3"
25
25
  },
26
26
  "peerDependencies": {
27
- "@prisma/orm-target-postgres": "8.0.0-rc.2-dev.2",
27
+ "@prisma/orm-target-postgres": "8.0.0-rc.20",
28
28
  "typescript": ">=5.9"
29
29
  },
30
30
  "peerDependenciesMeta": {
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "repository": {
46
46
  "type": "git",
47
- "url": "https://github.com/prisma/prisma.git",
47
+ "url": "https://github.com/prisma/orm.git",
48
48
  "directory": "packages/9-public/@prisma/orm-extension-postgis"
49
49
  },
50
50
  "scripts": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"codec-types-M7J4vkfS-DOzWmEmw.d.mts","names":[],"sources":["../../../../3-extensions/postgis/dist/codec-types-M7J4vkfS.d.mts"],"mappings":";;;;;;;;cAOc;;;KAGT;WACM;;cAEG,6BAA6B,iBAAiB,0DAA0D;EACpH,YAAY,YAAY;EACxB,OAAO,OAAO,YAAY,MAAM,mBAAmB;EACnD,OAAO,cAAc,MAAM,mBAAmB,QAAQ;EACtD,WAAW,OAAO,aAAa;EAC/B,WAAW,MAAM,YAAY;;cAEjB,kCAAkC,wBAAwB;YAC5D;YACA,eAAe,YAAY,iBAAiB;WAC7C;WACA;WACA;WACA,cAAc,iBAAiB;EACxC,iBAAiB,QAAQ;;;;;;;;EAQzB,QAAQ,SAAS,kBAAkB,KAAK,yBAAyB;;cAErD;WACH,UAAU;;KAEhB,eAAe,yBAAyB;;;KAGxC,SAAS,iCAAiC;KAC1C,aAAa"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"descriptor-meta-deM0Qc_b-FRxKhllA.mjs","names":[],"sources":["../../../../3-extensions/postgis/dist/descriptor-meta-deM0Qc_b.mjs"],"sourcesContent":["import { t as POSTGIS_GEOMETRY_CODEC_ID } from \"./constants-CWW72xGt.mjs\";\nimport { t as postgisError } from \"./errors-Bg6kDFR-.mjs\";\nimport { buildOperation, codecOf, toExpr } from \"@internal/sql-relational-core/expression\";\nimport { buildCodecDescriptorRegistry } from \"@internal/sql-relational-core/codec-descriptor-registry\";\nimport { CodecImpl } from \"@internal/framework-components/codec\";\nimport { PostgresCodecDescriptor, definePostgresCodecs } from \"@internal/target-postgres/codec-descriptor\";\nimport { type } from \"arktype\";\n//#region src/core/authoring.ts\nconst postgisAuthoringTypes = { postgis: { Geometry: {\n\tkind: \"typeConstructor\",\n\targs: [{\n\t\tkind: \"number\",\n\t\tname: \"srid\",\n\t\tinteger: true,\n\t\tminimum: 0\n\t}],\n\toutput: {\n\t\tcodecId: POSTGIS_GEOMETRY_CODEC_ID,\n\t\tnativeType: \"geometry\",\n\t\ttypeParams: { srid: {\n\t\t\tkind: \"arg\",\n\t\t\tindex: 0\n\t\t} }\n\t}\n} } };\n//#endregion\n//#region src/core/ewkb.ts\n/**\n* Minimal EWKB (Extended Well-Known Binary) reader for the PostGIS codec.\n*\n* `node-postgres` returns geometry columns as hex-encoded EWKB strings by\n* default. This reader parses the subset we ship with the extension —\n* Point, LineString, Polygon, and the Multi* counterparts — into GeoJSON\n* objects. Z and M coordinates are not supported; if a wire value carries\n* them, decoding throws so the caller can detect the mismatch instead of\n* silently dropping data.\n*/\nconst FLAG_Z = 2147483648;\nconst FLAG_M = 1073741824;\nconst FLAG_SRID = 536870912;\nconst TYPE_MASK = 536870911;\nconst TYPE_POINT = 1;\nconst TYPE_LINESTRING = 2;\nconst TYPE_POLYGON = 3;\nconst TYPE_MULTIPOINT = 4;\nconst TYPE_MULTILINESTRING = 5;\nconst TYPE_MULTIPOLYGON = 6;\nconst HEX_PAIR_RE = /^[0-9a-fA-F]{2}$/;\nfunction hexToBytes(hex) {\n\tif (hex.length % 2 !== 0) throw postgisError(\"RUNTIME.DECODE_FAILED\", \"Geometry wire value: odd-length hex string\", { meta: { wirePreview: hex.slice(0, 32) } });\n\tconst bytes = new Uint8Array(hex.length / 2);\n\tfor (let i = 0; i < bytes.length; i++) {\n\t\tconst pair = hex.slice(i * 2, i * 2 + 2);\n\t\tif (!HEX_PAIR_RE.test(pair)) throw postgisError(\"RUNTIME.DECODE_FAILED\", `Geometry wire value: invalid hex byte at offset ${i * 2}`, { meta: { wirePreview: hex.slice(0, 32) } });\n\t\tbytes[i] = Number.parseInt(pair, 16);\n\t}\n\treturn bytes;\n}\nvar Reader = class {\n\toffset = 0;\n\tview;\n\tconstructor(bytes) {\n\t\tthis.view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n\t}\n\trequireBytes(needed) {\n\t\tif (this.offset + needed > this.view.byteLength) throw postgisError(\"RUNTIME.DECODE_FAILED\", `Geometry wire value: unexpected end of buffer (need ${needed} bytes at offset ${this.offset}, ${this.view.byteLength - this.offset} available)`);\n\t}\n\treadUint8() {\n\t\tthis.requireBytes(1);\n\t\tconst v = this.view.getUint8(this.offset);\n\t\tthis.offset += 1;\n\t\treturn v;\n\t}\n\treadUint32(littleEndian) {\n\t\tthis.requireBytes(4);\n\t\tconst v = this.view.getUint32(this.offset, littleEndian);\n\t\tthis.offset += 4;\n\t\treturn v >>> 0;\n\t}\n\treadFloat64(littleEndian) {\n\t\tthis.requireBytes(8);\n\t\tconst v = this.view.getFloat64(this.offset, littleEndian);\n\t\tthis.offset += 8;\n\t\treturn v;\n\t}\n\thasRemaining() {\n\t\treturn this.offset !== this.view.byteLength;\n\t}\n\tremainingBytes() {\n\t\treturn this.view.byteLength - this.offset;\n\t}\n};\nvar Writer = class {\n\tbytes = [];\n\twriteUint8(value) {\n\t\tthis.bytes.push(value);\n\t}\n\twriteUint32(value) {\n\t\tconst buffer = /* @__PURE__ */ new ArrayBuffer(4);\n\t\tnew DataView(buffer).setUint32(0, value, true);\n\t\tthis.bytes.push(...new Uint8Array(buffer));\n\t}\n\twriteFloat64(value) {\n\t\tconst buffer = /* @__PURE__ */ new ArrayBuffer(8);\n\t\tnew DataView(buffer).setFloat64(0, value, true);\n\t\tthis.bytes.push(...new Uint8Array(buffer));\n\t}\n\ttoHex() {\n\t\treturn this.bytes.map((byte) => byte.toString(16).padStart(2, \"0\")).join(\"\").toUpperCase();\n\t}\n};\nfunction readHeader(reader) {\n\tconst byteOrder = reader.readUint8();\n\tif (byteOrder !== 0 && byteOrder !== 1) throw postgisError(\"RUNTIME.DECODE_FAILED\", `Geometry wire value: invalid byte order ${byteOrder}`);\n\tconst littleEndian = byteOrder === 1;\n\tconst typeCode = reader.readUint32(littleEndian);\n\tif ((typeCode & FLAG_Z) !== 0 || (typeCode & FLAG_M) !== 0) throw postgisError(\"RUNTIME.DECODE_FAILED\", \"Geometry wire value: Z/M coordinates are not supported\");\n\tconst geomType = typeCode & TYPE_MASK;\n\tif ((typeCode & FLAG_SRID) !== 0) return {\n\t\tgeomType,\n\t\tlittleEndian,\n\t\tsrid: reader.readUint32(littleEndian)\n\t};\n\treturn {\n\t\tgeomType,\n\t\tlittleEndian\n\t};\n}\nfunction readPosition(reader, littleEndian) {\n\treturn [reader.readFloat64(littleEndian), reader.readFloat64(littleEndian)];\n}\nfunction readPoint(reader, header) {\n\tconst coords = readPosition(reader, header.littleEndian);\n\treturn header.srid !== void 0 ? {\n\t\ttype: \"Point\",\n\t\tcoordinates: coords,\n\t\tsrid: header.srid\n\t} : {\n\t\ttype: \"Point\",\n\t\tcoordinates: coords\n\t};\n}\nfunction readLineString(reader, header) {\n\tconst n = reader.readUint32(header.littleEndian);\n\tconst coords = [];\n\tfor (let i = 0; i < n; i++) coords.push(readPosition(reader, header.littleEndian));\n\treturn header.srid !== void 0 ? {\n\t\ttype: \"LineString\",\n\t\tcoordinates: coords,\n\t\tsrid: header.srid\n\t} : {\n\t\ttype: \"LineString\",\n\t\tcoordinates: coords\n\t};\n}\nfunction readPolygon(reader, header) {\n\tconst numRings = reader.readUint32(header.littleEndian);\n\tconst rings = [];\n\tfor (let r = 0; r < numRings; r++) {\n\t\tconst n = reader.readUint32(header.littleEndian);\n\t\tconst ring = [];\n\t\tfor (let i = 0; i < n; i++) ring.push(readPosition(reader, header.littleEndian));\n\t\trings.push(ring);\n\t}\n\treturn header.srid !== void 0 ? {\n\t\ttype: \"Polygon\",\n\t\tcoordinates: rings,\n\t\tsrid: header.srid\n\t} : {\n\t\ttype: \"Polygon\",\n\t\tcoordinates: rings\n\t};\n}\nfunction readSubGeometry(reader) {\n\tconst header = readHeader(reader);\n\tswitch (header.geomType) {\n\t\tcase TYPE_POINT: return readPoint(reader, header);\n\t\tcase TYPE_LINESTRING: return readLineString(reader, header);\n\t\tcase TYPE_POLYGON: return readPolygon(reader, header);\n\t\tdefault: throw postgisError(\"RUNTIME.DECODE_FAILED\", `Geometry wire value: unsupported sub-type ${header.geomType}`);\n\t}\n}\nfunction readMultiPoint(reader, header) {\n\tconst n = reader.readUint32(header.littleEndian);\n\tconst coords = [];\n\tfor (let i = 0; i < n; i++) {\n\t\tconst sub = readSubGeometry(reader);\n\t\tif (sub.type !== \"Point\") throw postgisError(\"RUNTIME.DECODE_FAILED\", \"Geometry wire value: MultiPoint contains non-Point sub-geometry\");\n\t\tcoords.push(sub.coordinates);\n\t}\n\treturn header.srid !== void 0 ? {\n\t\ttype: \"MultiPoint\",\n\t\tcoordinates: coords,\n\t\tsrid: header.srid\n\t} : {\n\t\ttype: \"MultiPoint\",\n\t\tcoordinates: coords\n\t};\n}\nfunction readMultiLineString(reader, header) {\n\tconst n = reader.readUint32(header.littleEndian);\n\tconst lines = [];\n\tfor (let i = 0; i < n; i++) {\n\t\tconst sub = readSubGeometry(reader);\n\t\tif (sub.type !== \"LineString\") throw postgisError(\"RUNTIME.DECODE_FAILED\", \"Geometry wire value: MultiLineString contains non-LineString sub-geometry\");\n\t\tlines.push(sub.coordinates);\n\t}\n\treturn header.srid !== void 0 ? {\n\t\ttype: \"MultiLineString\",\n\t\tcoordinates: lines,\n\t\tsrid: header.srid\n\t} : {\n\t\ttype: \"MultiLineString\",\n\t\tcoordinates: lines\n\t};\n}\nfunction readMultiPolygon(reader, header) {\n\tconst n = reader.readUint32(header.littleEndian);\n\tconst polys = [];\n\tfor (let i = 0; i < n; i++) {\n\t\tconst sub = readSubGeometry(reader);\n\t\tif (sub.type !== \"Polygon\") throw postgisError(\"RUNTIME.DECODE_FAILED\", \"Geometry wire value: MultiPolygon contains non-Polygon sub-geometry\");\n\t\tpolys.push(sub.coordinates);\n\t}\n\treturn header.srid !== void 0 ? {\n\t\ttype: \"MultiPolygon\",\n\t\tcoordinates: polys,\n\t\tsrid: header.srid\n\t} : {\n\t\ttype: \"MultiPolygon\",\n\t\tcoordinates: polys\n\t};\n}\nfunction decodeEWKBHex(hex) {\n\tconst reader = new Reader(hexToBytes(hex));\n\tconst geometry = readGeometryBody(reader, readHeader(reader));\n\tif (reader.hasRemaining()) throw postgisError(\"RUNTIME.DECODE_FAILED\", `Geometry wire value: trailing data after geometry (${reader.remainingBytes()} bytes)`, { meta: { wirePreview: hex.slice(0, 32) } });\n\treturn geometry;\n}\nfunction encodeEWKBHex(value) {\n\tconst writer = new Writer();\n\twriteGeometry(writer, value);\n\treturn writer.toHex();\n}\nfunction writeHeader(writer, geomType, srid) {\n\twriter.writeUint8(1);\n\twriter.writeUint32(srid === void 0 ? geomType : geomType | FLAG_SRID);\n\tif (srid !== void 0) writer.writeUint32(srid);\n}\nfunction writePosition(writer, position) {\n\tif (!Number.isFinite(position[0]) || !Number.isFinite(position[1])) throw postgisError(\"RUNTIME.ENCODE_FAILED\", \"Geometry encode: coordinates must be finite numbers\");\n\twriter.writeFloat64(position[0]);\n\twriter.writeFloat64(position[1]);\n}\nfunction writeLineStringBody(writer, positions) {\n\twriter.writeUint32(positions.length);\n\tfor (const position of positions) writePosition(writer, position);\n}\nfunction writePolygonBody(writer, rings) {\n\twriter.writeUint32(rings.length);\n\tfor (const ring of rings) writeLineStringBody(writer, ring);\n}\nfunction writeGeometry(writer, value) {\n\tswitch (value.type) {\n\t\tcase \"Point\":\n\t\t\twriteHeader(writer, TYPE_POINT, value.srid);\n\t\t\twritePosition(writer, value.coordinates);\n\t\t\tbreak;\n\t\tcase \"LineString\":\n\t\t\twriteHeader(writer, TYPE_LINESTRING, value.srid);\n\t\t\twriteLineStringBody(writer, value.coordinates);\n\t\t\tbreak;\n\t\tcase \"Polygon\":\n\t\t\twriteHeader(writer, TYPE_POLYGON, value.srid);\n\t\t\twritePolygonBody(writer, value.coordinates);\n\t\t\tbreak;\n\t\tcase \"MultiPoint\":\n\t\t\twriteHeader(writer, TYPE_MULTIPOINT, value.srid);\n\t\t\twriter.writeUint32(value.coordinates.length);\n\t\t\tfor (const position of value.coordinates) {\n\t\t\t\twriteHeader(writer, TYPE_POINT);\n\t\t\t\twritePosition(writer, position);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"MultiLineString\":\n\t\t\twriteHeader(writer, TYPE_MULTILINESTRING, value.srid);\n\t\t\twriter.writeUint32(value.coordinates.length);\n\t\t\tfor (const line of value.coordinates) {\n\t\t\t\twriteHeader(writer, TYPE_LINESTRING);\n\t\t\t\twriteLineStringBody(writer, line);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"MultiPolygon\":\n\t\t\twriteHeader(writer, TYPE_MULTIPOLYGON, value.srid);\n\t\t\twriter.writeUint32(value.coordinates.length);\n\t\t\tfor (const polygon of value.coordinates) {\n\t\t\t\twriteHeader(writer, TYPE_POLYGON);\n\t\t\t\twritePolygonBody(writer, polygon);\n\t\t\t}\n\t\t\tbreak;\n\t}\n}\nfunction readGeometryBody(reader, header) {\n\tswitch (header.geomType) {\n\t\tcase TYPE_POINT: return readPoint(reader, header);\n\t\tcase TYPE_LINESTRING: return readLineString(reader, header);\n\t\tcase TYPE_POLYGON: return readPolygon(reader, header);\n\t\tcase TYPE_MULTIPOINT: return readMultiPoint(reader, header);\n\t\tcase TYPE_MULTILINESTRING: return readMultiLineString(reader, header);\n\t\tcase TYPE_MULTIPOLYGON: return readMultiPolygon(reader, header);\n\t\tdefault: throw postgisError(\"RUNTIME.DECODE_FAILED\", `Geometry wire value: unsupported geometry type ${header.geomType}`);\n\t}\n}\n/**\n* Encode a GeoJSON-shaped geometry to an EWKT string PostGIS understands\n* via `'<ewkt>'::geometry`. We use EWKT (not EWKB) on the way in so the\n* generated SQL stays human-readable.\n*/\nfunction encodeEWKT(value) {\n\tconst sridPrefix = value.srid !== void 0 ? `SRID=${value.srid};` : \"\";\n\tswitch (value.type) {\n\t\tcase \"Point\": return `${sridPrefix}POINT(${formatPosition(value.coordinates)})`;\n\t\tcase \"LineString\": return `${sridPrefix}LINESTRING(${value.coordinates.map(formatPosition).join(\",\")})`;\n\t\tcase \"Polygon\": return `${sridPrefix}POLYGON(${formatRings(value.coordinates)})`;\n\t\tcase \"MultiPoint\": return `${sridPrefix}MULTIPOINT(${value.coordinates.map(formatPosition).join(\",\")})`;\n\t\tcase \"MultiLineString\": return `${sridPrefix}MULTILINESTRING(${value.coordinates.map((line) => `(${line.map(formatPosition).join(\",\")})`).join(\",\")})`;\n\t\tcase \"MultiPolygon\": return `${sridPrefix}MULTIPOLYGON(${value.coordinates.map((poly) => `(${formatRings(poly)})`).join(\",\")})`;\n\t}\n}\nfunction formatPosition(p) {\n\tif (!Number.isFinite(p[0]) || !Number.isFinite(p[1])) throw postgisError(\"RUNTIME.ENCODE_FAILED\", \"Geometry encode: coordinates must be finite numbers\");\n\treturn `${p[0]} ${p[1]}`;\n}\nfunction formatRings(rings) {\n\treturn rings.map((ring) => `(${ring.map(formatPosition).join(\",\")})`).join(\",\");\n}\n//#endregion\n//#region src/core/codecs.ts\nconst geometryParamsSchema = type({ \"srid?\": \"number\" }).narrow((params, ctx) => {\n\tconst { srid } = params;\n\tif (srid === void 0) return true;\n\tif (!Number.isInteger(srid)) return ctx.mustBe(\"an integer\");\n\tif (srid < 0) return ctx.mustBe(\"a non-negative integer\");\n\treturn true;\n});\nconst POSTGIS_GEOMETRY_NATIVE_TYPE = \"geometry\";\nconst allowedGeometryTypes = /* @__PURE__ */ new Set([\n\t\"Point\",\n\t\"LineString\",\n\t\"Polygon\",\n\t\"MultiPoint\",\n\t\"MultiLineString\",\n\t\"MultiPolygon\"\n]);\nfunction assertGeometry(value) {\n\tif (!value || typeof value !== \"object\") throw postgisError(\"RUNTIME.ENCODE_FAILED\", \"Geometry value must be a GeoJSON-shaped object\", { meta: { codecId: POSTGIS_GEOMETRY_CODEC_ID } });\n\tconst type = value.type;\n\tif (typeof type !== \"string\" || !allowedGeometryTypes.has(type)) throw postgisError(\"RUNTIME.ENCODE_FAILED\", `Geometry value: unsupported type \"${String(type)}\" (expected Point, LineString, Polygon, MultiPoint, MultiLineString, or MultiPolygon)`, { meta: { codecId: POSTGIS_GEOMETRY_CODEC_ID } });\n\tif (!Array.isArray(value.coordinates)) throw postgisError(\"RUNTIME.ENCODE_FAILED\", \"Geometry value: \\\"coordinates\\\" must be an array\", { meta: { codecId: POSTGIS_GEOMETRY_CODEC_ID } });\n}\nvar PostgisGeometryCodec = class extends CodecImpl {\n\tconstructor(descriptor) {\n\t\tsuper(descriptor);\n\t}\n\tasync encode(value, _ctx) {\n\t\tassertGeometry(value);\n\t\treturn encodeEWKT(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\tif (typeof wire !== \"string\") throw postgisError(\"RUNTIME.DECODE_FAILED\", \"Geometry wire value must be a string\", { meta: { codecId: POSTGIS_GEOMETRY_CODEC_ID } });\n\t\treturn decodeEWKBHex(wire);\n\t}\n\tencodeJson(value) {\n\t\tassertGeometry(value);\n\t\treturn encodeEWKBHex(value);\n\t}\n\tdecodeJson(json) {\n\t\tif (typeof json !== \"string\") throw postgisError(\"RUNTIME.DECODE_FAILED\", \"Geometry database JSON value must be a HEXEWKB string\", { meta: { codecId: POSTGIS_GEOMETRY_CODEC_ID } });\n\t\treturn decodeEWKBHex(json);\n\t}\n};\nvar PostgisGeometryDescriptor = class extends PostgresCodecDescriptor {\n\tnativeType() {\n\t\treturn POSTGIS_GEOMETRY_NATIVE_TYPE;\n\t}\n\tjsonProjection(expression) {\n\t\treturn expression;\n\t}\n\tcodecId = POSTGIS_GEOMETRY_CODEC_ID;\n\ttraits = [\"equality\"];\n\ttargetTypes = [\"geometry\"];\n\tparamsSchema = geometryParamsSchema;\n\trenderOutputType(params) {\n\t\tconst { srid } = params;\n\t\tif (srid === void 0) return \"Geometry\";\n\t\treturn `Geometry<${srid}>`;\n\t}\n\t/**\n\t* Runtime materialization uses an empty parameter object for the\n\t* existing unparameterized `geometryColumn` variant and `{ srid }` for\n\t* constrained columns. Both resolve to the same SRID-agnostic codec:\n\t* the wire format already carries SRID inside the EWKT/EWKB payload,\n\t* so codec behavior is parameter-independent.\n\t*/\n\tfactory(_params) {\n\t\treturn () => new PostgisGeometryCodec(this);\n\t}\n};\nconst codecDescriptorMap = { geometry: new PostgisGeometryDescriptor() };\n//#endregion\n//#region src/core/registry.ts\n/**\n* Registry of every codec descriptor shipped by `@internal/extension-postgis`.\n*\n* Public consumer surface for the postgis codec set. Currently a single\n* entry (`pg/geometry@1`); the registry shape stays consistent with\n* the other codec-shipping packages so consumers don't need to\n* special-case extensions.\n*/\nconst postgisCodecRegistry = buildCodecDescriptorRegistry(definePostgresCodecs(Object.values(codecDescriptorMap)));\n//#endregion\n//#region src/core/descriptor-meta.ts\nconst postgisTypeId = \"pg/geometry@1\";\n/**\n* Build the PostGIS query operations exposed on `geometry` columns.\n*\n* Each operation lowers to a function-template that the SQL renderer\n* stitches into the surrounding statement (`{{self}}` is the receiver,\n* `{{argN}}` are the call arguments). All templates rely on the implicit\n* `geometry`/`float8`/`bool` casts already wired up by the SQL family —\n* we only add the PostGIS-specific function names.\n*/\nfunction postgisQueryOperations() {\n\treturn {\n\t\tdistance: {\n\t\t\tself: { codecId: postgisTypeId },\n\t\t\timpl: (self, other) => {\n\t\t\t\tconst selfCodec = codecOf(self);\n\t\t\t\treturn buildOperation({\n\t\t\t\t\tmethod: \"distance\",\n\t\t\t\t\targs: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n\t\t\t\t\treturns: {\n\t\t\t\t\t\tcodecId: \"pg/float8@1\",\n\t\t\t\t\t\tnullable: false\n\t\t\t\t\t},\n\t\t\t\t\tlowering: {\n\t\t\t\t\t\ttargetFamily: \"sql\",\n\t\t\t\t\t\tstrategy: \"function\",\n\t\t\t\t\t\ttemplate: \"ST_Distance({{self}}, {{arg0}})\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tdistanceSphere: {\n\t\t\tself: { codecId: postgisTypeId },\n\t\t\timpl: (self, other) => {\n\t\t\t\tconst selfCodec = codecOf(self);\n\t\t\t\treturn buildOperation({\n\t\t\t\t\tmethod: \"distanceSphere\",\n\t\t\t\t\targs: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n\t\t\t\t\treturns: {\n\t\t\t\t\t\tcodecId: \"pg/float8@1\",\n\t\t\t\t\t\tnullable: false\n\t\t\t\t\t},\n\t\t\t\t\tlowering: {\n\t\t\t\t\t\ttargetFamily: \"sql\",\n\t\t\t\t\t\tstrategy: \"function\",\n\t\t\t\t\t\ttemplate: \"ST_DistanceSphere({{self}}, {{arg0}})\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tdwithin: {\n\t\t\tself: { codecId: postgisTypeId },\n\t\t\timpl: (self, other, distance) => {\n\t\t\t\tconst selfCodec = codecOf(self);\n\t\t\t\treturn buildOperation({\n\t\t\t\t\tmethod: \"dwithin\",\n\t\t\t\t\targs: [\n\t\t\t\t\t\ttoExpr(self, selfCodec),\n\t\t\t\t\t\ttoExpr(other, selfCodec),\n\t\t\t\t\t\ttoExpr(distance, { codecId: \"pg/float8@1\" })\n\t\t\t\t\t],\n\t\t\t\t\treturns: {\n\t\t\t\t\t\tcodecId: \"pg/bool@1\",\n\t\t\t\t\t\tnullable: false\n\t\t\t\t\t},\n\t\t\t\t\tlowering: {\n\t\t\t\t\t\ttargetFamily: \"sql\",\n\t\t\t\t\t\tstrategy: \"function\",\n\t\t\t\t\t\ttemplate: \"ST_DWithin({{self}}, {{arg0}}, {{arg1}})\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tcontains: {\n\t\t\tself: { codecId: postgisTypeId },\n\t\t\timpl: (self, other) => {\n\t\t\t\tconst selfCodec = codecOf(self);\n\t\t\t\treturn buildOperation({\n\t\t\t\t\tmethod: \"contains\",\n\t\t\t\t\targs: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n\t\t\t\t\treturns: {\n\t\t\t\t\t\tcodecId: \"pg/bool@1\",\n\t\t\t\t\t\tnullable: false\n\t\t\t\t\t},\n\t\t\t\t\tlowering: {\n\t\t\t\t\t\ttargetFamily: \"sql\",\n\t\t\t\t\t\tstrategy: \"function\",\n\t\t\t\t\t\ttemplate: \"ST_Contains({{self}}, {{arg0}})\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\twithin: {\n\t\t\tself: { codecId: postgisTypeId },\n\t\t\timpl: (self, other) => {\n\t\t\t\tconst selfCodec = codecOf(self);\n\t\t\t\treturn buildOperation({\n\t\t\t\t\tmethod: \"within\",\n\t\t\t\t\targs: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n\t\t\t\t\treturns: {\n\t\t\t\t\t\tcodecId: \"pg/bool@1\",\n\t\t\t\t\t\tnullable: false\n\t\t\t\t\t},\n\t\t\t\t\tlowering: {\n\t\t\t\t\t\ttargetFamily: \"sql\",\n\t\t\t\t\t\tstrategy: \"function\",\n\t\t\t\t\t\ttemplate: \"ST_Within({{self}}, {{arg0}})\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tintersects: {\n\t\t\tself: { codecId: postgisTypeId },\n\t\t\timpl: (self, other) => {\n\t\t\t\tconst selfCodec = codecOf(self);\n\t\t\t\treturn buildOperation({\n\t\t\t\t\tmethod: \"intersects\",\n\t\t\t\t\targs: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n\t\t\t\t\treturns: {\n\t\t\t\t\t\tcodecId: \"pg/bool@1\",\n\t\t\t\t\t\tnullable: false\n\t\t\t\t\t},\n\t\t\t\t\tlowering: {\n\t\t\t\t\t\ttargetFamily: \"sql\",\n\t\t\t\t\t\tstrategy: \"function\",\n\t\t\t\t\t\ttemplate: \"ST_Intersects({{self}}, {{arg0}})\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tintersectsBbox: {\n\t\t\tself: { codecId: postgisTypeId },\n\t\t\timpl: (self, other) => {\n\t\t\t\tconst selfCodec = codecOf(self);\n\t\t\t\treturn buildOperation({\n\t\t\t\t\tmethod: \"intersectsBbox\",\n\t\t\t\t\targs: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n\t\t\t\t\treturns: {\n\t\t\t\t\t\tcodecId: \"pg/bool@1\",\n\t\t\t\t\t\tnullable: false\n\t\t\t\t\t},\n\t\t\t\t\tlowering: {\n\t\t\t\t\t\ttargetFamily: \"sql\",\n\t\t\t\t\t\tstrategy: \"function\",\n\t\t\t\t\t\ttemplate: \"({{self}} && {{arg0}})\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n}\nconst postgisPackMeta = {\n\tkind: \"extension\",\n\tid: \"postgis\",\n\tfamilyId: \"sql\",\n\ttargetId: \"postgres\",\n\tversion: \"0.0.1\",\n\tcapabilities: { postgres: { \"postgis.geometry\": true } },\n\tauthoring: { type: postgisAuthoringTypes },\n\ttypes: {\n\t\tcodecTypes: {\n\t\t\tcodecDescriptors: Array.from(postgisCodecRegistry.values()),\n\t\t\timport: {\n\t\t\t\tpackage: \"@internal/extension-postgis/codec-types\",\n\t\t\t\tnamed: \"CodecTypes\",\n\t\t\t\talias: \"PostgisTypes\"\n\t\t\t},\n\t\t\ttypeImports: [{\n\t\t\t\tpackage: \"@internal/extension-postgis/codec-types\",\n\t\t\t\tnamed: \"Geometry\",\n\t\t\t\talias: \"Geometry\"\n\t\t\t}]\n\t\t},\n\t\tqueryOperationTypes: { import: {\n\t\t\tpackage: \"@internal/extension-postgis/operation-types\",\n\t\t\tnamed: \"QueryOperationTypes\",\n\t\t\talias: \"PostgisQueryOperationTypes\"\n\t\t} },\n\t\tstorage: [{\n\t\t\ttypeId: postgisTypeId,\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"postgres\",\n\t\t\tnativeType: \"geometry\"\n\t\t}]\n\t}\n};\n//#endregion\nexport { postgisQueryOperations as n, postgisCodecRegistry as r, postgisPackMeta as t };\n\n//# sourceMappingURL=descriptor-meta-deM0Qc_b.mjs.map"],"mappings":";;;;;;;;AAQA,MAAM,wBAAwB,EAAE,SAAS,EAAE,UAAU;CACpD,MAAM;CACN,MAAM,CAAC;EACN,MAAM;EACN,MAAM;EACN,SAAS;EACT,SAAS;CACV,CAAC;CACD,QAAQ;EACP,SAAS;EACT,YAAY;EACZ,YAAY,EAAE,MAAM;GACnB,MAAM;GACN,OAAO;EACR,EAAE;CACH;AACD,EAAE,EAAE;;;;;;;;;;;AAaJ,MAAM,SAAS;AACf,MAAM,SAAS;AACf,MAAM,YAAY;AAClB,MAAM,YAAY;AAClB,MAAM,aAAa;AACnB,MAAM,kBAAkB;AACxB,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;AAC7B,MAAM,oBAAoB;AAC1B,MAAM,cAAc;AACpB,SAAS,WAAW,KAAK;CACxB,IAAI,IAAI,SAAS,MAAM,GAAG,MAAM,aAAa,yBAAyB,8CAA8C,EAAE,MAAM,EAAE,aAAa,IAAI,MAAM,GAAG,EAAE,EAAE,EA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