@prisma-next/extension-postgis 0.11.0-dev.9 → 0.12.0
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/dist/codec-types-DODPC0GY.d.mts.map +1 -1
- package/dist/column-types.mjs.map +1 -1
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +11 -15
- package/dist/control.mjs.map +1 -1
- package/dist/descriptor-meta-DUKzIH9c.mjs.map +1 -1
- package/dist/geojson-Cj4ldHQ0.d.mts.map +1 -1
- package/dist/geojson.mjs.map +1 -1
- package/dist/operation-types-C2s9tY0P.d.mts.map +1 -1
- package/dist/pack.d.mts.map +1 -1
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs.map +1 -1
- package/package.json +31 -20
- package/src/contract.d.ts +50 -34
- package/src/contract.json +14 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec-types-DODPC0GY.d.mts","names":[],"sources":["../src/core/constants.ts","../src/core/codecs.ts","../src/types/codec-types.ts"],"mappings":";;;;;;;cAAa,yBAAA;;;KCmDR,cAAA;EAAA,SAA4B,
|
|
1
|
+
{"version":3,"file":"codec-types-DODPC0GY.d.mts","names":[],"sources":["../src/core/constants.ts","../src/core/codecs.ts","../src/types/codec-types.ts"],"mappings":";;;;;;;cAAa,yBAAA;;;KCmDR,cAAA;EAAA,SAA4B,IAAI;AAAA;AAAA,cA2CxB,oBAAA,SAA6B,SAAA,QACjC,yBAAA,iCAGP,UAAA;cAEY,UAAA,EAAY,kBAAA;EAIlB,MAAA,CAAO,KAAA,EAAO,UAAA,EAAU,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAKjD,MAAA,CAAO,IAAA,UAAc,IAAA,EAAM,gBAAA,GAAmB,OAAA,CAAQ,UAAA;EAO5D,UAAA,CAAW,KAAA,EAAO,UAAA,GAAW,SAAA;EAK7B,UAAA,CAAW,IAAA,EAAM,SAAA,GAAY,UAAA;AAAA;AAAA,cAMlB,yBAAA,SAAkC,mBAAA,CAAoB,cAAA;EAAA,SAC/C,OAAA;EAAA,SACA,MAAA;EAAA,SACA,WAAA;EAAA,SACA,IAAA;IAAA;;;;;;;;WACA,YAAA,EAAc,gBAAA,CAAiB,cAAA;EACxC,gBAAA,CAAiB,MAAA,EAAQ,cAAA;EAZvB;;;AAA0B;AAMvC;;;;;;;EAsBW,OAAA,CAAQ,OAAA,EAAS,cAAA,IAAkB,GAAA,EAAK,oBAAA,KAAyB,oBAAA;AAAA;AAAA,cAqCtE,kBAAA;EAAA,mBAEI,yBAAA;AAAA;AAAA,KAEE,YAAA,GAAa,iBAAiB,QAAQ,kBAAA;;;KCjLtC,QAAA,kCAA0C,UAAa;AAAA,KAEvD,UAAA,GAAa,YAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column-types.mjs","names":[],"sources":["../src/exports/column-types.ts"],"sourcesContent":["/**\n * Column type descriptors for the PostGIS extension.\n *\n * Use `geometryColumn` for an untyped `geometry` column, or\n * `geometry({ srid })` to declare an SRID-constrained column whose DDL\n * comes out as `geometry(Geometry, <srid>)`.\n */\n\nimport type { ColumnTypeDescriptor } from '@prisma-next/framework-components/codec';\nimport { POSTGIS_GEOMETRY_CODEC_ID } from '../core/constants';\n\nexport const geometryColumn = {\n codecId: POSTGIS_GEOMETRY_CODEC_ID,\n nativeType: 'geometry',\n} as const satisfies ColumnTypeDescriptor;\n\n/**\n * Build an SRID-constrained geometry column descriptor.\n *\n * @example\n * .column('location', { type: geometry({ srid: 4326 }), nullable: false })\n * // Produces: nativeType: 'geometry', typeParams: { srid: 4326 }\n *\n * @throws {RangeError} If `srid` is not a non-negative integer.\n */\nexport function geometry<S extends number>(options: {\n readonly srid: S;\n}): ColumnTypeDescriptor & { readonly typeParams: { readonly srid: S } } {\n const { srid } = options;\n if (!Number.isInteger(srid) || srid < 0) {\n throw new RangeError(`postgis: srid must be a non-negative integer, got ${srid}`);\n }\n return {\n codecId: POSTGIS_GEOMETRY_CODEC_ID,\n nativeType: 'geometry',\n typeParams: { srid },\n } as const;\n}\n"],"mappings":";;AAWA,MAAa,iBAAiB;CAC5B,SAAS;CACT,YAAY;
|
|
1
|
+
{"version":3,"file":"column-types.mjs","names":[],"sources":["../src/exports/column-types.ts"],"sourcesContent":["/**\n * Column type descriptors for the PostGIS extension.\n *\n * Use `geometryColumn` for an untyped `geometry` column, or\n * `geometry({ srid })` to declare an SRID-constrained column whose DDL\n * comes out as `geometry(Geometry, <srid>)`.\n */\n\nimport type { ColumnTypeDescriptor } from '@prisma-next/framework-components/codec';\nimport { POSTGIS_GEOMETRY_CODEC_ID } from '../core/constants';\n\nexport const geometryColumn = {\n codecId: POSTGIS_GEOMETRY_CODEC_ID,\n nativeType: 'geometry',\n} as const satisfies ColumnTypeDescriptor;\n\n/**\n * Build an SRID-constrained geometry column descriptor.\n *\n * @example\n * .column('location', { type: geometry({ srid: 4326 }), nullable: false })\n * // Produces: nativeType: 'geometry', typeParams: { srid: 4326 }\n *\n * @throws {RangeError} If `srid` is not a non-negative integer.\n */\nexport function geometry<S extends number>(options: {\n readonly srid: S;\n}): ColumnTypeDescriptor & { readonly typeParams: { readonly srid: S } } {\n const { srid } = options;\n if (!Number.isInteger(srid) || srid < 0) {\n throw new RangeError(`postgis: srid must be a non-negative integer, got ${srid}`);\n }\n return {\n codecId: POSTGIS_GEOMETRY_CODEC_ID,\n nativeType: 'geometry',\n typeParams: { srid },\n } as const;\n}\n"],"mappings":";;AAWA,MAAa,iBAAiB;CAC5B,SAAS;CACT,YAAY;AACd;;;;;;;;;;AAWA,SAAgB,SAA2B,SAE8B;CACvE,MAAM,EAAE,SAAS;CACjB,IAAI,CAAC,OAAO,UAAU,IAAI,KAAK,OAAO,GACpC,MAAM,IAAI,WAAW,qDAAqD,MAAM;CAElF,OAAO;EACL,SAAS;EACT,YAAY;EACZ,YAAY,EAAE,KAAK;CACrB;AACF"}
|
package/dist/control.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/exports/control.ts"],"mappings":";;;cA+EM,0BAAA,EAA4B,
|
|
1
|
+
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/exports/control.ts"],"mappings":";;;cA+EM,0BAAA,EAA4B,6BAA6B"}
|
package/dist/control.mjs
CHANGED
|
@@ -4,16 +4,10 @@ import { contractSpaceFromJson } from "@prisma-next/migration-tools/spaces";
|
|
|
4
4
|
//#region migrations/20260601T0000_install_postgis_extension/migration.json
|
|
5
5
|
var migration_default = {
|
|
6
6
|
from: null,
|
|
7
|
-
to: "sha256:
|
|
8
|
-
labels: [],
|
|
7
|
+
to: "sha256:e59d6d9829e8c0283838035c851e6ad35862dc3f517a0f046253fba24e9a85ff",
|
|
9
8
|
providedInvariants: ["postgis:install-postgis-v1"],
|
|
10
9
|
createdAt: "2026-06-01T00:00:00.000Z",
|
|
11
|
-
|
|
12
|
-
"used": [],
|
|
13
|
-
"applied": [],
|
|
14
|
-
"plannerVersion": "2.0.0"
|
|
15
|
-
},
|
|
16
|
-
migrationHash: "sha256:34663e0d52a6254368c4436e42c6fe7848c58bea82dd6d146701e42cc8737416"
|
|
10
|
+
migrationHash: "sha256:9bdc5339353decec5245f315cd55a1286cfcf49fa678679a1ca1230bb019e8ca"
|
|
17
11
|
};
|
|
18
12
|
//#endregion
|
|
19
13
|
//#region migrations/20260601T0000_install_postgis_extension/ops.json
|
|
@@ -46,7 +40,7 @@ var ops_default = [{
|
|
|
46
40
|
//#endregion
|
|
47
41
|
//#region migrations/refs/head.json
|
|
48
42
|
var head_default = {
|
|
49
|
-
hash: "sha256:
|
|
43
|
+
hash: "sha256:e59d6d9829e8c0283838035c851e6ad35862dc3f517a0f046253fba24e9a85ff",
|
|
50
44
|
invariants: ["postgis:install-postgis-v1"]
|
|
51
45
|
};
|
|
52
46
|
//#endregion
|
|
@@ -55,16 +49,16 @@ var contract_default = {
|
|
|
55
49
|
schemaVersion: "1",
|
|
56
50
|
targetFamily: "sql",
|
|
57
51
|
target: "postgres",
|
|
58
|
-
profileHash: "sha256:
|
|
52
|
+
profileHash: "sha256:9c8aa3114e84ed3b7ea2bd57526d9c2e1bf7c5292be694e9d3801f566fda7ccb",
|
|
59
53
|
roots: {},
|
|
60
|
-
models: {},
|
|
54
|
+
domain: { "namespaces": { "public": { "models": {} } } },
|
|
61
55
|
storage: {
|
|
62
|
-
"namespaces": { "
|
|
63
|
-
"id": "
|
|
64
|
-
"kind": "postgres-
|
|
56
|
+
"namespaces": { "public": {
|
|
57
|
+
"id": "public",
|
|
58
|
+
"kind": "postgres-schema",
|
|
65
59
|
"tables": {}
|
|
66
60
|
} },
|
|
67
|
-
"storageHash": "sha256:
|
|
61
|
+
"storageHash": "sha256:e59d6d9829e8c0283838035c851e6ad35862dc3f517a0f046253fba24e9a85ff",
|
|
68
62
|
"types": { "geometry": {
|
|
69
63
|
"codecId": "pg/geometry@1",
|
|
70
64
|
"kind": "codec-instance",
|
|
@@ -74,6 +68,7 @@ var contract_default = {
|
|
|
74
68
|
},
|
|
75
69
|
capabilities: {
|
|
76
70
|
"postgres": {
|
|
71
|
+
"distinctOn": true,
|
|
77
72
|
"jsonAgg": true,
|
|
78
73
|
"lateral": true,
|
|
79
74
|
"limit": true,
|
|
@@ -83,6 +78,7 @@ var contract_default = {
|
|
|
83
78
|
"sql": {
|
|
84
79
|
"defaultInInsert": true,
|
|
85
80
|
"enums": true,
|
|
81
|
+
"lateral": true,
|
|
86
82
|
"returning": true
|
|
87
83
|
}
|
|
88
84
|
},
|
package/dist/control.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.mjs","names":["baselineMetadata","baselineOps"],"sources":["../migrations/20260601T0000_install_postgis_extension/migration.json","../migrations/20260601T0000_install_postgis_extension/ops.json","../migrations/refs/head.json","../src/contract.json","../src/core/contract-space-constants.ts","../src/exports/control.ts"],"sourcesContent":["","","","","/**\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 */\n\nexport const POSTGIS_SPACE_ID = 'postgis' as const;\n\nexport const POSTGIS_NATIVE_TYPE = 'geometry' as const;\n\nexport const POSTGIS_BASELINE_MIGRATION_NAME = '20260601T0000_install_postgis_extension' as const;\n\n/**\n * `postgis:*` invariantIds emitted by the baseline migration. Each id,\n * once published, is immutable: downstream consumers (other extensions,\n * the marker table) reference them by literal string match.\n */\nexport const POSTGIS_INVARIANTS = {\n installPostgis: 'postgis:install-postgis-v1',\n} as const;\n","/**\n * Control-plane descriptor for the postgis extension.\n *\n * **Contract-space package layout.** The extension's contract\n * + migrations are emitted by the same pipeline application authors use:\n *\n * `prisma-next contract emit` → `<package>/src/contract.{json,d.ts}`\n * `prisma-next migration plan` → `<package>/migrations/<dir>/...`\n *\n * The descriptor wires those JSON artefacts via JSON-import declarations\n * so they flow through the consuming application's module resolver\n * without filesystem assumptions, and synthesises the canonical\n * `MigrationPackage` shape for the framework's runner / verifier to\n * consume.\n *\n * Wired surfaces:\n *\n * - `contractSpace.{contractJson,migrations,headRef}` — sourced from\n * the on-disk artefacts emitted by `build:contract-space`.\n * - `types.codecTypes.controlPlaneHooks[POSTGIS_GEOMETRY_CODEC_ID]` —\n * codec control hooks (`expandNativeType`, `resolveIdentityValue`)\n * the SQL planner extracts via `extractCodecControlHooks` and uses\n * to render `geometry(Geometry,${srid})` column types.\n *\n * @see docs/architecture docs/adrs/ADR 212 - Contract spaces.md\n * (contract-space package layout convention).\n */\n\nimport type { Contract } from '@prisma-next/contract/types';\nimport type {\n CodecControlHooks,\n SqlControlExtensionDescriptor,\n} from '@prisma-next/family-sql/control';\nimport { contractSpaceFromJson } from '@prisma-next/migration-tools/spaces';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport baselineMetadata from '../../migrations/20260601T0000_install_postgis_extension/migration.json' with {\n type: 'json',\n};\nimport baselineOps from '../../migrations/20260601T0000_install_postgis_extension/ops.json' with {\n type: 'json',\n};\nimport headRef from '../../migrations/refs/head.json' with { type: 'json' };\nimport contractJson from '../contract.json' with { type: 'json' };\nimport { POSTGIS_GEOMETRY_CODEC_ID } from '../core/constants';\nimport {\n POSTGIS_BASELINE_MIGRATION_NAME,\n POSTGIS_SPACE_ID,\n} from '../core/contract-space-constants';\nimport { postgisPackMeta, postgisQueryOperations } from '../core/descriptor-meta';\n\nconst geometryControlPlaneHooks: CodecControlHooks = {\n expandNativeType: ({ nativeType, typeParams }) => {\n const srid = typeParams?.['srid'];\n if (typeof srid === 'number' && Number.isInteger(srid) && srid >= 0) {\n // PostGIS prints the type-modifier list without a space — match\n // it here so the verifier doesn't see `geometry(Geometry, 4326)`\n // (DDL) mismatch `geometry(Geometry,4326)` (introspected).\n return `${nativeType}(Geometry,${srid})`;\n }\n return nativeType;\n },\n // PostGIS has no canonical \"identity\" geometry; backfilling a\n // non-null column requires the user to supply a valid value, so we\n // don't synthesise one here.\n resolveIdentityValue: () => null,\n};\n\nconst postgisContractSpace = contractSpaceFromJson<Contract<SqlStorage>>({\n contractJson,\n migrations: [\n {\n dirName: POSTGIS_BASELINE_MIGRATION_NAME,\n metadata: baselineMetadata,\n ops: baselineOps,\n },\n ],\n headRef,\n});\n\nconst postgisExtensionDescriptor: SqlControlExtensionDescriptor<'postgres'> = {\n ...postgisPackMeta,\n id: POSTGIS_SPACE_ID,\n contractSpace: postgisContractSpace,\n types: {\n ...postgisPackMeta.types,\n codecTypes: {\n ...postgisPackMeta.types.codecTypes,\n controlPlaneHooks: {\n [POSTGIS_GEOMETRY_CODEC_ID]: geometryControlPlaneHooks,\n },\n },\n },\n queryOperations: () => postgisQueryOperations(),\n create: () => ({\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n }),\n};\n\nexport { postgisExtensionDescriptor };\nexport default postgisExtensionDescriptor;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"control.mjs","names":["baselineMetadata","baselineOps"],"sources":["../migrations/20260601T0000_install_postgis_extension/migration.json","../migrations/20260601T0000_install_postgis_extension/ops.json","../migrations/refs/head.json","../src/contract.json","../src/core/contract-space-constants.ts","../src/exports/control.ts"],"sourcesContent":["","","","","/**\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 */\n\nexport const POSTGIS_SPACE_ID = 'postgis' as const;\n\nexport const POSTGIS_NATIVE_TYPE = 'geometry' as const;\n\nexport const POSTGIS_BASELINE_MIGRATION_NAME = '20260601T0000_install_postgis_extension' as const;\n\n/**\n * `postgis:*` invariantIds emitted by the baseline migration. Each id,\n * once published, is immutable: downstream consumers (other extensions,\n * the marker table) reference them by literal string match.\n */\nexport const POSTGIS_INVARIANTS = {\n installPostgis: 'postgis:install-postgis-v1',\n} as const;\n","/**\n * Control-plane descriptor for the postgis extension.\n *\n * **Contract-space package layout.** The extension's contract\n * + migrations are emitted by the same pipeline application authors use:\n *\n * `prisma-next contract emit` → `<package>/src/contract.{json,d.ts}`\n * `prisma-next migration plan` → `<package>/migrations/<dir>/...`\n *\n * The descriptor wires those JSON artefacts via JSON-import declarations\n * so they flow through the consuming application's module resolver\n * without filesystem assumptions, and synthesises the canonical\n * `MigrationPackage` shape for the framework's runner / verifier to\n * consume.\n *\n * Wired surfaces:\n *\n * - `contractSpace.{contractJson,migrations,headRef}` — sourced from\n * the on-disk artefacts emitted by `build:contract-space`.\n * - `types.codecTypes.controlPlaneHooks[POSTGIS_GEOMETRY_CODEC_ID]` —\n * codec control hooks (`expandNativeType`, `resolveIdentityValue`)\n * the SQL planner extracts via `extractCodecControlHooks` and uses\n * to render `geometry(Geometry,${srid})` column types.\n *\n * @see docs/architecture docs/adrs/ADR 212 - Contract spaces.md\n * (contract-space package layout convention).\n */\n\nimport type { Contract } from '@prisma-next/contract/types';\nimport type {\n CodecControlHooks,\n SqlControlExtensionDescriptor,\n} from '@prisma-next/family-sql/control';\nimport { contractSpaceFromJson } from '@prisma-next/migration-tools/spaces';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport baselineMetadata from '../../migrations/20260601T0000_install_postgis_extension/migration.json' with {\n type: 'json',\n};\nimport baselineOps from '../../migrations/20260601T0000_install_postgis_extension/ops.json' with {\n type: 'json',\n};\nimport headRef from '../../migrations/refs/head.json' with { type: 'json' };\nimport contractJson from '../contract.json' with { type: 'json' };\nimport { POSTGIS_GEOMETRY_CODEC_ID } from '../core/constants';\nimport {\n POSTGIS_BASELINE_MIGRATION_NAME,\n POSTGIS_SPACE_ID,\n} from '../core/contract-space-constants';\nimport { postgisPackMeta, postgisQueryOperations } from '../core/descriptor-meta';\n\nconst geometryControlPlaneHooks: CodecControlHooks = {\n expandNativeType: ({ nativeType, typeParams }) => {\n const srid = typeParams?.['srid'];\n if (typeof srid === 'number' && Number.isInteger(srid) && srid >= 0) {\n // PostGIS prints the type-modifier list without a space — match\n // it here so the verifier doesn't see `geometry(Geometry, 4326)`\n // (DDL) mismatch `geometry(Geometry,4326)` (introspected).\n return `${nativeType}(Geometry,${srid})`;\n }\n return nativeType;\n },\n // PostGIS has no canonical \"identity\" geometry; backfilling a\n // non-null column requires the user to supply a valid value, so we\n // don't synthesise one here.\n resolveIdentityValue: () => null,\n};\n\nconst postgisContractSpace = contractSpaceFromJson<Contract<SqlStorage>>({\n contractJson,\n migrations: [\n {\n dirName: POSTGIS_BASELINE_MIGRATION_NAME,\n metadata: baselineMetadata,\n ops: baselineOps,\n },\n ],\n headRef,\n});\n\nconst postgisExtensionDescriptor: SqlControlExtensionDescriptor<'postgres'> = {\n ...postgisPackMeta,\n id: POSTGIS_SPACE_ID,\n contractSpace: postgisContractSpace,\n types: {\n ...postgisPackMeta.types,\n codecTypes: {\n ...postgisPackMeta.types.codecTypes,\n controlPlaneHooks: {\n [POSTGIS_GEOMETRY_CODEC_ID]: geometryControlPlaneHooks,\n },\n },\n },\n queryOperations: () => postgisQueryOperations(),\n create: () => ({\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n }),\n};\n\nexport { postgisExtensionDescriptor };\nexport default postgisExtensionDescriptor;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIgBA,MAAa,mBAAmB;AAIhC,MAAa,kCAAkC;;;AC8B/C,MAAM,4BAA+C;CACnD,mBAAmB,EAAE,YAAY,iBAAiB;EAChD,MAAM,OAAO,aAAa;EAC1B,IAAI,OAAO,SAAS,YAAY,OAAO,UAAU,IAAI,KAAK,QAAQ,GAIhE,OAAO,GAAG,WAAW,YAAY,KAAK;EAExC,OAAO;CACT;CAIA,4BAA4B;AAC9B;AAEA,MAAM,uBAAuB,sBAA4C;CACvE,cAAA;CACA,YAAY,CACV;EACE,SAAS;EACT,UAAUA;EACV,KAAKC;CACP,CACF;CACA,SAAA;AACF,CAAC;AAED,MAAM,6BAAwE;CAC5E,GAAG;CACH,IAAI;CACJ,eAAe;CACf,OAAO;EACL,GAAG,gBAAgB;EACnB,YAAY;GACV,GAAG,gBAAgB,MAAM;GACzB,mBAAmB,GAChB,4BAA4B,0BAC/B;EACF;CACF;CACA,uBAAuB,uBAAuB;CAC9C,eAAe;EACb,UAAU;EACV,UAAU;CACZ;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptor-meta-DUKzIH9c.mjs","names":["arktype"],"sources":["../src/core/authoring.ts","../src/core/ewkb.ts","../src/core/codecs.ts","../src/core/registry.ts","../src/core/descriptor-meta.ts"],"sourcesContent":["import type { AuthoringTypeNamespace } from '@prisma-next/framework-components/authoring';\nimport { POSTGIS_GEOMETRY_CODEC_ID } from './constants';\n\nexport const postgisAuthoringTypes = {\n postgis: {\n Geometry: {\n kind: 'typeConstructor',\n args: [{ kind: 'number', name: 'srid', integer: true, minimum: 0 }],\n output: {\n codecId: POSTGIS_GEOMETRY_CODEC_ID,\n nativeType: 'geometry',\n typeParams: {\n srid: { kind: 'arg', index: 0 },\n },\n },\n },\n },\n} as const satisfies AuthoringTypeNamespace;\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 */\n\nimport type {\n Geometry,\n GeometryLineString,\n GeometryMultiLineString,\n GeometryMultiPoint,\n GeometryMultiPolygon,\n GeometryPoint,\n GeometryPolygon,\n Position,\n} from './geojson';\n\nconst FLAG_Z = 0x80000000;\nconst FLAG_M = 0x40000000;\nconst FLAG_SRID = 0x20000000;\nconst TYPE_MASK = 0x1fffffff;\n\nconst TYPE_POINT = 1;\nconst TYPE_LINESTRING = 2;\nconst TYPE_POLYGON = 3;\nconst TYPE_MULTIPOINT = 4;\nconst TYPE_MULTILINESTRING = 5;\nconst TYPE_MULTIPOLYGON = 6;\n\nconst HEX_PAIR_RE = /^[0-9a-fA-F]{2}$/;\n\nfunction hexToBytes(hex: string): Uint8Array {\n if (hex.length % 2 !== 0) {\n throw new Error('Geometry wire value: odd-length hex string');\n }\n const bytes = new Uint8Array(hex.length / 2);\n for (let i = 0; i < bytes.length; i++) {\n const pair = hex.slice(i * 2, i * 2 + 2);\n if (!HEX_PAIR_RE.test(pair)) {\n throw new Error(`Geometry wire value: invalid hex byte at offset ${i * 2}`);\n }\n bytes[i] = Number.parseInt(pair, 16);\n }\n return bytes;\n}\n\nclass Reader {\n private offset = 0;\n private readonly view: DataView;\n\n constructor(bytes: Uint8Array) {\n this.view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n }\n\n private requireBytes(needed: number): void {\n if (this.offset + needed > this.view.byteLength) {\n throw new Error(\n `Geometry wire value: unexpected end of buffer (need ${needed} bytes at offset ${this.offset}, ${this.view.byteLength - this.offset} available)`,\n );\n }\n }\n\n readUint8(): number {\n this.requireBytes(1);\n const v = this.view.getUint8(this.offset);\n this.offset += 1;\n return v;\n }\n\n readUint32(littleEndian: boolean): number {\n this.requireBytes(4);\n const v = this.view.getUint32(this.offset, littleEndian);\n this.offset += 4;\n return v >>> 0;\n }\n\n readFloat64(littleEndian: boolean): number {\n this.requireBytes(8);\n const v = this.view.getFloat64(this.offset, littleEndian);\n this.offset += 8;\n return v;\n }\n\n hasRemaining(): boolean {\n return this.offset !== this.view.byteLength;\n }\n\n remainingBytes(): number {\n return this.view.byteLength - this.offset;\n }\n}\n\ntype Header = {\n readonly geomType: number;\n readonly littleEndian: boolean;\n readonly srid?: number;\n};\n\nfunction readHeader(reader: Reader): Header {\n const byteOrder = reader.readUint8();\n if (byteOrder !== 0 && byteOrder !== 1) {\n throw new Error(`Geometry wire value: invalid byte order ${byteOrder}`);\n }\n const littleEndian = byteOrder === 1;\n const typeCode = reader.readUint32(littleEndian);\n if ((typeCode & FLAG_Z) !== 0 || (typeCode & FLAG_M) !== 0) {\n throw new Error('Geometry wire value: Z/M coordinates are not supported');\n }\n const geomType = typeCode & TYPE_MASK;\n if ((typeCode & FLAG_SRID) !== 0) {\n return { geomType, littleEndian, srid: reader.readUint32(littleEndian) };\n }\n return { geomType, littleEndian };\n}\n\nfunction readPosition(reader: Reader, littleEndian: boolean): Position {\n const x = reader.readFloat64(littleEndian);\n const y = reader.readFloat64(littleEndian);\n return [x, y];\n}\n\nfunction readPoint(reader: Reader, header: Header): GeometryPoint {\n const coords = readPosition(reader, header.littleEndian);\n return header.srid !== undefined\n ? { type: 'Point', coordinates: coords, srid: header.srid }\n : { type: 'Point', coordinates: coords };\n}\n\nfunction readLineString(reader: Reader, header: Header): GeometryLineString {\n const n = reader.readUint32(header.littleEndian);\n const coords: Position[] = [];\n for (let i = 0; i < n; i++) coords.push(readPosition(reader, header.littleEndian));\n return header.srid !== undefined\n ? { type: 'LineString', coordinates: coords, srid: header.srid }\n : { type: 'LineString', coordinates: coords };\n}\n\nfunction readPolygon(reader: Reader, header: Header): GeometryPolygon {\n const numRings = reader.readUint32(header.littleEndian);\n const rings: Position[][] = [];\n for (let r = 0; r < numRings; r++) {\n const n = reader.readUint32(header.littleEndian);\n const ring: Position[] = [];\n for (let i = 0; i < n; i++) ring.push(readPosition(reader, header.littleEndian));\n rings.push(ring);\n }\n return header.srid !== undefined\n ? { type: 'Polygon', coordinates: rings, srid: header.srid }\n : { type: 'Polygon', coordinates: rings };\n}\n\nfunction readSubGeometry(reader: Reader): Geometry {\n // Multi* geometries embed sub-WKB records; each carries its own header.\n const header = readHeader(reader);\n switch (header.geomType) {\n case TYPE_POINT:\n return readPoint(reader, header);\n case TYPE_LINESTRING:\n return readLineString(reader, header);\n case TYPE_POLYGON:\n return readPolygon(reader, header);\n default:\n throw new Error(`Geometry wire value: unsupported sub-type ${header.geomType}`);\n }\n}\n\nfunction readMultiPoint(reader: Reader, header: Header): GeometryMultiPoint {\n const n = reader.readUint32(header.littleEndian);\n const coords: Position[] = [];\n for (let i = 0; i < n; i++) {\n const sub = readSubGeometry(reader);\n if (sub.type !== 'Point') {\n throw new Error('Geometry wire value: MultiPoint contains non-Point sub-geometry');\n }\n coords.push(sub.coordinates);\n }\n return header.srid !== undefined\n ? { type: 'MultiPoint', coordinates: coords, srid: header.srid }\n : { type: 'MultiPoint', coordinates: coords };\n}\n\nfunction readMultiLineString(reader: Reader, header: Header): GeometryMultiLineString {\n const n = reader.readUint32(header.littleEndian);\n const lines: ReadonlyArray<Position>[] = [];\n for (let i = 0; i < n; i++) {\n const sub = readSubGeometry(reader);\n if (sub.type !== 'LineString') {\n throw new Error('Geometry wire value: MultiLineString contains non-LineString sub-geometry');\n }\n lines.push(sub.coordinates);\n }\n return header.srid !== undefined\n ? { type: 'MultiLineString', coordinates: lines, srid: header.srid }\n : { type: 'MultiLineString', coordinates: lines };\n}\n\nfunction readMultiPolygon(reader: Reader, header: Header): GeometryMultiPolygon {\n const n = reader.readUint32(header.littleEndian);\n const polys: ReadonlyArray<ReadonlyArray<Position>>[] = [];\n for (let i = 0; i < n; i++) {\n const sub = readSubGeometry(reader);\n if (sub.type !== 'Polygon') {\n throw new Error('Geometry wire value: MultiPolygon contains non-Polygon sub-geometry');\n }\n polys.push(sub.coordinates);\n }\n return header.srid !== undefined\n ? { type: 'MultiPolygon', coordinates: polys, srid: header.srid }\n : { type: 'MultiPolygon', coordinates: polys };\n}\n\nexport function decodeEWKBHex(hex: string): Geometry {\n const reader = new Reader(hexToBytes(hex));\n const header = readHeader(reader);\n const geometry = readGeometryBody(reader, header);\n if (reader.hasRemaining()) {\n throw new Error(\n `Geometry wire value: trailing data after geometry (${reader.remainingBytes()} bytes)`,\n );\n }\n return geometry;\n}\n\nfunction readGeometryBody(reader: Reader, header: Header): Geometry {\n switch (header.geomType) {\n case TYPE_POINT:\n return readPoint(reader, header);\n case TYPE_LINESTRING:\n return readLineString(reader, header);\n case TYPE_POLYGON:\n return readPolygon(reader, header);\n case TYPE_MULTIPOINT:\n return readMultiPoint(reader, header);\n case TYPE_MULTILINESTRING:\n return readMultiLineString(reader, header);\n case TYPE_MULTIPOLYGON:\n return readMultiPolygon(reader, header);\n default:\n throw new Error(`Geometry wire value: unsupported geometry type ${header.geomType}`);\n }\n}\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 */\nexport function encodeEWKT(value: Geometry): string {\n const sridPrefix = value.srid !== undefined ? `SRID=${value.srid};` : '';\n switch (value.type) {\n case 'Point':\n return `${sridPrefix}POINT(${formatPosition(value.coordinates)})`;\n case 'LineString':\n return `${sridPrefix}LINESTRING(${value.coordinates.map(formatPosition).join(',')})`;\n case 'Polygon':\n return `${sridPrefix}POLYGON(${formatRings(value.coordinates)})`;\n case 'MultiPoint':\n return `${sridPrefix}MULTIPOINT(${value.coordinates.map(formatPosition).join(',')})`;\n case 'MultiLineString':\n return `${sridPrefix}MULTILINESTRING(${value.coordinates\n .map((line) => `(${line.map(formatPosition).join(',')})`)\n .join(',')})`;\n case 'MultiPolygon':\n return `${sridPrefix}MULTIPOLYGON(${value.coordinates\n .map((poly) => `(${formatRings(poly)})`)\n .join(',')})`;\n }\n}\n\nfunction formatPosition(p: Position): string {\n if (!Number.isFinite(p[0]) || !Number.isFinite(p[1])) {\n throw new Error('Geometry encode: coordinates must be finite numbers');\n }\n return `${p[0]} ${p[1]}`;\n}\n\nfunction formatRings(rings: ReadonlyArray<ReadonlyArray<Position>>): string {\n return rings.map((ring) => `(${ring.map(formatPosition).join(',')})`).join(',');\n}\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 CodecDescriptorImpl}\n * with the codec id, traits, target types, params schema\n * (`{ srid: number }`, validated as a non-negative integer), and\n * the emit-path `renderOutputType` producing `Geometry<${srid}>` /\n * `Geometry` when no SRID is supplied.\n * 3. `pgGeometryColumn({ srid })` per-codec column helper invoking\n * `descriptor.factory({ srid })` and passing the bare\n * `nativeType: 'geometry'`. The family-layer `expandNativeType`\n * hook renders the parameterised form\n * (`geometry(Geometry,${srid})`) at emit/verify time from\n * `nativeType` + `typeParams`.\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 */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\nimport {\n type AnyCodecDescriptor,\n type CodecCallContext,\n CodecDescriptorImpl,\n CodecImpl,\n type CodecInstanceContext,\n type ColumnHelperFor,\n type ColumnHelperForStrict,\n column,\n} from '@prisma-next/framework-components/codec';\nimport type { ExtractCodecTypes } from '@prisma-next/sql-relational-core/ast';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { type as arktype } from 'arktype';\nimport { POSTGIS_GEOMETRY_CODEC_ID } from './constants';\nimport { decodeEWKBHex, encodeEWKT } from './ewkb';\nimport type { Geometry } from './geojson';\n\ntype GeometryParams = { readonly srid: number };\n\nconst geometryParamsSchema = arktype({\n srid: 'number',\n}).narrow((params, ctx) => {\n const { srid } = params;\n if (!Number.isInteger(srid)) {\n return ctx.mustBe('an integer');\n }\n if (srid < 0) {\n return ctx.mustBe('a non-negative integer');\n }\n return true;\n}) satisfies StandardSchemaV1<GeometryParams>;\n\nconst POSTGIS_GEOMETRY_META = {\n db: { sql: { postgres: { nativeType: 'geometry' } } },\n} as const;\n\nconst allowedGeometryTypes = new Set([\n 'Point',\n 'LineString',\n 'Polygon',\n 'MultiPoint',\n 'MultiLineString',\n 'MultiPolygon',\n]);\n\nfunction assertGeometry(value: unknown): asserts value is Geometry {\n if (!value || typeof value !== 'object') {\n throw new Error('Geometry value must be a GeoJSON-shaped object');\n }\n const type = (value as { type?: unknown }).type;\n if (typeof type !== 'string' || !allowedGeometryTypes.has(type)) {\n throw new Error(\n `Geometry value: unsupported type \"${String(type)}\" (expected Point, LineString, Polygon, MultiPoint, MultiLineString, or MultiPolygon)`,\n );\n }\n if (!Array.isArray((value as { coordinates?: unknown }).coordinates)) {\n throw new Error('Geometry value: \"coordinates\" must be an array');\n }\n}\n\nexport class PostgisGeometryCodec extends CodecImpl<\n typeof POSTGIS_GEOMETRY_CODEC_ID,\n readonly ['equality'],\n string,\n Geometry\n> {\n constructor(descriptor: AnyCodecDescriptor) {\n super(descriptor);\n }\n\n async encode(value: Geometry, _ctx: CodecCallContext): Promise<string> {\n assertGeometry(value);\n return encodeEWKT(value);\n }\n\n async decode(wire: string, _ctx: CodecCallContext): Promise<Geometry> {\n if (typeof wire !== 'string') {\n throw new Error('Geometry wire value must be a string');\n }\n return decodeEWKBHex(wire);\n }\n\n encodeJson(value: Geometry): JsonValue {\n assertGeometry(value);\n return value as unknown as JsonValue;\n }\n\n decodeJson(json: JsonValue): Geometry {\n assertGeometry(json);\n return json;\n }\n}\n\nexport class PostgisGeometryDescriptor extends CodecDescriptorImpl<GeometryParams> {\n override readonly codecId = POSTGIS_GEOMETRY_CODEC_ID;\n override readonly traits = ['equality'] as const;\n override readonly targetTypes = ['geometry'] as const;\n override readonly meta = POSTGIS_GEOMETRY_META;\n override readonly paramsSchema: StandardSchemaV1<GeometryParams> = geometryParamsSchema;\n override renderOutputType(params: GeometryParams): string {\n const srid = (params as GeometryParams | undefined)?.srid;\n if (srid === undefined) return 'Geometry';\n return `Geometry<${srid}>`;\n }\n /**\n * The runtime calls `factory(undefined)(ctx)` to materialize a\n * representative codec for parameterised descriptors that ship a\n * no-params column variant (here, `geometryColumn` vs `geometry({ srid })`).\n * The runtime cast widens `params` to `unknown`, so guarding with an\n * optional read keeps the typed call site (`factory({ srid })`)\n * strict while still producing an SRID-agnostic codec for\n * representative use. Encode/decode for an unparameterised column\n * runs through this representative; the wire format already carries\n * SRID inside the EWKT/EWKB payload, so it's dimension-independent.\n */\n override factory(_params: GeometryParams): (ctx: CodecInstanceContext) => PostgisGeometryCodec {\n return () => new PostgisGeometryCodec(this);\n }\n}\n\nexport const postgisGeometryDescriptor = new PostgisGeometryDescriptor();\n\n/**\n * Per-codec column helper for `pg/geometry@1` with an SRID constraint.\n *\n * Generic over `S extends number` so the column site preserves the\n * SRID literal in `typeParams` (e.g. `pgGeometryColumn({ srid: 4326 })`\n * packs `typeParams: { srid: 4326 }`).\n *\n * Passes the bare `nativeType: 'geometry'`; the family-layer\n * `expandNativeType` hook renders the parameterised form\n * (`geometry(Geometry,${srid})`) at emit/verify time from `nativeType`\n * + `typeParams`.\n *\n * @throws {RangeError} If `srid` is not a non-negative integer.\n */\nexport const pgGeometryColumn = <S extends number>(options: { readonly srid: S }) => {\n const { srid } = options;\n if (!Number.isInteger(srid) || srid < 0) {\n throw new RangeError(`postgis: srid must be a non-negative integer, got ${srid}`);\n }\n return column(\n postgisGeometryDescriptor.factory({ srid }),\n postgisGeometryDescriptor.codecId,\n { srid },\n 'geometry',\n );\n};\n\npgGeometryColumn satisfies ColumnHelperFor<PostgisGeometryDescriptor>;\npgGeometryColumn satisfies ColumnHelperForStrict<PostgisGeometryDescriptor>;\n\nconst codecDescriptorMap = {\n geometry: postgisGeometryDescriptor,\n} as const;\n\nexport type CodecTypes = ExtractCodecTypes<typeof codecDescriptorMap>;\n\nexport const codecDescriptors: readonly AnyCodecDescriptor[] = Object.values(codecDescriptorMap);\n","import { buildCodecDescriptorRegistry } from '@prisma-next/sql-relational-core/codec-descriptor-registry';\nimport type { CodecDescriptorRegistry } from '@prisma-next/sql-relational-core/query-lane-context';\nimport { codecDescriptors } from './codecs';\n\n/**\n * Registry of every codec descriptor shipped by `@prisma-next/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 */\nexport const postgisCodecRegistry: CodecDescriptorRegistry =\n buildCodecDescriptorRegistry(codecDescriptors);\n","import { buildOperation, codecOf, toExpr } from '@prisma-next/sql-relational-core/expression';\nimport type { CodecTypes } from '../types/codec-types';\nimport type { QueryOperationTypes } from '../types/operation-types';\nimport { postgisAuthoringTypes } from './authoring';\nimport { postgisCodecRegistry } from './registry';\n\nconst postgisTypeId = 'pg/geometry@1' as const;\n\ntype CodecTypesBase = Record<string, { readonly input: unknown; readonly output: unknown }>;\n\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 */\nexport function postgisQueryOperations<CT extends CodecTypesBase>(): QueryOperationTypes<CT> {\n return {\n distance: {\n self: { codecId: postgisTypeId },\n impl: (self, other) => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method: 'distance',\n args: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n returns: { codecId: 'pg/float8@1', nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: 'ST_Distance({{self}}, {{arg0}})',\n },\n });\n },\n },\n distanceSphere: {\n self: { codecId: postgisTypeId },\n impl: (self, other) => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method: 'distanceSphere',\n args: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n returns: { codecId: 'pg/float8@1', nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: 'ST_DistanceSphere({{self}}, {{arg0}})',\n },\n });\n },\n },\n dwithin: {\n self: { codecId: postgisTypeId },\n impl: (self, other, distance) => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method: 'dwithin',\n args: [\n toExpr(self, selfCodec),\n toExpr(other, selfCodec),\n toExpr(distance, { codecId: 'pg/float8@1' }),\n ],\n returns: { codecId: 'pg/bool@1', nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: 'ST_DWithin({{self}}, {{arg0}}, {{arg1}})',\n },\n });\n },\n },\n contains: {\n self: { codecId: postgisTypeId },\n impl: (self, other) => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method: 'contains',\n args: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n returns: { codecId: 'pg/bool@1', nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: 'ST_Contains({{self}}, {{arg0}})',\n },\n });\n },\n },\n within: {\n self: { codecId: postgisTypeId },\n impl: (self, other) => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method: 'within',\n args: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n returns: { codecId: 'pg/bool@1', nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: 'ST_Within({{self}}, {{arg0}})',\n },\n });\n },\n },\n intersects: {\n self: { codecId: postgisTypeId },\n impl: (self, other) => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method: 'intersects',\n args: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n returns: { codecId: 'pg/bool@1', nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: 'ST_Intersects({{self}}, {{arg0}})',\n },\n });\n },\n },\n intersectsBbox: {\n self: { codecId: postgisTypeId },\n impl: (self, other) => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method: 'intersectsBbox',\n args: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n returns: { codecId: 'pg/bool@1', nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '({{self}} && {{arg0}})',\n },\n });\n },\n },\n };\n}\n\nconst postgisPackMetaBase = {\n kind: 'extension',\n id: 'postgis',\n familyId: 'sql',\n targetId: 'postgres',\n version: '0.0.1',\n capabilities: {\n postgres: {\n 'postgis.geometry': true,\n },\n },\n authoring: {\n type: postgisAuthoringTypes,\n },\n types: {\n codecTypes: {\n codecDescriptors: Array.from(postgisCodecRegistry.values()),\n import: {\n package: '@prisma-next/extension-postgis/codec-types',\n named: 'CodecTypes',\n alias: 'PostgisTypes',\n },\n typeImports: [\n {\n package: '@prisma-next/extension-postgis/codec-types',\n named: 'Geometry',\n alias: 'Geometry',\n },\n ],\n },\n queryOperationTypes: {\n import: {\n package: '@prisma-next/extension-postgis/operation-types',\n named: 'QueryOperationTypes',\n alias: 'PostgisQueryOperationTypes',\n },\n },\n storage: [\n { typeId: postgisTypeId, familyId: 'sql', targetId: 'postgres', nativeType: 'geometry' },\n ],\n },\n} as const;\n\nexport const postgisPackMeta: typeof postgisPackMetaBase & {\n readonly __codecTypes?: CodecTypes;\n} = postgisPackMetaBase;\n"],"mappings":";;;;;;AAGA,MAAa,wBAAwB,EACnC,SAAS,EACP,UAAU;CACR,MAAM;CACN,MAAM,CAAC;EAAE,MAAM;EAAU,MAAM;EAAQ,SAAS;EAAM,SAAS;EAAG,CAAC;CACnE,QAAQ;EACN,SAAS;EACT,YAAY;EACZ,YAAY,EACV,MAAM;GAAE,MAAM;GAAO,OAAO;GAAG,EAChC;EACF;CACF,EACF,EACF;;;ACKD,MAAM,SAAS;AACf,MAAM,SAAS;AACf,MAAM,YAAY;AAClB,MAAM,YAAY;AAElB,MAAM,aAAa;AACnB,MAAM,kBAAkB;AACxB,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;AAC7B,MAAM,oBAAoB;AAE1B,MAAM,cAAc;AAEpB,SAAS,WAAW,KAAyB;CAC3C,IAAI,IAAI,SAAS,MAAM,GACrB,MAAM,IAAI,MAAM,6CAA6C;CAE/D,MAAM,QAAQ,IAAI,WAAW,IAAI,SAAS,EAAE;CAC5C,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EACrC,MAAM,OAAO,IAAI,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE;EACxC,IAAI,CAAC,YAAY,KAAK,KAAK,EACzB,MAAM,IAAI,MAAM,mDAA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,OAAO,MAAM,UAAU;IACrB,MAAM,YAAY,QAAQ,KAAK;IAC/B,OAAO,eAAe;KACpB,QAAQ;KACR,MAAM,CAAC,OAAO,MAAM,UAAU,EAAE,OAAO,OAAO,UAAU,CAAC;KACzD,SAAS;MAAE,SAAS;MAAa,UAAU;MAAO;KAClD,UAAU;MACR,cAAc;MACd,UAAU;MACV,UAAU;MACX;KACF,CAAC;;GAEL;EACD,gBAAgB;GACd,MAAM,EAAE,SAAS,eAAe;GAChC,OAAO,MAAM,UAAU;IACrB,MAAM,YAAY,QAAQ,KAAK;IAC/B,OAAO,eAAe;KACpB,QAAQ;KACR,MAAM,CAAC,OAAO,MAAM,UAAU,EAAE,OAAO,OAAO,UAAU,CAAC;KACzD,SAAS;MAAE,SAAS;MAAa,UAAU;MAAO;KAClD,UAAU;MACR,cAAc;MACd,UAAU;MACV,UAAU;MACX;KACF,CAAC;;GAEL;EACF;;AA8CH,MAAa,kBAET;CA5CF,MAAM;CACN,IAAI;CACJ,UAAU;CACV,UAAU;CACV,SAAS;CACT,cAAc,EACZ,UAAU,EACR,oBAAoB,MACrB,EACF;CACD,WAAW,EACT,MAAM,uBACP;CACD,OAAO;EACL,YAAY;GACV,kBAAkB,MAAM,KAAK,qBAAqB,QAAQ,CAAC;GAC3D,QAAQ;IACN,SAAS;IACT,OAAO;IACP,OAAO;IACR;GACD,aAAa,CACX;IACE,SAAS;IACT,OAAO;IACP,OAAO;IACR,CACF;GACF;EACD,qBAAqB,EACnB,QAAQ;GACN,SAAS;GACT,OAAO;GACP,OAAO;GACR,EACF;EACD,SAAS,CACP;GAAE,QAAQ;GAAe,UAAU;GAAO,UAAU;GAAY,YAAY;GAAY,CACzF;EACF;CAKC"}
|
|
1
|
+
{"version":3,"file":"descriptor-meta-DUKzIH9c.mjs","names":["arktype"],"sources":["../src/core/authoring.ts","../src/core/ewkb.ts","../src/core/codecs.ts","../src/core/registry.ts","../src/core/descriptor-meta.ts"],"sourcesContent":["import type { AuthoringTypeNamespace } from '@prisma-next/framework-components/authoring';\nimport { POSTGIS_GEOMETRY_CODEC_ID } from './constants';\n\nexport const postgisAuthoringTypes = {\n postgis: {\n Geometry: {\n kind: 'typeConstructor',\n args: [{ kind: 'number', name: 'srid', integer: true, minimum: 0 }],\n output: {\n codecId: POSTGIS_GEOMETRY_CODEC_ID,\n nativeType: 'geometry',\n typeParams: {\n srid: { kind: 'arg', index: 0 },\n },\n },\n },\n },\n} as const satisfies AuthoringTypeNamespace;\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 */\n\nimport type {\n Geometry,\n GeometryLineString,\n GeometryMultiLineString,\n GeometryMultiPoint,\n GeometryMultiPolygon,\n GeometryPoint,\n GeometryPolygon,\n Position,\n} from './geojson';\n\nconst FLAG_Z = 0x80000000;\nconst FLAG_M = 0x40000000;\nconst FLAG_SRID = 0x20000000;\nconst TYPE_MASK = 0x1fffffff;\n\nconst TYPE_POINT = 1;\nconst TYPE_LINESTRING = 2;\nconst TYPE_POLYGON = 3;\nconst TYPE_MULTIPOINT = 4;\nconst TYPE_MULTILINESTRING = 5;\nconst TYPE_MULTIPOLYGON = 6;\n\nconst HEX_PAIR_RE = /^[0-9a-fA-F]{2}$/;\n\nfunction hexToBytes(hex: string): Uint8Array {\n if (hex.length % 2 !== 0) {\n throw new Error('Geometry wire value: odd-length hex string');\n }\n const bytes = new Uint8Array(hex.length / 2);\n for (let i = 0; i < bytes.length; i++) {\n const pair = hex.slice(i * 2, i * 2 + 2);\n if (!HEX_PAIR_RE.test(pair)) {\n throw new Error(`Geometry wire value: invalid hex byte at offset ${i * 2}`);\n }\n bytes[i] = Number.parseInt(pair, 16);\n }\n return bytes;\n}\n\nclass Reader {\n private offset = 0;\n private readonly view: DataView;\n\n constructor(bytes: Uint8Array) {\n this.view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n }\n\n private requireBytes(needed: number): void {\n if (this.offset + needed > this.view.byteLength) {\n throw new Error(\n `Geometry wire value: unexpected end of buffer (need ${needed} bytes at offset ${this.offset}, ${this.view.byteLength - this.offset} available)`,\n );\n }\n }\n\n readUint8(): number {\n this.requireBytes(1);\n const v = this.view.getUint8(this.offset);\n this.offset += 1;\n return v;\n }\n\n readUint32(littleEndian: boolean): number {\n this.requireBytes(4);\n const v = this.view.getUint32(this.offset, littleEndian);\n this.offset += 4;\n return v >>> 0;\n }\n\n readFloat64(littleEndian: boolean): number {\n this.requireBytes(8);\n const v = this.view.getFloat64(this.offset, littleEndian);\n this.offset += 8;\n return v;\n }\n\n hasRemaining(): boolean {\n return this.offset !== this.view.byteLength;\n }\n\n remainingBytes(): number {\n return this.view.byteLength - this.offset;\n }\n}\n\ntype Header = {\n readonly geomType: number;\n readonly littleEndian: boolean;\n readonly srid?: number;\n};\n\nfunction readHeader(reader: Reader): Header {\n const byteOrder = reader.readUint8();\n if (byteOrder !== 0 && byteOrder !== 1) {\n throw new Error(`Geometry wire value: invalid byte order ${byteOrder}`);\n }\n const littleEndian = byteOrder === 1;\n const typeCode = reader.readUint32(littleEndian);\n if ((typeCode & FLAG_Z) !== 0 || (typeCode & FLAG_M) !== 0) {\n throw new Error('Geometry wire value: Z/M coordinates are not supported');\n }\n const geomType = typeCode & TYPE_MASK;\n if ((typeCode & FLAG_SRID) !== 0) {\n return { geomType, littleEndian, srid: reader.readUint32(littleEndian) };\n }\n return { geomType, littleEndian };\n}\n\nfunction readPosition(reader: Reader, littleEndian: boolean): Position {\n const x = reader.readFloat64(littleEndian);\n const y = reader.readFloat64(littleEndian);\n return [x, y];\n}\n\nfunction readPoint(reader: Reader, header: Header): GeometryPoint {\n const coords = readPosition(reader, header.littleEndian);\n return header.srid !== undefined\n ? { type: 'Point', coordinates: coords, srid: header.srid }\n : { type: 'Point', coordinates: coords };\n}\n\nfunction readLineString(reader: Reader, header: Header): GeometryLineString {\n const n = reader.readUint32(header.littleEndian);\n const coords: Position[] = [];\n for (let i = 0; i < n; i++) coords.push(readPosition(reader, header.littleEndian));\n return header.srid !== undefined\n ? { type: 'LineString', coordinates: coords, srid: header.srid }\n : { type: 'LineString', coordinates: coords };\n}\n\nfunction readPolygon(reader: Reader, header: Header): GeometryPolygon {\n const numRings = reader.readUint32(header.littleEndian);\n const rings: Position[][] = [];\n for (let r = 0; r < numRings; r++) {\n const n = reader.readUint32(header.littleEndian);\n const ring: Position[] = [];\n for (let i = 0; i < n; i++) ring.push(readPosition(reader, header.littleEndian));\n rings.push(ring);\n }\n return header.srid !== undefined\n ? { type: 'Polygon', coordinates: rings, srid: header.srid }\n : { type: 'Polygon', coordinates: rings };\n}\n\nfunction readSubGeometry(reader: Reader): Geometry {\n // Multi* geometries embed sub-WKB records; each carries its own header.\n const header = readHeader(reader);\n switch (header.geomType) {\n case TYPE_POINT:\n return readPoint(reader, header);\n case TYPE_LINESTRING:\n return readLineString(reader, header);\n case TYPE_POLYGON:\n return readPolygon(reader, header);\n default:\n throw new Error(`Geometry wire value: unsupported sub-type ${header.geomType}`);\n }\n}\n\nfunction readMultiPoint(reader: Reader, header: Header): GeometryMultiPoint {\n const n = reader.readUint32(header.littleEndian);\n const coords: Position[] = [];\n for (let i = 0; i < n; i++) {\n const sub = readSubGeometry(reader);\n if (sub.type !== 'Point') {\n throw new Error('Geometry wire value: MultiPoint contains non-Point sub-geometry');\n }\n coords.push(sub.coordinates);\n }\n return header.srid !== undefined\n ? { type: 'MultiPoint', coordinates: coords, srid: header.srid }\n : { type: 'MultiPoint', coordinates: coords };\n}\n\nfunction readMultiLineString(reader: Reader, header: Header): GeometryMultiLineString {\n const n = reader.readUint32(header.littleEndian);\n const lines: ReadonlyArray<Position>[] = [];\n for (let i = 0; i < n; i++) {\n const sub = readSubGeometry(reader);\n if (sub.type !== 'LineString') {\n throw new Error('Geometry wire value: MultiLineString contains non-LineString sub-geometry');\n }\n lines.push(sub.coordinates);\n }\n return header.srid !== undefined\n ? { type: 'MultiLineString', coordinates: lines, srid: header.srid }\n : { type: 'MultiLineString', coordinates: lines };\n}\n\nfunction readMultiPolygon(reader: Reader, header: Header): GeometryMultiPolygon {\n const n = reader.readUint32(header.littleEndian);\n const polys: ReadonlyArray<ReadonlyArray<Position>>[] = [];\n for (let i = 0; i < n; i++) {\n const sub = readSubGeometry(reader);\n if (sub.type !== 'Polygon') {\n throw new Error('Geometry wire value: MultiPolygon contains non-Polygon sub-geometry');\n }\n polys.push(sub.coordinates);\n }\n return header.srid !== undefined\n ? { type: 'MultiPolygon', coordinates: polys, srid: header.srid }\n : { type: 'MultiPolygon', coordinates: polys };\n}\n\nexport function decodeEWKBHex(hex: string): Geometry {\n const reader = new Reader(hexToBytes(hex));\n const header = readHeader(reader);\n const geometry = readGeometryBody(reader, header);\n if (reader.hasRemaining()) {\n throw new Error(\n `Geometry wire value: trailing data after geometry (${reader.remainingBytes()} bytes)`,\n );\n }\n return geometry;\n}\n\nfunction readGeometryBody(reader: Reader, header: Header): Geometry {\n switch (header.geomType) {\n case TYPE_POINT:\n return readPoint(reader, header);\n case TYPE_LINESTRING:\n return readLineString(reader, header);\n case TYPE_POLYGON:\n return readPolygon(reader, header);\n case TYPE_MULTIPOINT:\n return readMultiPoint(reader, header);\n case TYPE_MULTILINESTRING:\n return readMultiLineString(reader, header);\n case TYPE_MULTIPOLYGON:\n return readMultiPolygon(reader, header);\n default:\n throw new Error(`Geometry wire value: unsupported geometry type ${header.geomType}`);\n }\n}\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 */\nexport function encodeEWKT(value: Geometry): string {\n const sridPrefix = value.srid !== undefined ? `SRID=${value.srid};` : '';\n switch (value.type) {\n case 'Point':\n return `${sridPrefix}POINT(${formatPosition(value.coordinates)})`;\n case 'LineString':\n return `${sridPrefix}LINESTRING(${value.coordinates.map(formatPosition).join(',')})`;\n case 'Polygon':\n return `${sridPrefix}POLYGON(${formatRings(value.coordinates)})`;\n case 'MultiPoint':\n return `${sridPrefix}MULTIPOINT(${value.coordinates.map(formatPosition).join(',')})`;\n case 'MultiLineString':\n return `${sridPrefix}MULTILINESTRING(${value.coordinates\n .map((line) => `(${line.map(formatPosition).join(',')})`)\n .join(',')})`;\n case 'MultiPolygon':\n return `${sridPrefix}MULTIPOLYGON(${value.coordinates\n .map((poly) => `(${formatRings(poly)})`)\n .join(',')})`;\n }\n}\n\nfunction formatPosition(p: Position): string {\n if (!Number.isFinite(p[0]) || !Number.isFinite(p[1])) {\n throw new Error('Geometry encode: coordinates must be finite numbers');\n }\n return `${p[0]} ${p[1]}`;\n}\n\nfunction formatRings(rings: ReadonlyArray<ReadonlyArray<Position>>): string {\n return rings.map((ring) => `(${ring.map(formatPosition).join(',')})`).join(',');\n}\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 CodecDescriptorImpl}\n * with the codec id, traits, target types, params schema\n * (`{ srid: number }`, validated as a non-negative integer), and\n * the emit-path `renderOutputType` producing `Geometry<${srid}>` /\n * `Geometry` when no SRID is supplied.\n * 3. `pgGeometryColumn({ srid })` per-codec column helper invoking\n * `descriptor.factory({ srid })` and passing the bare\n * `nativeType: 'geometry'`. The family-layer `expandNativeType`\n * hook renders the parameterised form\n * (`geometry(Geometry,${srid})`) at emit/verify time from\n * `nativeType` + `typeParams`.\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 */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\nimport {\n type AnyCodecDescriptor,\n type CodecCallContext,\n CodecDescriptorImpl,\n CodecImpl,\n type CodecInstanceContext,\n type ColumnHelperFor,\n type ColumnHelperForStrict,\n column,\n} from '@prisma-next/framework-components/codec';\nimport type { ExtractCodecTypes } from '@prisma-next/sql-relational-core/ast';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { type as arktype } from 'arktype';\nimport { POSTGIS_GEOMETRY_CODEC_ID } from './constants';\nimport { decodeEWKBHex, encodeEWKT } from './ewkb';\nimport type { Geometry } from './geojson';\n\ntype GeometryParams = { readonly srid: number };\n\nconst geometryParamsSchema = arktype({\n srid: 'number',\n}).narrow((params, ctx) => {\n const { srid } = params;\n if (!Number.isInteger(srid)) {\n return ctx.mustBe('an integer');\n }\n if (srid < 0) {\n return ctx.mustBe('a non-negative integer');\n }\n return true;\n}) satisfies StandardSchemaV1<GeometryParams>;\n\nconst POSTGIS_GEOMETRY_META = {\n db: { sql: { postgres: { nativeType: 'geometry' } } },\n} as const;\n\nconst allowedGeometryTypes = new Set([\n 'Point',\n 'LineString',\n 'Polygon',\n 'MultiPoint',\n 'MultiLineString',\n 'MultiPolygon',\n]);\n\nfunction assertGeometry(value: unknown): asserts value is Geometry {\n if (!value || typeof value !== 'object') {\n throw new Error('Geometry value must be a GeoJSON-shaped object');\n }\n const type = (value as { type?: unknown }).type;\n if (typeof type !== 'string' || !allowedGeometryTypes.has(type)) {\n throw new Error(\n `Geometry value: unsupported type \"${String(type)}\" (expected Point, LineString, Polygon, MultiPoint, MultiLineString, or MultiPolygon)`,\n );\n }\n if (!Array.isArray((value as { coordinates?: unknown }).coordinates)) {\n throw new Error('Geometry value: \"coordinates\" must be an array');\n }\n}\n\nexport class PostgisGeometryCodec extends CodecImpl<\n typeof POSTGIS_GEOMETRY_CODEC_ID,\n readonly ['equality'],\n string,\n Geometry\n> {\n constructor(descriptor: AnyCodecDescriptor) {\n super(descriptor);\n }\n\n async encode(value: Geometry, _ctx: CodecCallContext): Promise<string> {\n assertGeometry(value);\n return encodeEWKT(value);\n }\n\n async decode(wire: string, _ctx: CodecCallContext): Promise<Geometry> {\n if (typeof wire !== 'string') {\n throw new Error('Geometry wire value must be a string');\n }\n return decodeEWKBHex(wire);\n }\n\n encodeJson(value: Geometry): JsonValue {\n assertGeometry(value);\n return value as unknown as JsonValue;\n }\n\n decodeJson(json: JsonValue): Geometry {\n assertGeometry(json);\n return json;\n }\n}\n\nexport class PostgisGeometryDescriptor extends CodecDescriptorImpl<GeometryParams> {\n override readonly codecId = POSTGIS_GEOMETRY_CODEC_ID;\n override readonly traits = ['equality'] as const;\n override readonly targetTypes = ['geometry'] as const;\n override readonly meta = POSTGIS_GEOMETRY_META;\n override readonly paramsSchema: StandardSchemaV1<GeometryParams> = geometryParamsSchema;\n override renderOutputType(params: GeometryParams): string {\n const srid = (params as GeometryParams | undefined)?.srid;\n if (srid === undefined) return 'Geometry';\n return `Geometry<${srid}>`;\n }\n /**\n * The runtime calls `factory(undefined)(ctx)` to materialize a\n * representative codec for parameterised descriptors that ship a\n * no-params column variant (here, `geometryColumn` vs `geometry({ srid })`).\n * The runtime cast widens `params` to `unknown`, so guarding with an\n * optional read keeps the typed call site (`factory({ srid })`)\n * strict while still producing an SRID-agnostic codec for\n * representative use. Encode/decode for an unparameterised column\n * runs through this representative; the wire format already carries\n * SRID inside the EWKT/EWKB payload, so it's dimension-independent.\n */\n override factory(_params: GeometryParams): (ctx: CodecInstanceContext) => PostgisGeometryCodec {\n return () => new PostgisGeometryCodec(this);\n }\n}\n\nexport const postgisGeometryDescriptor = new PostgisGeometryDescriptor();\n\n/**\n * Per-codec column helper for `pg/geometry@1` with an SRID constraint.\n *\n * Generic over `S extends number` so the column site preserves the\n * SRID literal in `typeParams` (e.g. `pgGeometryColumn({ srid: 4326 })`\n * packs `typeParams: { srid: 4326 }`).\n *\n * Passes the bare `nativeType: 'geometry'`; the family-layer\n * `expandNativeType` hook renders the parameterised form\n * (`geometry(Geometry,${srid})`) at emit/verify time from `nativeType`\n * + `typeParams`.\n *\n * @throws {RangeError} If `srid` is not a non-negative integer.\n */\nexport const pgGeometryColumn = <S extends number>(options: { readonly srid: S }) => {\n const { srid } = options;\n if (!Number.isInteger(srid) || srid < 0) {\n throw new RangeError(`postgis: srid must be a non-negative integer, got ${srid}`);\n }\n return column(\n postgisGeometryDescriptor.factory({ srid }),\n postgisGeometryDescriptor.codecId,\n { srid },\n 'geometry',\n );\n};\n\npgGeometryColumn satisfies ColumnHelperFor<PostgisGeometryDescriptor>;\npgGeometryColumn satisfies ColumnHelperForStrict<PostgisGeometryDescriptor>;\n\nconst codecDescriptorMap = {\n geometry: postgisGeometryDescriptor,\n} as const;\n\nexport type CodecTypes = ExtractCodecTypes<typeof codecDescriptorMap>;\n\nexport const codecDescriptors: readonly AnyCodecDescriptor[] = Object.values(codecDescriptorMap);\n","import { buildCodecDescriptorRegistry } from '@prisma-next/sql-relational-core/codec-descriptor-registry';\nimport type { CodecDescriptorRegistry } from '@prisma-next/sql-relational-core/query-lane-context';\nimport { codecDescriptors } from './codecs';\n\n/**\n * Registry of every codec descriptor shipped by `@prisma-next/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 */\nexport const postgisCodecRegistry: CodecDescriptorRegistry =\n buildCodecDescriptorRegistry(codecDescriptors);\n","import { buildOperation, codecOf, toExpr } from '@prisma-next/sql-relational-core/expression';\nimport type { CodecTypes } from '../types/codec-types';\nimport type { QueryOperationTypes } from '../types/operation-types';\nimport { postgisAuthoringTypes } from './authoring';\nimport { postgisCodecRegistry } from './registry';\n\nconst postgisTypeId = 'pg/geometry@1' as const;\n\ntype CodecTypesBase = Record<string, { readonly input: unknown; readonly output: unknown }>;\n\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 */\nexport function postgisQueryOperations<CT extends CodecTypesBase>(): QueryOperationTypes<CT> {\n return {\n distance: {\n self: { codecId: postgisTypeId },\n impl: (self, other) => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method: 'distance',\n args: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n returns: { codecId: 'pg/float8@1', nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: 'ST_Distance({{self}}, {{arg0}})',\n },\n });\n },\n },\n distanceSphere: {\n self: { codecId: postgisTypeId },\n impl: (self, other) => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method: 'distanceSphere',\n args: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n returns: { codecId: 'pg/float8@1', nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: 'ST_DistanceSphere({{self}}, {{arg0}})',\n },\n });\n },\n },\n dwithin: {\n self: { codecId: postgisTypeId },\n impl: (self, other, distance) => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method: 'dwithin',\n args: [\n toExpr(self, selfCodec),\n toExpr(other, selfCodec),\n toExpr(distance, { codecId: 'pg/float8@1' }),\n ],\n returns: { codecId: 'pg/bool@1', nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: 'ST_DWithin({{self}}, {{arg0}}, {{arg1}})',\n },\n });\n },\n },\n contains: {\n self: { codecId: postgisTypeId },\n impl: (self, other) => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method: 'contains',\n args: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n returns: { codecId: 'pg/bool@1', nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: 'ST_Contains({{self}}, {{arg0}})',\n },\n });\n },\n },\n within: {\n self: { codecId: postgisTypeId },\n impl: (self, other) => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method: 'within',\n args: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n returns: { codecId: 'pg/bool@1', nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: 'ST_Within({{self}}, {{arg0}})',\n },\n });\n },\n },\n intersects: {\n self: { codecId: postgisTypeId },\n impl: (self, other) => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method: 'intersects',\n args: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n returns: { codecId: 'pg/bool@1', nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: 'ST_Intersects({{self}}, {{arg0}})',\n },\n });\n },\n },\n intersectsBbox: {\n self: { codecId: postgisTypeId },\n impl: (self, other) => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method: 'intersectsBbox',\n args: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n returns: { codecId: 'pg/bool@1', nullable: false },\n lowering: {\n targetFamily: 'sql',\n strategy: 'function',\n template: '({{self}} && {{arg0}})',\n },\n });\n },\n },\n };\n}\n\nconst postgisPackMetaBase = {\n kind: 'extension',\n id: 'postgis',\n familyId: 'sql',\n targetId: 'postgres',\n version: '0.0.1',\n capabilities: {\n postgres: {\n 'postgis.geometry': true,\n },\n },\n authoring: {\n type: postgisAuthoringTypes,\n },\n types: {\n codecTypes: {\n codecDescriptors: Array.from(postgisCodecRegistry.values()),\n import: {\n package: '@prisma-next/extension-postgis/codec-types',\n named: 'CodecTypes',\n alias: 'PostgisTypes',\n },\n typeImports: [\n {\n package: '@prisma-next/extension-postgis/codec-types',\n named: 'Geometry',\n alias: 'Geometry',\n },\n ],\n },\n queryOperationTypes: {\n import: {\n package: '@prisma-next/extension-postgis/operation-types',\n named: 'QueryOperationTypes',\n alias: 'PostgisQueryOperationTypes',\n },\n },\n storage: [\n { typeId: postgisTypeId, familyId: 'sql', targetId: 'postgres', nativeType: 'geometry' },\n ],\n },\n} as const;\n\nexport const postgisPackMeta: typeof postgisPackMetaBase & {\n readonly __codecTypes?: CodecTypes;\n} = postgisPackMetaBase;\n"],"mappings":";;;;;;AAGA,MAAa,wBAAwB,EACnC,SAAS,EACP,UAAU;CACR,MAAM;CACN,MAAM,CAAC;EAAE,MAAM;EAAU,MAAM;EAAQ,SAAS;EAAM,SAAS;CAAE,CAAC;CAClE,QAAQ;EACN,SAAS;EACT,YAAY;EACZ,YAAY,EACV,MAAM;GAAE,MAAM;GAAO,OAAO;EAAE,EAChC;CACF;AACF,EACF,EACF;;;ACKA,MAAM,SAAS;AACf,MAAM,SAAS;AACf,MAAM,YAAY;AAClB,MAAM,YAAY;AAElB,MAAM,aAAa;AACnB,MAAM,kBAAkB;AACxB,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;AAC7B,MAAM,oBAAoB;AAE1B,MAAM,cAAc;AAEpB,SAAS,WAAW,KAAyB;CAC3C,IAAI,IAAI,SAAS,MAAM,GACrB,MAAM,IAAI,MAAM,4CAA4C;CAE9D,MAAM,QAAQ,IAAI,WAAW,IAAI,SAAS,CAAC;CAC3C,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EACrC,MAAM,OAAO,IAAI,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC;EACvC,IAAI,CAAC,YAAY,KAAK,IAAI,GACxB,MAAM,IAAI,MAAM,mDAAmD,IAAI,GAAG;EAE5E,MAAM,KAAK,OAAO,SAAS,MAAM,EAAE;CACrC;CACA,OAAO;AACT;AAEA,IAAM,SAAN,MAAa;CACX,SAAiB;CACjB;CAEA,YAAY,OAAmB;EAC7B,KA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GACV,MAAM,EAAE,SAAS,cAAc;GAC/B,OAAO,MAAM,UAAU;IACrB,MAAM,YAAY,QAAQ,IAAI;IAC9B,OAAO,eAAe;KACpB,QAAQ;KACR,MAAM,CAAC,OAAO,MAAM,SAAS,GAAG,OAAO,OAAO,SAAS,CAAC;KACxD,SAAS;MAAE,SAAS;MAAa,UAAU;KAAM;KACjD,UAAU;MACR,cAAc;MACd,UAAU;MACV,UAAU;KACZ;IACF,CAAC;GACH;EACF;EACA,gBAAgB;GACd,MAAM,EAAE,SAAS,cAAc;GAC/B,OAAO,MAAM,UAAU;IACrB,MAAM,YAAY,QAAQ,IAAI;IAC9B,OAAO,eAAe;KACpB,QAAQ;KACR,MAAM,CAAC,OAAO,MAAM,SAAS,GAAG,OAAO,OAAO,SAAS,CAAC;KACxD,SAAS;MAAE,SAAS;MAAa,UAAU;KAAM;KACjD,UAAU;MACR,cAAc;MACd,UAAU;MACV,UAAU;KACZ;IACF,CAAC;GACH;EACF;CACF;AACF;AA6CA,MAAa,kBAET;CA5CF,MAAM;CACN,IAAI;CACJ,UAAU;CACV,UAAU;CACV,SAAS;CACT,cAAc,EACZ,UAAU,EACR,oBAAoB,KACtB,EACF;CACA,WAAW,EACT,MAAM,sBACR;CACA,OAAO;EACL,YAAY;GACV,kBAAkB,MAAM,KAAK,qBAAqB,OAAO,CAAC;GAC1D,QAAQ;IACN,SAAS;IACT,OAAO;IACP,OAAO;GACT;GACA,aAAa,CACX;IACE,SAAS;IACT,OAAO;IACP,OAAO;GACT,CACF;EACF;EACA,qBAAqB,EACnB,QAAQ;GACN,SAAS;GACT,OAAO;GACP,OAAO;EACT,EACF;EACA,SAAS,CACP;GAAE,QAAQ;GAAe,UAAU;GAAO,UAAU;GAAY,YAAY;EAAW,CACzF;CACF;AAKE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geojson-Cj4ldHQ0.d.mts","names":[],"sources":["../src/core/geojson.ts"],"mappings":";;AAQA
|
|
1
|
+
{"version":3,"file":"geojson-Cj4ldHQ0.d.mts","names":[],"sources":["../src/core/geojson.ts"],"mappings":";;AAQA;;;;AAAoB;AAEpB;KAFY,QAAA;AAAA,KAEA,aAAA;EAAA,SACD,IAAA;EAAA,SACA,WAAA,EAAa,QAAQ;EAAA,SACrB,IAAA;AAAA;AAAA,KAGC,kBAAA;EAAA,SACD,IAAA;EAAA,SACA,WAAA,EAAa,aAAa,CAAC,QAAA;EAAA,SAC3B,IAAA;AAAA;AAAA,KAGC,eAAA;EAAA,SACD,IAAA;EAAA,SACA,WAAA,EAAa,aAAA,CAAc,aAAA,CAAc,QAAA;EAAA,SACzC,IAAA;AAAA;AAAA,KAGC,kBAAA;EAAA,SACD,IAAA;EAAA,SACA,WAAA,EAAa,aAAa,CAAC,QAAA;EAAA,SAC3B,IAAA;AAAA;AAAA,KAGC,uBAAA;EAAA,SACD,IAAA;EAAA,SACA,WAAA,EAAa,aAAA,CAAc,aAAA,CAAc,QAAA;EAAA,SACzC,IAAA;AAAA;AAAA,KAGC,oBAAA;EAAA,SACD,IAAA;EAAA,SACA,WAAA,EAAa,aAAA,CAAc,aAAA,CAAc,aAAA,CAAc,QAAA;EAAA,SACvD,IAAA;AAAA;AAAA,KAGC,QAAA,GACR,aAAA,GACA,kBAAA,GACA,eAAA,GACA,kBAAA,GACA,uBAAA,GACA,oBAAA;;;;AA3BW;AAGf;;iBAgCgB,KAAA,CAAM,SAAA,UAAmB,QAAA,UAAkB,IAAA,YAAgB,aAAa;;;;;iBAaxE,OAAA,CAAQ,IAAA,EAAM,aAAA,CAAc,QAAA,GAAW,IAAA,YAAgB,eAAA;;;AA1CxD;AAGf;;iBAoEgB,WAAA,CACd,IAAA,6CACA,IAAA,YACC,eAAe"}
|
package/dist/geojson.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geojson.mjs","names":[],"sources":["../src/core/geojson.ts"],"sourcesContent":["/**\n * GeoJSON-shaped value types used by the PostGIS codec.\n *\n * The codec speaks GeoJSON-style objects to JavaScript callers and\n * EWKT/EWKB on the wire. This file is the single source of truth for the\n * value shapes; the public type re-export lives in `exports/geojson.ts`.\n */\n\nexport type Position = readonly [number, number];\n\nexport type GeometryPoint = {\n readonly type: 'Point';\n readonly coordinates: Position;\n readonly srid?: number;\n};\n\nexport type GeometryLineString = {\n readonly type: 'LineString';\n readonly coordinates: ReadonlyArray<Position>;\n readonly srid?: number;\n};\n\nexport type GeometryPolygon = {\n readonly type: 'Polygon';\n readonly coordinates: ReadonlyArray<ReadonlyArray<Position>>;\n readonly srid?: number;\n};\n\nexport type GeometryMultiPoint = {\n readonly type: 'MultiPoint';\n readonly coordinates: ReadonlyArray<Position>;\n readonly srid?: number;\n};\n\nexport type GeometryMultiLineString = {\n readonly type: 'MultiLineString';\n readonly coordinates: ReadonlyArray<ReadonlyArray<Position>>;\n readonly srid?: number;\n};\n\nexport type GeometryMultiPolygon = {\n readonly type: 'MultiPolygon';\n readonly coordinates: ReadonlyArray<ReadonlyArray<ReadonlyArray<Position>>>;\n readonly srid?: number;\n};\n\nexport type Geometry =\n | GeometryPoint\n | GeometryLineString\n | GeometryPolygon\n | GeometryMultiPoint\n | GeometryMultiLineString\n | GeometryMultiPolygon;\n\n/**\n * Construct a Point. Convenience for the common \"lng/lat\" case.\n *\n * @example\n * point(-122.4194, 37.7749, 4326)\n */\nexport function point(longitude: number, latitude: number, srid?: number): GeometryPoint {\n if (!Number.isFinite(longitude) || !Number.isFinite(latitude)) {\n throw new RangeError('point: coordinates must be finite numbers');\n }\n return srid !== undefined\n ? { type: 'Point', coordinates: [longitude, latitude], srid }\n : { type: 'Point', coordinates: [longitude, latitude] };\n}\n\n/**\n * Construct a Polygon from a single outer ring of `[lng, lat]` pairs.\n * If the first and last positions differ, the ring is closed automatically.\n */\nexport function polygon(ring: ReadonlyArray<Position>, srid?: number): GeometryPolygon {\n if (ring.length < 3) {\n throw new Error('polygon: ring must contain at least 3 positions');\n }\n const first = ring[0];\n const last = ring[ring.length - 1];\n if (!first || !last) {\n throw new Error('polygon: ring positions cannot be undefined');\n }\n for (const position of ring) {\n if (!Number.isFinite(position[0]) || !Number.isFinite(position[1])) {\n throw new RangeError('polygon: coordinates must be finite numbers');\n }\n }\n const closed = first[0] === last[0] && first[1] === last[1] ? ring : [...ring, first];\n const distinct = new Set(closed.slice(0, -1).map(([x, y]) => `${x},${y}`));\n if (distinct.size < 3) {\n throw new Error('polygon: ring must contain at least 3 distinct positions');\n }\n return srid !== undefined\n ? { type: 'Polygon', coordinates: [closed], srid }\n : { type: 'Polygon', coordinates: [closed] };\n}\n\n/**\n * Construct a rectangular Polygon from a bounding box.\n *\n * @param bbox - `[minLng, minLat, maxLng, maxLat]`\n */\nexport function bboxPolygon(\n bbox: readonly [number, number, number, number],\n srid?: number,\n): GeometryPolygon {\n const [minX, minY, maxX, maxY] = bbox;\n if (\n !Number.isFinite(minX) ||\n !Number.isFinite(minY) ||\n !Number.isFinite(maxX) ||\n !Number.isFinite(maxY)\n ) {\n throw new RangeError('bboxPolygon: coordinates must be finite numbers');\n }\n if (minX > maxX || minY > maxY) {\n throw new Error(\n `bboxPolygon: inverted bbox [${minX}, ${minY}, ${maxX}, ${maxY}] (expected minX <= maxX and minY <= maxY)`,\n );\n }\n return polygon(\n [\n [minX, minY],\n [maxX, minY],\n [maxX, maxY],\n [minX, maxY],\n [minX, minY],\n ],\n srid,\n );\n}\n"],"mappings":";;;;;;;AA4DA,SAAgB,MAAM,WAAmB,UAAkB,MAA8B;CACvF,IAAI,CAAC,OAAO,SAAS,
|
|
1
|
+
{"version":3,"file":"geojson.mjs","names":[],"sources":["../src/core/geojson.ts"],"sourcesContent":["/**\n * GeoJSON-shaped value types used by the PostGIS codec.\n *\n * The codec speaks GeoJSON-style objects to JavaScript callers and\n * EWKT/EWKB on the wire. This file is the single source of truth for the\n * value shapes; the public type re-export lives in `exports/geojson.ts`.\n */\n\nexport type Position = readonly [number, number];\n\nexport type GeometryPoint = {\n readonly type: 'Point';\n readonly coordinates: Position;\n readonly srid?: number;\n};\n\nexport type GeometryLineString = {\n readonly type: 'LineString';\n readonly coordinates: ReadonlyArray<Position>;\n readonly srid?: number;\n};\n\nexport type GeometryPolygon = {\n readonly type: 'Polygon';\n readonly coordinates: ReadonlyArray<ReadonlyArray<Position>>;\n readonly srid?: number;\n};\n\nexport type GeometryMultiPoint = {\n readonly type: 'MultiPoint';\n readonly coordinates: ReadonlyArray<Position>;\n readonly srid?: number;\n};\n\nexport type GeometryMultiLineString = {\n readonly type: 'MultiLineString';\n readonly coordinates: ReadonlyArray<ReadonlyArray<Position>>;\n readonly srid?: number;\n};\n\nexport type GeometryMultiPolygon = {\n readonly type: 'MultiPolygon';\n readonly coordinates: ReadonlyArray<ReadonlyArray<ReadonlyArray<Position>>>;\n readonly srid?: number;\n};\n\nexport type Geometry =\n | GeometryPoint\n | GeometryLineString\n | GeometryPolygon\n | GeometryMultiPoint\n | GeometryMultiLineString\n | GeometryMultiPolygon;\n\n/**\n * Construct a Point. Convenience for the common \"lng/lat\" case.\n *\n * @example\n * point(-122.4194, 37.7749, 4326)\n */\nexport function point(longitude: number, latitude: number, srid?: number): GeometryPoint {\n if (!Number.isFinite(longitude) || !Number.isFinite(latitude)) {\n throw new RangeError('point: coordinates must be finite numbers');\n }\n return srid !== undefined\n ? { type: 'Point', coordinates: [longitude, latitude], srid }\n : { type: 'Point', coordinates: [longitude, latitude] };\n}\n\n/**\n * Construct a Polygon from a single outer ring of `[lng, lat]` pairs.\n * If the first and last positions differ, the ring is closed automatically.\n */\nexport function polygon(ring: ReadonlyArray<Position>, srid?: number): GeometryPolygon {\n if (ring.length < 3) {\n throw new Error('polygon: ring must contain at least 3 positions');\n }\n const first = ring[0];\n const last = ring[ring.length - 1];\n if (!first || !last) {\n throw new Error('polygon: ring positions cannot be undefined');\n }\n for (const position of ring) {\n if (!Number.isFinite(position[0]) || !Number.isFinite(position[1])) {\n throw new RangeError('polygon: coordinates must be finite numbers');\n }\n }\n const closed = first[0] === last[0] && first[1] === last[1] ? ring : [...ring, first];\n const distinct = new Set(closed.slice(0, -1).map(([x, y]) => `${x},${y}`));\n if (distinct.size < 3) {\n throw new Error('polygon: ring must contain at least 3 distinct positions');\n }\n return srid !== undefined\n ? { type: 'Polygon', coordinates: [closed], srid }\n : { type: 'Polygon', coordinates: [closed] };\n}\n\n/**\n * Construct a rectangular Polygon from a bounding box.\n *\n * @param bbox - `[minLng, minLat, maxLng, maxLat]`\n */\nexport function bboxPolygon(\n bbox: readonly [number, number, number, number],\n srid?: number,\n): GeometryPolygon {\n const [minX, minY, maxX, maxY] = bbox;\n if (\n !Number.isFinite(minX) ||\n !Number.isFinite(minY) ||\n !Number.isFinite(maxX) ||\n !Number.isFinite(maxY)\n ) {\n throw new RangeError('bboxPolygon: coordinates must be finite numbers');\n }\n if (minX > maxX || minY > maxY) {\n throw new Error(\n `bboxPolygon: inverted bbox [${minX}, ${minY}, ${maxX}, ${maxY}] (expected minX <= maxX and minY <= maxY)`,\n );\n }\n return polygon(\n [\n [minX, minY],\n [maxX, minY],\n [maxX, maxY],\n [minX, maxY],\n [minX, minY],\n ],\n srid,\n );\n}\n"],"mappings":";;;;;;;AA4DA,SAAgB,MAAM,WAAmB,UAAkB,MAA8B;CACvF,IAAI,CAAC,OAAO,SAAS,SAAS,KAAK,CAAC,OAAO,SAAS,QAAQ,GAC1D,MAAM,IAAI,WAAW,2CAA2C;CAElE,OAAO,SAAS,KAAA,IACZ;EAAE,MAAM;EAAS,aAAa,CAAC,WAAW,QAAQ;EAAG;CAAK,IAC1D;EAAE,MAAM;EAAS,aAAa,CAAC,WAAW,QAAQ;CAAE;AAC1D;;;;;AAMA,SAAgB,QAAQ,MAA+B,MAAgC;CACrF,IAAI,KAAK,SAAS,GAChB,MAAM,IAAI,MAAM,iDAAiD;CAEnE,MAAM,QAAQ,KAAK;CACnB,MAAM,OAAO,KAAK,KAAK,SAAS;CAChC,IAAI,CAAC,SAAS,CAAC,MACb,MAAM,IAAI,MAAM,6CAA6C;CAE/D,KAAK,MAAM,YAAY,MACrB,IAAI,CAAC,OAAO,SAAS,SAAS,EAAE,KAAK,CAAC,OAAO,SAAS,SAAS,EAAE,GAC/D,MAAM,IAAI,WAAW,6CAA6C;CAGtE,MAAM,SAAS,MAAM,OAAO,KAAK,MAAM,MAAM,OAAO,KAAK,KAAK,OAAO,CAAC,GAAG,MAAM,KAAK;CAEpF,IAAI,IADiB,IAAI,OAAO,MAAM,GAAG,EAAE,EAAE,KAAK,CAAC,GAAG,OAAO,GAAG,EAAE,GAAG,GAAG,CAC7D,EAAE,OAAO,GAClB,MAAM,IAAI,MAAM,0DAA0D;CAE5E,OAAO,SAAS,KAAA,IACZ;EAAE,MAAM;EAAW,aAAa,CAAC,MAAM;EAAG;CAAK,IAC/C;EAAE,MAAM;EAAW,aAAa,CAAC,MAAM;CAAE;AAC/C;;;;;;AAOA,SAAgB,YACd,MACA,MACiB;CACjB,MAAM,CAAC,MAAM,MAAM,MAAM,QAAQ;CACjC,IACE,CAAC,OAAO,SAAS,IAAI,KACrB,CAAC,OAAO,SAAS,IAAI,KACrB,CAAC,OAAO,SAAS,IAAI,KACrB,CAAC,OAAO,SAAS,IAAI,GAErB,MAAM,IAAI,WAAW,iDAAiD;CAExE,IAAI,OAAO,QAAQ,OAAO,MACxB,MAAM,IAAI,MACR,+BAA+B,KAAK,IAAI,KAAK,IAAI,KAAK,IAAI,KAAK,2CACjE;CAEF,OAAO,QACL;EACE,CAAC,MAAM,IAAI;EACX,CAAC,MAAM,IAAI;EACX,CAAC,MAAM,IAAI;EACX,CAAC,MAAM,IAAI;EACX,CAAC,MAAM,IAAI;CACb,GACA,IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-types-C2s9tY0P.d.mts","names":[],"sources":["../src/types/operation-types.ts"],"mappings":";;;;KAGK,cAAA,GAAiB,
|
|
1
|
+
{"version":3,"file":"operation-types-C2s9tY0P.d.mts","names":[],"sources":["../src/types/operation-types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,YAAA,GAAe,
|
|
1
|
+
{"version":3,"file":"pack.d.mts","names":[],"sources":["../src/core/descriptor-meta.ts"],"mappings":";;;;cA4IM,mBAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAyCI,0CAAA,CAAA,eAAA;MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;cAEG,eAAA,SAAwB,mBAAA;EAAA,SAC1B,YAAA,GAAe,UAAU;AAAA"}
|
package/dist/runtime.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/core/registry.ts","../src/exports/runtime.ts"],"mappings":";;;;;;;AAYA
|
|
1
|
+
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/core/registry.ts","../src/exports/runtime.ts"],"mappings":";;;;;;;AAYA;;;;AACgD;cADnC,oBAAA,EAAsB,uBACa;;;cCT1C,wBAAA,EAA0B,6BAA6B"}
|
package/dist/runtime.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.mjs","names":[],"sources":["../src/exports/runtime.ts"],"sourcesContent":["import type { SqlRuntimeExtensionDescriptor } from '@prisma-next/sql-runtime';\nimport { postgisPackMeta, postgisQueryOperations } from '../core/descriptor-meta';\nimport { postgisCodecRegistry } from '../core/registry';\n\nconst postgisRuntimeDescriptor: SqlRuntimeExtensionDescriptor<'postgres'> = {\n kind: 'extension' as const,\n id: postgisPackMeta.id,\n version: postgisPackMeta.version,\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n // Expose the unified descriptor list so `extractCodecLookup` reads\n // `targetTypes` / `meta` / `renderOutputType` directly off the\n // descriptors and materialises the representative `Codec` for the\n // SQL renderer's cast-policy lookup. Without it, the Postgres\n // adapter's runtime codec lookup would miss `pg/geometry@1` and\n // `$N::geometry` casts would disappear once the renderer switches\n // to lookup-driven cast policy.\n types: {\n codecTypes: {\n codecDescriptors: Array.from(postgisCodecRegistry.values()),\n },\n },\n codecs: () => Array.from(postgisCodecRegistry.values()),\n queryOperations: () => postgisQueryOperations(),\n create() {\n return {\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n };\n },\n};\n\nexport { postgisCodecRegistry };\nexport default postgisRuntimeDescriptor;\n"],"mappings":";;AAIA,MAAM,2BAAsE;CAC1E,MAAM;CACN,IAAI,gBAAgB;CACpB,SAAS,gBAAgB;CACzB,UAAU;CACV,UAAU;CAQV,OAAO,EACL,YAAY,EACV,kBAAkB,MAAM,KAAK,qBAAqB,
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":[],"sources":["../src/exports/runtime.ts"],"sourcesContent":["import type { SqlRuntimeExtensionDescriptor } from '@prisma-next/sql-runtime';\nimport { postgisPackMeta, postgisQueryOperations } from '../core/descriptor-meta';\nimport { postgisCodecRegistry } from '../core/registry';\n\nconst postgisRuntimeDescriptor: SqlRuntimeExtensionDescriptor<'postgres'> = {\n kind: 'extension' as const,\n id: postgisPackMeta.id,\n version: postgisPackMeta.version,\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n // Expose the unified descriptor list so `extractCodecLookup` reads\n // `targetTypes` / `meta` / `renderOutputType` directly off the\n // descriptors and materialises the representative `Codec` for the\n // SQL renderer's cast-policy lookup. Without it, the Postgres\n // adapter's runtime codec lookup would miss `pg/geometry@1` and\n // `$N::geometry` casts would disappear once the renderer switches\n // to lookup-driven cast policy.\n types: {\n codecTypes: {\n codecDescriptors: Array.from(postgisCodecRegistry.values()),\n },\n },\n codecs: () => Array.from(postgisCodecRegistry.values()),\n queryOperations: () => postgisQueryOperations(),\n create() {\n return {\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n };\n },\n};\n\nexport { postgisCodecRegistry };\nexport default postgisRuntimeDescriptor;\n"],"mappings":";;AAIA,MAAM,2BAAsE;CAC1E,MAAM;CACN,IAAI,gBAAgB;CACpB,SAAS,gBAAgB;CACzB,UAAU;CACV,UAAU;CAQV,OAAO,EACL,YAAY,EACV,kBAAkB,MAAM,KAAK,qBAAqB,OAAO,CAAC,EAC5D,EACF;CACA,cAAc,MAAM,KAAK,qBAAqB,OAAO,CAAC;CACtD,uBAAuB,uBAAuB;CAC9C,SAAS;EACP,OAAO;GACL,UAAU;GACV,UAAU;EACZ;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,37 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/extension-postgis",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@prisma-next/contract": "0.
|
|
9
|
-
"@prisma-next/contract-authoring": "0.
|
|
10
|
-
"@prisma-next/family-sql": "0.
|
|
11
|
-
"@prisma-next/framework-components": "0.
|
|
12
|
-
"@prisma-next/migration-tools": "0.
|
|
13
|
-
"@prisma-next/sql-contract": "0.
|
|
14
|
-
"@prisma-next/sql-operations": "0.
|
|
15
|
-
"@prisma-next/sql-relational-core": "0.
|
|
16
|
-
"@prisma-next/sql-runtime": "0.
|
|
17
|
-
"@prisma-next/sql-schema-ir": "0.
|
|
8
|
+
"@prisma-next/contract": "0.12.0",
|
|
9
|
+
"@prisma-next/contract-authoring": "0.12.0",
|
|
10
|
+
"@prisma-next/family-sql": "0.12.0",
|
|
11
|
+
"@prisma-next/framework-components": "0.12.0",
|
|
12
|
+
"@prisma-next/migration-tools": "0.12.0",
|
|
13
|
+
"@prisma-next/sql-contract": "0.12.0",
|
|
14
|
+
"@prisma-next/sql-operations": "0.12.0",
|
|
15
|
+
"@prisma-next/sql-relational-core": "0.12.0",
|
|
16
|
+
"@prisma-next/sql-runtime": "0.12.0",
|
|
17
|
+
"@prisma-next/sql-schema-ir": "0.12.0",
|
|
18
18
|
"@standard-schema/spec": "^1.1.0",
|
|
19
19
|
"arktype": "^2.2.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@prisma-next/adapter-postgres": "0.
|
|
23
|
-
"@prisma-next/cli": "0.
|
|
24
|
-
"@prisma-next/operations": "0.
|
|
25
|
-
"@prisma-next/postgres": "0.
|
|
26
|
-
"@prisma-next/sql-contract-ts": "0.
|
|
27
|
-
"@prisma-next/target-postgres": "0.
|
|
28
|
-
"@prisma-next/test-utils": "0.
|
|
29
|
-
"@prisma-next/tsconfig": "0.
|
|
30
|
-
"@prisma-next/tsdown": "0.
|
|
22
|
+
"@prisma-next/adapter-postgres": "0.12.0",
|
|
23
|
+
"@prisma-next/cli": "0.12.0",
|
|
24
|
+
"@prisma-next/operations": "0.12.0",
|
|
25
|
+
"@prisma-next/postgres": "0.12.0",
|
|
26
|
+
"@prisma-next/sql-contract-ts": "0.12.0",
|
|
27
|
+
"@prisma-next/target-postgres": "0.12.0",
|
|
28
|
+
"@prisma-next/test-utils": "0.12.0",
|
|
29
|
+
"@prisma-next/tsconfig": "0.12.0",
|
|
30
|
+
"@prisma-next/tsdown": "0.12.0",
|
|
31
31
|
"tsdown": "0.22.0",
|
|
32
32
|
"typescript": "5.9.3",
|
|
33
33
|
"vitest": "4.1.6"
|
|
34
34
|
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"typescript": ">=5.9"
|
|
37
|
+
},
|
|
38
|
+
"peerDependenciesMeta": {
|
|
39
|
+
"typescript": {
|
|
40
|
+
"optional": true
|
|
41
|
+
}
|
|
42
|
+
},
|
|
35
43
|
"files": [
|
|
36
44
|
"dist",
|
|
37
45
|
"src"
|
|
@@ -46,6 +54,9 @@
|
|
|
46
54
|
"./runtime": "./dist/runtime.mjs",
|
|
47
55
|
"./package.json": "./package.json"
|
|
48
56
|
},
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=24"
|
|
59
|
+
},
|
|
49
60
|
"repository": {
|
|
50
61
|
"type": "git",
|
|
51
62
|
"url": "https://github.com/prisma/prisma-next.git",
|
package/src/contract.d.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
// ⚠️ GENERATED FILE - DO NOT EDIT
|
|
2
2
|
// This file is automatically generated by 'prisma-next contract emit'.
|
|
3
3
|
// To regenerate, run: prisma-next contract emit
|
|
4
|
-
import type { CodecTypes as PgTypes } from '@prisma-next/target-postgres/codec-types';
|
|
5
|
-
import type { JsonValue } from '@prisma-next/target-postgres/codec-types';
|
|
6
|
-
import type { Char } from '@prisma-next/target-postgres/codec-types';
|
|
7
|
-
import type { Varchar } from '@prisma-next/target-postgres/codec-types';
|
|
8
|
-
import type { Numeric } from '@prisma-next/target-postgres/codec-types';
|
|
9
|
-
import type { Bit } from '@prisma-next/target-postgres/codec-types';
|
|
10
|
-
import type { VarBit } from '@prisma-next/target-postgres/codec-types';
|
|
11
|
-
import type { Timestamp } from '@prisma-next/target-postgres/codec-types';
|
|
12
|
-
import type { Timestamptz } from '@prisma-next/target-postgres/codec-types';
|
|
13
|
-
import type { Time } from '@prisma-next/target-postgres/codec-types';
|
|
14
|
-
import type { Timetz } from '@prisma-next/target-postgres/codec-types';
|
|
15
|
-
import type { Interval } from '@prisma-next/target-postgres/codec-types';
|
|
16
4
|
import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma-next/adapter-postgres/operation-types';
|
|
5
|
+
import type {
|
|
6
|
+
Bit,
|
|
7
|
+
Char,
|
|
8
|
+
CodecTypes as PgTypes,
|
|
9
|
+
Interval,
|
|
10
|
+
JsonValue,
|
|
11
|
+
Numeric,
|
|
12
|
+
Time,
|
|
13
|
+
Timestamp,
|
|
14
|
+
Timestamptz,
|
|
15
|
+
Timetz,
|
|
16
|
+
VarBit,
|
|
17
|
+
Varchar,
|
|
18
|
+
} from '@prisma-next/target-postgres/codec-types';
|
|
17
19
|
|
|
18
20
|
import type {
|
|
19
21
|
ContractWithTypeMaps,
|
|
@@ -21,16 +23,18 @@ import type {
|
|
|
21
23
|
} from '@prisma-next/sql-contract/types';
|
|
22
24
|
import type {
|
|
23
25
|
Contract as ContractType,
|
|
26
|
+
ContractModelsMap,
|
|
24
27
|
ExecutionHashBase,
|
|
28
|
+
NamespaceId,
|
|
25
29
|
ProfileHashBase,
|
|
26
30
|
StorageHashBase,
|
|
27
31
|
} from '@prisma-next/contract/types';
|
|
28
32
|
|
|
29
33
|
export type StorageHash =
|
|
30
|
-
StorageHashBase<'sha256:
|
|
34
|
+
StorageHashBase<'sha256:e59d6d9829e8c0283838035c851e6ad35862dc3f517a0f046253fba24e9a85ff'>;
|
|
31
35
|
export type ExecutionHash = ExecutionHashBase<string>;
|
|
32
36
|
export type ProfileHash =
|
|
33
|
-
ProfileHashBase<'sha256:
|
|
37
|
+
ProfileHashBase<'sha256:9c8aa3114e84ed3b7ea2bd57526d9c2e1bf7c5292be694e9d3801f566fda7ccb'>;
|
|
34
38
|
|
|
35
39
|
export type CodecTypes = PgTypes;
|
|
36
40
|
export type LaneCodecTypes = CodecTypes;
|
|
@@ -48,32 +52,43 @@ export type TypeMaps = TypeMapsType<
|
|
|
48
52
|
FieldInputTypes
|
|
49
53
|
>;
|
|
50
54
|
|
|
51
|
-
type ContractBase =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
readonly
|
|
55
|
-
readonly
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
type ContractBase = Omit<
|
|
56
|
+
ContractType<
|
|
57
|
+
{
|
|
58
|
+
readonly namespaces: {
|
|
59
|
+
readonly public: {
|
|
60
|
+
readonly id: 'public';
|
|
61
|
+
readonly kind: 'sql-namespace';
|
|
62
|
+
readonly tables: {};
|
|
63
|
+
};
|
|
58
64
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
readonly types: {
|
|
66
|
+
readonly geometry: {
|
|
67
|
+
readonly kind: 'codec-instance';
|
|
68
|
+
readonly codecId: 'pg/geometry@1';
|
|
69
|
+
readonly nativeType: 'geometry';
|
|
70
|
+
readonly typeParams: Record<string, never>;
|
|
71
|
+
};
|
|
66
72
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
readonly storageHash: StorageHash;
|
|
74
|
+
},
|
|
75
|
+
Record<string, never>
|
|
76
|
+
>,
|
|
77
|
+
'roots' | 'domain'
|
|
71
78
|
> & {
|
|
72
79
|
readonly target: 'postgres';
|
|
73
80
|
readonly targetFamily: 'sql';
|
|
74
|
-
readonly roots: Record<string,
|
|
81
|
+
readonly roots: Record<string, never>;
|
|
82
|
+
readonly domain: {
|
|
83
|
+
readonly namespaces: {
|
|
84
|
+
readonly public: {
|
|
85
|
+
readonly models: Record<string, never>;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
75
89
|
readonly capabilities: {
|
|
76
90
|
readonly postgres: {
|
|
91
|
+
readonly distinctOn: true;
|
|
77
92
|
readonly jsonAgg: true;
|
|
78
93
|
readonly lateral: true;
|
|
79
94
|
readonly limit: true;
|
|
@@ -83,6 +98,7 @@ type ContractBase = ContractType<
|
|
|
83
98
|
readonly sql: {
|
|
84
99
|
readonly defaultInInsert: true;
|
|
85
100
|
readonly enums: true;
|
|
101
|
+
readonly lateral: true;
|
|
86
102
|
readonly returning: true;
|
|
87
103
|
};
|
|
88
104
|
};
|
|
@@ -95,4 +111,4 @@ type ContractBase = ContractType<
|
|
|
95
111
|
export type Contract = ContractWithTypeMaps<ContractBase, TypeMaps>;
|
|
96
112
|
|
|
97
113
|
export type Namespaces = Contract['storage']['namespaces'];
|
|
98
|
-
export type Models = Contract
|
|
114
|
+
export type Models = ContractModelsMap<Contract>;
|
package/src/contract.json
CHANGED
|
@@ -2,18 +2,24 @@
|
|
|
2
2
|
"schemaVersion": "1",
|
|
3
3
|
"targetFamily": "sql",
|
|
4
4
|
"target": "postgres",
|
|
5
|
-
"profileHash": "sha256:
|
|
5
|
+
"profileHash": "sha256:9c8aa3114e84ed3b7ea2bd57526d9c2e1bf7c5292be694e9d3801f566fda7ccb",
|
|
6
6
|
"roots": {},
|
|
7
|
-
"
|
|
7
|
+
"domain": {
|
|
8
|
+
"namespaces": {
|
|
9
|
+
"public": {
|
|
10
|
+
"models": {}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
},
|
|
8
14
|
"storage": {
|
|
9
15
|
"namespaces": {
|
|
10
|
-
"
|
|
11
|
-
"id": "
|
|
12
|
-
"kind": "postgres-
|
|
16
|
+
"public": {
|
|
17
|
+
"id": "public",
|
|
18
|
+
"kind": "postgres-schema",
|
|
13
19
|
"tables": {}
|
|
14
20
|
}
|
|
15
21
|
},
|
|
16
|
-
"storageHash": "sha256:
|
|
22
|
+
"storageHash": "sha256:e59d6d9829e8c0283838035c851e6ad35862dc3f517a0f046253fba24e9a85ff",
|
|
17
23
|
"types": {
|
|
18
24
|
"geometry": {
|
|
19
25
|
"codecId": "pg/geometry@1",
|
|
@@ -25,6 +31,7 @@
|
|
|
25
31
|
},
|
|
26
32
|
"capabilities": {
|
|
27
33
|
"postgres": {
|
|
34
|
+
"distinctOn": true,
|
|
28
35
|
"jsonAgg": true,
|
|
29
36
|
"lateral": true,
|
|
30
37
|
"limit": true,
|
|
@@ -34,6 +41,7 @@
|
|
|
34
41
|
"sql": {
|
|
35
42
|
"defaultInInsert": true,
|
|
36
43
|
"enums": true,
|
|
44
|
+
"lateral": true,
|
|
37
45
|
"returning": true
|
|
38
46
|
}
|
|
39
47
|
},
|