@ignfab/geocontext 0.9.3 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -28
- package/dist/gpf/adminexpress.js +7 -27
- package/dist/gpf/adminexpress.js.map +1 -1
- package/dist/gpf/parcellaire-express.js +13 -33
- package/dist/gpf/parcellaire-express.js.map +1 -1
- package/dist/gpf/urbanisme.d.ts +4 -2
- package/dist/gpf/urbanisme.js +20 -61
- package/dist/gpf/urbanisme.js.map +1 -1
- package/dist/gpf/wfs.d.ts +2 -2
- package/dist/gpf/wfs.js +17 -71
- package/dist/gpf/wfs.js.map +1 -1
- package/dist/helpers/distance.d.ts +4 -2
- package/dist/helpers/distance.js +20 -5
- package/dist/helpers/distance.js.map +1 -1
- package/dist/helpers/http.d.ts +4 -0
- package/dist/helpers/http.js +103 -1
- package/dist/helpers/http.js.map +1 -1
- package/dist/helpers/jsonSchema.d.ts +3 -0
- package/dist/helpers/jsonSchema.js +8 -0
- package/dist/helpers/jsonSchema.js.map +1 -0
- package/dist/helpers/schemas.d.ts +13 -0
- package/dist/helpers/schemas.js +18 -0
- package/dist/helpers/schemas.js.map +1 -0
- package/dist/helpers/wfs.d.ts +27 -0
- package/dist/helpers/wfs.js +55 -0
- package/dist/helpers/wfs.js.map +1 -0
- package/dist/helpers/wfs_internal/compile.d.ts +46 -0
- package/dist/helpers/wfs_internal/compile.js +595 -0
- package/dist/helpers/wfs_internal/compile.js.map +1 -0
- package/dist/helpers/wfs_internal/request.d.ts +38 -0
- package/dist/helpers/wfs_internal/request.js +92 -0
- package/dist/helpers/wfs_internal/request.js.map +1 -0
- package/dist/helpers/wfs_internal/response.d.ts +21 -0
- package/dist/helpers/wfs_internal/response.js +29 -0
- package/dist/helpers/wfs_internal/response.js.map +1 -0
- package/dist/helpers/wfs_internal/schema.d.ts +167 -0
- package/dist/helpers/wfs_internal/schema.js +81 -0
- package/dist/helpers/wfs_internal/schema.js.map +1 -0
- package/dist/index.js +47 -25
- package/dist/index.js.map +1 -1
- package/dist/tools/AdminexpressTool.d.ts +52 -2
- package/dist/tools/AdminexpressTool.js +11 -14
- package/dist/tools/AdminexpressTool.js.map +1 -1
- package/dist/tools/AltitudeTool.d.ts +2 -2
- package/dist/tools/AltitudeTool.js +4 -13
- package/dist/tools/AltitudeTool.js.map +1 -1
- package/dist/tools/AssietteSupTool.d.ts +55 -3
- package/dist/tools/AssietteSupTool.js +12 -15
- package/dist/tools/AssietteSupTool.js.map +1 -1
- package/dist/tools/CadastreTool.d.ts +52 -2
- package/dist/tools/CadastreTool.js +13 -15
- package/dist/tools/CadastreTool.js.map +1 -1
- package/dist/tools/GeocodeTool.d.ts +2 -2
- package/dist/tools/GeocodeTool.js +6 -4
- package/dist/tools/GeocodeTool.js.map +1 -1
- package/dist/tools/GpfWfsDescribeTypeTool.d.ts +16 -16
- package/dist/tools/GpfWfsDescribeTypeTool.js +4 -3
- package/dist/tools/GpfWfsDescribeTypeTool.js.map +1 -1
- package/dist/tools/GpfWfsGetFeaturesTool.d.ts +170 -44
- package/dist/tools/GpfWfsGetFeaturesTool.js +161 -114
- package/dist/tools/GpfWfsGetFeaturesTool.js.map +1 -1
- package/dist/tools/GpfWfsSearchTypesTool.d.ts +8 -2
- package/dist/tools/GpfWfsSearchTypesTool.js +12 -9
- package/dist/tools/GpfWfsSearchTypesTool.js.map +1 -1
- package/dist/tools/UrbanismeTool.d.ts +53 -3
- package/dist/tools/UrbanismeTool.js +9 -15
- package/dist/tools/UrbanismeTool.js.map +1 -1
- package/package.json +8 -7
- package/dist/resources/WfsCqlFilterResource.d.ts +0 -10
- package/dist/resources/WfsCqlFilterResource.js +0 -23
- package/dist/resources/WfsCqlFilterResource.js.map +0 -1
- package/dist/resources/content/wfs-cql-filter.md +0 -215
- package/dist/tools/GpfWfsListTypesTool.d.ts +0 -22
- package/dist/tools/GpfWfsListTypesTool.js +0 -26
- package/dist/tools/GpfWfsListTypesTool.js.map +0 -1
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
// --- Imports ---
|
|
2
|
+
// --- Constants ---
|
|
3
|
+
const SCALAR_COMPARISON_OPERATORS = {
|
|
4
|
+
eq: "=",
|
|
5
|
+
ne: "<>",
|
|
6
|
+
};
|
|
7
|
+
const NUMERIC_COMPARISON_OPERATORS = {
|
|
8
|
+
lt: "<",
|
|
9
|
+
lte: "<=",
|
|
10
|
+
gt: ">",
|
|
11
|
+
gte: ">=",
|
|
12
|
+
};
|
|
13
|
+
const ORDER_DIRECTION_TO_WFS = {
|
|
14
|
+
asc: "A",
|
|
15
|
+
desc: "D",
|
|
16
|
+
};
|
|
17
|
+
const BBOX_PARAM_NAMES = ["bbox_west", "bbox_south", "bbox_east", "bbox_north"];
|
|
18
|
+
const INTERSECTS_POINT_PARAM_NAMES = ["intersects_lon", "intersects_lat"];
|
|
19
|
+
const DWITHIN_PARAM_NAMES = ["dwithin_lon", "dwithin_lat", "dwithin_distance_m"];
|
|
20
|
+
const INTERSECTS_FEATURE_PARAM_NAMES = ["intersects_feature_typename", "intersects_feature_id"];
|
|
21
|
+
// --- Property Helpers ---
|
|
22
|
+
/**
|
|
23
|
+
* Lists available property names for a feature type, mainly for error reporting.
|
|
24
|
+
*
|
|
25
|
+
* @param featureType Feature type definition loaded from the embedded catalog.
|
|
26
|
+
* @returns A comma-separated list of property names.
|
|
27
|
+
*/
|
|
28
|
+
function getPropertyList(featureType) {
|
|
29
|
+
return featureType.properties.map((property) => property.name).join(", ");
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Escapes a string literal so it can be embedded safely in a CQL string value.
|
|
33
|
+
*
|
|
34
|
+
* @param value Raw string value.
|
|
35
|
+
* @returns The escaped string value.
|
|
36
|
+
*/
|
|
37
|
+
function escapeStringLiteral(value) {
|
|
38
|
+
return value.replace(/'/g, "''");
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Formats a scalar value as a CQL literal.
|
|
42
|
+
*
|
|
43
|
+
* @param value Scalar value already normalized for its target property.
|
|
44
|
+
* @returns A CQL-ready literal representation.
|
|
45
|
+
*/
|
|
46
|
+
function formatScalarValue(value) {
|
|
47
|
+
if (typeof value === "string") {
|
|
48
|
+
return `'${escapeStringLiteral(value)}'`;
|
|
49
|
+
}
|
|
50
|
+
if (typeof value === "boolean") {
|
|
51
|
+
return value ? "TRUE" : "FALSE";
|
|
52
|
+
}
|
|
53
|
+
return String(value);
|
|
54
|
+
}
|
|
55
|
+
//TODO : this is not really robust
|
|
56
|
+
/**
|
|
57
|
+
* Checks whether a property should be treated as boolean for value coercion.
|
|
58
|
+
*
|
|
59
|
+
* @param property Property metadata from the embedded catalog.
|
|
60
|
+
* @returns `true` when the property type is recognized as boolean-like.
|
|
61
|
+
*/
|
|
62
|
+
function isBooleanProperty(property) {
|
|
63
|
+
return ["boolean", "bool"].includes(property.type.toLowerCase());
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Checks whether a property should be treated as an integer for value coercion.
|
|
67
|
+
*
|
|
68
|
+
* @param property Property metadata from the embedded catalog.
|
|
69
|
+
* @returns `true` when the property type is recognized as integer-like.
|
|
70
|
+
*/
|
|
71
|
+
function isIntegerProperty(property) {
|
|
72
|
+
return ["integer", "long", "short"].includes(property.type.toLowerCase());
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Checks whether a property should be treated as numeric for value coercion.
|
|
76
|
+
*
|
|
77
|
+
* @param property Property metadata from the embedded catalog.
|
|
78
|
+
* @returns `true` when the property type is recognized as numeric-like.
|
|
79
|
+
*/
|
|
80
|
+
function isNumericProperty(property) {
|
|
81
|
+
return ["integer", "number", "float", "double", "decimal", "long", "short", "numeric"].includes(property.type.toLowerCase());
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Checks whether a property should be treated as a date for value coercion.
|
|
85
|
+
*
|
|
86
|
+
* @param property Property metadata from the embedded catalog.
|
|
87
|
+
* @returns `true` when the property type or name suggests a date-like value.
|
|
88
|
+
*/
|
|
89
|
+
function isDateProperty(property) {
|
|
90
|
+
const type = property.type.toLowerCase();
|
|
91
|
+
return ["date", "datetime", "timestamp", "timestamptz"].includes(type) || property.name.startsWith("date_");
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Parses a serialized numeric value and rejects non-finite numbers.
|
|
95
|
+
*
|
|
96
|
+
* @param value Serialized numeric value.
|
|
97
|
+
* @param message Error message to throw when parsing fails.
|
|
98
|
+
* @returns The parsed numeric value.
|
|
99
|
+
*/
|
|
100
|
+
function parseNumericString(value, message) {
|
|
101
|
+
const parsed = Number(value);
|
|
102
|
+
if (!Number.isFinite(parsed)) {
|
|
103
|
+
throw new Error(message);
|
|
104
|
+
}
|
|
105
|
+
return parsed;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Parses a serialized integer value and rejects non-integer numbers.
|
|
109
|
+
*
|
|
110
|
+
* @param value Serialized integer value.
|
|
111
|
+
* @param message Error message to throw when parsing fails.
|
|
112
|
+
* @returns The parsed integer value.
|
|
113
|
+
*/
|
|
114
|
+
function parseIntegerString(value, message) {
|
|
115
|
+
const parsed = Number(value);
|
|
116
|
+
if (!Number.isInteger(parsed)) {
|
|
117
|
+
throw new Error(message);
|
|
118
|
+
}
|
|
119
|
+
return parsed;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Validates a serialized date value using JavaScript date parsing.
|
|
123
|
+
*
|
|
124
|
+
* @param value Serialized date value.
|
|
125
|
+
* @param message Error message to throw when parsing fails.
|
|
126
|
+
* @returns The original value once validated.
|
|
127
|
+
*/
|
|
128
|
+
function parseDateString(value, message) {
|
|
129
|
+
if (!Number.isFinite(Date.parse(value))) {
|
|
130
|
+
throw new Error(message);
|
|
131
|
+
}
|
|
132
|
+
return value;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Parses a serialized boolean value accepted by the tool contract.
|
|
136
|
+
*
|
|
137
|
+
* @param value Serialized boolean value.
|
|
138
|
+
* @param message Error message to throw when parsing fails.
|
|
139
|
+
* @returns The parsed boolean value.
|
|
140
|
+
*/
|
|
141
|
+
function parseBooleanString(value, message) {
|
|
142
|
+
if (value === "true") {
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
if (value === "false") {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
throw new Error(message);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Returns every geometry-like property exposed by a feature type.
|
|
152
|
+
*
|
|
153
|
+
* @param featureType Feature type definition loaded from the embedded catalog.
|
|
154
|
+
* @returns The list of properties carrying a `defaultCrs`.
|
|
155
|
+
*/
|
|
156
|
+
function getGeometryProperties(featureType) {
|
|
157
|
+
return featureType.properties.filter((property) => property.defaultCrs);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Resolves the single geometry property expected by the query compiler.
|
|
161
|
+
*
|
|
162
|
+
* @param featureType Feature type definition loaded from the embedded catalog.
|
|
163
|
+
* @returns The unique geometry property for the feature type.
|
|
164
|
+
*/
|
|
165
|
+
export function getGeometryProperty(featureType) {
|
|
166
|
+
const geometryProperties = getGeometryProperties(featureType);
|
|
167
|
+
if (geometryProperties.length === 0) {
|
|
168
|
+
throw new Error(`Le type '${featureType.id}' n'expose aucune propriété géométrique exploitable dans le catalogue embarqué.`);
|
|
169
|
+
}
|
|
170
|
+
if (geometryProperties.length > 1) {
|
|
171
|
+
throw new Error(`Le type '${featureType.id}' expose plusieurs propriétés géométriques dans le catalogue embarqué : ${geometryProperties.map((property) => property.name).join(", ")}.`);
|
|
172
|
+
}
|
|
173
|
+
return geometryProperties[0];
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Loads a property by exact name and throws a descriptive error when it does not exist.
|
|
177
|
+
*
|
|
178
|
+
* @param featureType Feature type definition loaded from the embedded catalog.
|
|
179
|
+
* @param propertyName Exact property name requested by the caller.
|
|
180
|
+
* @returns The matching property metadata.
|
|
181
|
+
*/
|
|
182
|
+
function getPropertyOrThrow(featureType, propertyName) {
|
|
183
|
+
const property = featureType.properties.find((candidate) => candidate.name === propertyName);
|
|
184
|
+
if (!property) {
|
|
185
|
+
throw new Error(`La propriété '${propertyName}' n'existe pas pour '${featureType.id}'. Utiliser une propriété parmi : ${getPropertyList(featureType)}.`);
|
|
186
|
+
}
|
|
187
|
+
return property;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Ensures that a property exists and is not the geometry column of the feature type.
|
|
191
|
+
*
|
|
192
|
+
* @param featureType Feature type definition loaded from the embedded catalog.
|
|
193
|
+
* @param geometryProperty Geometry property already resolved for the feature type.
|
|
194
|
+
* @param propertyName Exact property name requested by the caller.
|
|
195
|
+
* @param message Error message template used when the property is geometric.
|
|
196
|
+
* @returns The matching non-geometric property metadata.
|
|
197
|
+
*/
|
|
198
|
+
function ensureNonGeometryProperty(featureType, geometryProperty, propertyName, message) {
|
|
199
|
+
const property = getPropertyOrThrow(featureType, propertyName);
|
|
200
|
+
if (property.name === geometryProperty.name || property.defaultCrs) {
|
|
201
|
+
throw new Error(message.replace("{property}", property.name));
|
|
202
|
+
}
|
|
203
|
+
return property;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Extracts the single serialized value required by operators such as `eq` or `gt`.
|
|
207
|
+
*
|
|
208
|
+
* @param filter Raw where clause.
|
|
209
|
+
* @param message Error message to throw when the clause shape is invalid.
|
|
210
|
+
* @returns The serialized scalar value carried by the clause.
|
|
211
|
+
*/
|
|
212
|
+
function getSingleStringValue(filter, message) {
|
|
213
|
+
if (typeof filter.value !== "string" || filter.values !== undefined) {
|
|
214
|
+
throw new Error(message);
|
|
215
|
+
}
|
|
216
|
+
return filter.value;
|
|
217
|
+
}
|
|
218
|
+
// --- Value Coercion ---
|
|
219
|
+
/**
|
|
220
|
+
* Ensures that ordered comparison operators only target numeric-like or date-like properties.
|
|
221
|
+
*
|
|
222
|
+
* @param property Property metadata from the embedded catalog.
|
|
223
|
+
* @param operator Ordered comparison operator being compiled.
|
|
224
|
+
* @returns Nothing. Throws when the property type is incompatible with ordered comparisons.
|
|
225
|
+
*/
|
|
226
|
+
function ensureNumericProperty(property, operator) {
|
|
227
|
+
if (!isNumericProperty(property) && !isDateProperty(property)) {
|
|
228
|
+
throw new Error(`L'opérateur '${operator}' n'est supporté que pour une propriété numérique ou de date. '${property.name}' est de type '${property.type}'.`);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Coerces a serialized scalar value according to the target property metadata.
|
|
233
|
+
*
|
|
234
|
+
* @param property Property metadata from the embedded catalog.
|
|
235
|
+
* @param value Serialized scalar value received from the tool input.
|
|
236
|
+
* @returns A normalized scalar value ready for CQL formatting.
|
|
237
|
+
*/
|
|
238
|
+
function coerceScalarValueForProperty(property, value) {
|
|
239
|
+
if (isIntegerProperty(property)) {
|
|
240
|
+
return parseIntegerString(value, `La propriété '${property.name}' exige une valeur entière sérialisée en texte.`);
|
|
241
|
+
}
|
|
242
|
+
if (isNumericProperty(property)) {
|
|
243
|
+
return parseNumericString(value, `La propriété '${property.name}' exige une valeur numérique sérialisée en texte.`);
|
|
244
|
+
}
|
|
245
|
+
if (isBooleanProperty(property)) {
|
|
246
|
+
return parseBooleanString(value, `La propriété '${property.name}' exige une valeur booléenne sérialisée en texte ('true' ou 'false').`);
|
|
247
|
+
}
|
|
248
|
+
if (isDateProperty(property)) {
|
|
249
|
+
return parseDateString(value, `La propriété '${property.name}' exige une date sérialisée en texte valide.`);
|
|
250
|
+
}
|
|
251
|
+
if (Array.isArray(property.enum) && property.enum.length > 0 && !property.enum.includes(value)) {
|
|
252
|
+
throw new Error(`La propriété '${property.name}' exige une valeur parmi : ${property.enum.join(", ")}.`);
|
|
253
|
+
}
|
|
254
|
+
return value;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Coerces a serialized value used by ordered comparison operators.
|
|
258
|
+
*
|
|
259
|
+
* @param property Property metadata from the embedded catalog.
|
|
260
|
+
* @param value Serialized scalar value received from the tool input.
|
|
261
|
+
* @param operator Ordered comparison operator being compiled.
|
|
262
|
+
* @returns A normalized date or numeric value ready for CQL formatting.
|
|
263
|
+
*/
|
|
264
|
+
function coerceOrderedValueForProperty(property, value, operator) {
|
|
265
|
+
ensureNumericProperty(property, operator);
|
|
266
|
+
if (isDateProperty(property)) {
|
|
267
|
+
return parseDateString(value, `L'opérateur '${operator}' exige une propriété \`value\` date valide.`);
|
|
268
|
+
}
|
|
269
|
+
if (isIntegerProperty(property)) {
|
|
270
|
+
return parseIntegerString(value, `L'opérateur '${operator}' exige une propriété \`value\` entière.`);
|
|
271
|
+
}
|
|
272
|
+
return parseNumericString(value, `L'opérateur '${operator}' exige une propriété \`value\` numérique.`);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Validates and normalizes a raw where clause into a shape that is easier to compile.
|
|
276
|
+
*
|
|
277
|
+
* @param property Property metadata targeted by the clause.
|
|
278
|
+
* @param clause Raw where clause received from the tool input.
|
|
279
|
+
* @returns A normalized where clause with coerced values.
|
|
280
|
+
*/
|
|
281
|
+
function normalizeWhereClause(property, clause) {
|
|
282
|
+
switch (clause.operator) {
|
|
283
|
+
case "eq":
|
|
284
|
+
case "ne":
|
|
285
|
+
return {
|
|
286
|
+
property: clause.property,
|
|
287
|
+
operator: clause.operator,
|
|
288
|
+
value: coerceScalarValueForProperty(property, getSingleStringValue(clause, `L'opérateur '${clause.operator}' exige exactement une propriété \`value\`.`)),
|
|
289
|
+
};
|
|
290
|
+
case "lt":
|
|
291
|
+
case "lte":
|
|
292
|
+
case "gt":
|
|
293
|
+
case "gte":
|
|
294
|
+
return {
|
|
295
|
+
property: clause.property,
|
|
296
|
+
operator: clause.operator,
|
|
297
|
+
value: coerceOrderedValueForProperty(property, getSingleStringValue(clause, `L'opérateur '${clause.operator}' exige exactement une propriété \`value\`.`), clause.operator),
|
|
298
|
+
};
|
|
299
|
+
case "in":
|
|
300
|
+
if (clause.value !== undefined || !Array.isArray(clause.values) || clause.values.length === 0 || !clause.values.every((value) => typeof value === "string")) {
|
|
301
|
+
throw new Error("L'opérateur 'in' exige une propriété `values` non vide.");
|
|
302
|
+
}
|
|
303
|
+
return {
|
|
304
|
+
property: clause.property,
|
|
305
|
+
operator: "in",
|
|
306
|
+
values: clause.values.map((value) => coerceScalarValueForProperty(property, value)),
|
|
307
|
+
};
|
|
308
|
+
case "is_null":
|
|
309
|
+
if (clause.value !== undefined || clause.values !== undefined) {
|
|
310
|
+
throw new Error("L'opérateur 'is_null' n'accepte ni `value` ni `values`.");
|
|
311
|
+
}
|
|
312
|
+
return {
|
|
313
|
+
property: clause.property,
|
|
314
|
+
operator: "is_null",
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
// --- Attribute Compilation ---
|
|
319
|
+
/**
|
|
320
|
+
* Compiles a structured where clause into a CQL fragment.
|
|
321
|
+
*
|
|
322
|
+
* @param featureType Feature type definition loaded from the embedded catalog.
|
|
323
|
+
* @param geometryProperty Geometry property already resolved for the feature type.
|
|
324
|
+
* @param clause Raw where clause received from the tool input.
|
|
325
|
+
* @returns A CQL predicate fragment.
|
|
326
|
+
*/
|
|
327
|
+
function compileWhereClause(featureType, geometryProperty, clause) {
|
|
328
|
+
const property = ensureNonGeometryProperty(featureType, geometryProperty, clause.property, "La propriété '{property}' est géométrique. Utiliser `spatial_operator` et ses paramètres dédiés.");
|
|
329
|
+
const normalized = normalizeWhereClause(property, clause);
|
|
330
|
+
switch (normalized.operator) {
|
|
331
|
+
case "eq":
|
|
332
|
+
case "ne":
|
|
333
|
+
return `${property.name} ${SCALAR_COMPARISON_OPERATORS[normalized.operator]} ${formatScalarValue(normalized.value)}`;
|
|
334
|
+
case "lt":
|
|
335
|
+
case "lte":
|
|
336
|
+
case "gt":
|
|
337
|
+
case "gte":
|
|
338
|
+
return `${property.name} ${NUMERIC_COMPARISON_OPERATORS[normalized.operator]} ${formatScalarValue(normalized.value)}`;
|
|
339
|
+
case "in":
|
|
340
|
+
return `${property.name} IN (${normalized.values.map(formatScalarValue).join(", ")})`;
|
|
341
|
+
case "is_null":
|
|
342
|
+
return `${property.name} IS NULL`;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Compiles a structured sort clause into a WFS `sortBy` fragment.
|
|
347
|
+
*
|
|
348
|
+
* @param featureType Feature type definition loaded from the embedded catalog.
|
|
349
|
+
* @param geometryProperty Geometry property already resolved for the feature type.
|
|
350
|
+
* @param clause Raw order-by clause received from the tool input.
|
|
351
|
+
* @returns A WFS `sortBy` fragment.
|
|
352
|
+
*/
|
|
353
|
+
function compileOrderByClause(featureType, geometryProperty, clause) {
|
|
354
|
+
const property = ensureNonGeometryProperty(featureType, geometryProperty, clause.property, "La propriété '{property}' est géométrique. Utiliser une propriété non géométrique pour `order_by`.");
|
|
355
|
+
return `${property.name} ${ORDER_DIRECTION_TO_WFS[clause.direction]}`;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Validates a selected property name and returns the exact property name to expose.
|
|
359
|
+
*
|
|
360
|
+
* @param featureType Feature type definition loaded from the embedded catalog.
|
|
361
|
+
* @param geometryProperty Geometry property already resolved for the feature type.
|
|
362
|
+
* @param propertyName Raw selected property name.
|
|
363
|
+
* @returns The validated non-geometric property name.
|
|
364
|
+
*/
|
|
365
|
+
function compileSelectProperty(featureType, geometryProperty, propertyName) {
|
|
366
|
+
return ensureNonGeometryProperty(featureType, geometryProperty, propertyName, "La propriété '{property}' est géométrique. `select` accepte uniquement des propriétés non géométriques.").name;
|
|
367
|
+
}
|
|
368
|
+
// --- Spatial Compilation ---
|
|
369
|
+
/**
|
|
370
|
+
* Compiles a bbox spatial filter into a CQL predicate.
|
|
371
|
+
*
|
|
372
|
+
* @param geometryProperty Geometry property already resolved for the feature type.
|
|
373
|
+
* @param spatialFilter Normalized bbox filter.
|
|
374
|
+
* @returns A CQL bbox predicate.
|
|
375
|
+
*/
|
|
376
|
+
function compileBboxSpatialFilter(geometryProperty, spatialFilter) {
|
|
377
|
+
if (spatialFilter.west >= spatialFilter.east) {
|
|
378
|
+
throw new Error("Le bbox est invalide : `bbox_west` doit être strictement inférieur à `bbox_east`.");
|
|
379
|
+
}
|
|
380
|
+
if (spatialFilter.south >= spatialFilter.north) {
|
|
381
|
+
throw new Error("Le bbox est invalide : `bbox_south` doit être strictement inférieur à `bbox_north`.");
|
|
382
|
+
}
|
|
383
|
+
return `BBOX(${geometryProperty.name},${spatialFilter.west},${spatialFilter.south},${spatialFilter.east},${spatialFilter.north},'EPSG:4326')`;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Compiles an intersects-point spatial filter into a CQL predicate.
|
|
387
|
+
*
|
|
388
|
+
* @param geometryProperty Geometry property already resolved for the feature type.
|
|
389
|
+
* @param spatialFilter Normalized point intersection filter.
|
|
390
|
+
* @returns A CQL intersects predicate.
|
|
391
|
+
*/
|
|
392
|
+
function compileIntersectsPointSpatialFilter(geometryProperty, spatialFilter) {
|
|
393
|
+
return `INTERSECTS(${geometryProperty.name},SRID=4326;POINT(${spatialFilter.lon} ${spatialFilter.lat}))`;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Compiles a distance-based spatial filter into a CQL predicate.
|
|
397
|
+
*
|
|
398
|
+
* @param geometryProperty Geometry property already resolved for the feature type.
|
|
399
|
+
* @param spatialFilter Normalized distance filter.
|
|
400
|
+
* @returns A CQL dwithin predicate.
|
|
401
|
+
*/
|
|
402
|
+
function compileDwithinSpatialFilter(geometryProperty, spatialFilter) {
|
|
403
|
+
return `DWITHIN(${geometryProperty.name},SRID=4326;POINT(${spatialFilter.lon} ${spatialFilter.lat}),${spatialFilter.distance_m},meters)`;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Compiles an `intersects_feature` spatial filter once the reference geometry is already serialized.
|
|
407
|
+
*
|
|
408
|
+
* @param geometryProperty Geometry property already resolved for the feature type.
|
|
409
|
+
* @param geometryEwkt Reference geometry serialized as EWKT.
|
|
410
|
+
* @returns A CQL intersects predicate.
|
|
411
|
+
*/
|
|
412
|
+
function compileIntersectsFeatureSpatialFilter(geometryProperty, geometryEwkt) {
|
|
413
|
+
return `INTERSECTS(${geometryProperty.name},${geometryEwkt})`;
|
|
414
|
+
}
|
|
415
|
+
// --- Geometry Serialization ---
|
|
416
|
+
/**
|
|
417
|
+
* Serializes a GeoJSON-like geometry object into EWKT for CQL spatial predicates.
|
|
418
|
+
*
|
|
419
|
+
* @param geometry Geometry object exposing a GeoJSON `type` and `coordinates`.
|
|
420
|
+
* @returns The EWKT representation of the geometry.
|
|
421
|
+
*/
|
|
422
|
+
export function geometryToEwkt(geometry) {
|
|
423
|
+
switch (geometry.type) {
|
|
424
|
+
case "Point":
|
|
425
|
+
return `SRID=4326;POINT(${positionToWkt(geometry.coordinates)})`;
|
|
426
|
+
case "MultiPoint":
|
|
427
|
+
return `SRID=4326;MULTIPOINT(${geometry.coordinates
|
|
428
|
+
.map((position) => `(${positionToWkt(position)})`)
|
|
429
|
+
.join(",")})`;
|
|
430
|
+
case "LineString":
|
|
431
|
+
return `SRID=4326;LINESTRING(${geometry.coordinates.map(positionToWkt).join(",")})`;
|
|
432
|
+
case "MultiLineString":
|
|
433
|
+
return `SRID=4326;MULTILINESTRING(${geometry.coordinates.map((line) => `(${line.map(positionToWkt).join(",")})`).join(",")})`;
|
|
434
|
+
case "Polygon":
|
|
435
|
+
return `SRID=4326;POLYGON(${geometry.coordinates.map((ring) => `(${ring.map(positionToWkt).join(",")})`).join(",")})`;
|
|
436
|
+
case "MultiPolygon":
|
|
437
|
+
return `SRID=4326;MULTIPOLYGON(${geometry.coordinates.map((polygon) => `(${polygon.map((ring) => `(${ring.map(positionToWkt).join(",")})`).join(",")})`).join(",")})`;
|
|
438
|
+
default:
|
|
439
|
+
throw new Error(`Le type de géométrie '${geometry.type}' n'est pas supporté pour \`intersects_feature\`.`);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Serializes a single coordinate pair into a WKT position.
|
|
444
|
+
*
|
|
445
|
+
* @param position Coordinate pair expressed as `[lon, lat]`.
|
|
446
|
+
* @returns A WKT position string.
|
|
447
|
+
*/
|
|
448
|
+
function positionToWkt(position) {
|
|
449
|
+
return `${position[0]} ${position[1]}`;
|
|
450
|
+
}
|
|
451
|
+
// --- Spatial Input Normalization ---
|
|
452
|
+
/**
|
|
453
|
+
* Checks whether any property in a named group is defined on the raw input object.
|
|
454
|
+
*
|
|
455
|
+
* @param input Normalized tool input.
|
|
456
|
+
* @param keys Input keys to inspect.
|
|
457
|
+
* @returns `true` when at least one key from the group is present.
|
|
458
|
+
*/
|
|
459
|
+
function hasAny(input, keys) {
|
|
460
|
+
return keys.some((name) => input[name] !== undefined);
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Normalizes the raw spatial input into a discriminated spatial filter object.
|
|
464
|
+
*
|
|
465
|
+
* @param input Normalized tool input.
|
|
466
|
+
* @returns A normalized spatial filter, or `undefined` when no spatial filter is requested.
|
|
467
|
+
*/
|
|
468
|
+
export function getSpatialFilter(input) {
|
|
469
|
+
const hasBboxParams = hasAny(input, BBOX_PARAM_NAMES);
|
|
470
|
+
const hasIntersectsPointParams = hasAny(input, INTERSECTS_POINT_PARAM_NAMES);
|
|
471
|
+
const hasDwithinParams = hasAny(input, DWITHIN_PARAM_NAMES);
|
|
472
|
+
const hasIntersectsFeatureParams = hasAny(input, INTERSECTS_FEATURE_PARAM_NAMES);
|
|
473
|
+
switch (input.spatial_operator) {
|
|
474
|
+
case undefined:
|
|
475
|
+
if (hasBboxParams || hasIntersectsPointParams || hasDwithinParams || hasIntersectsFeatureParams) {
|
|
476
|
+
throw new Error("Les paramètres spatiaux exigent `spatial_operator`.");
|
|
477
|
+
}
|
|
478
|
+
return undefined;
|
|
479
|
+
case "bbox":
|
|
480
|
+
if (hasIntersectsPointParams || hasDwithinParams || hasIntersectsFeatureParams) {
|
|
481
|
+
throw new Error("Le filtre spatial `bbox` n'accepte pas les paramètres d'un autre mode spatial.");
|
|
482
|
+
}
|
|
483
|
+
if (input.bbox_west === undefined || input.bbox_south === undefined || input.bbox_east === undefined || input.bbox_north === undefined) {
|
|
484
|
+
throw new Error("Le filtre spatial `bbox` exige `bbox_west`, `bbox_south`, `bbox_east` et `bbox_north`.");
|
|
485
|
+
}
|
|
486
|
+
return { operator: "bbox", west: input.bbox_west, south: input.bbox_south, east: input.bbox_east, north: input.bbox_north };
|
|
487
|
+
case "intersects_point":
|
|
488
|
+
if (hasBboxParams || hasDwithinParams || hasIntersectsFeatureParams) {
|
|
489
|
+
throw new Error("Le filtre spatial `intersects_point` n'accepte pas les paramètres d'un autre mode spatial.");
|
|
490
|
+
}
|
|
491
|
+
if (input.intersects_lon === undefined || input.intersects_lat === undefined) {
|
|
492
|
+
throw new Error("Le filtre spatial `intersects_point` exige `intersects_lon` et `intersects_lat`.");
|
|
493
|
+
}
|
|
494
|
+
return { operator: "intersects_point", lon: input.intersects_lon, lat: input.intersects_lat };
|
|
495
|
+
case "dwithin_point":
|
|
496
|
+
if (hasBboxParams || hasIntersectsPointParams || hasIntersectsFeatureParams) {
|
|
497
|
+
throw new Error("Le filtre spatial `dwithin_point` n'accepte pas les paramètres d'un autre mode spatial.");
|
|
498
|
+
}
|
|
499
|
+
if (input.dwithin_lon === undefined || input.dwithin_lat === undefined || input.dwithin_distance_m === undefined) {
|
|
500
|
+
throw new Error("Le filtre spatial `dwithin_point` exige `dwithin_lon`, `dwithin_lat` et `dwithin_distance_m`.");
|
|
501
|
+
}
|
|
502
|
+
return { operator: "dwithin_point", lon: input.dwithin_lon, lat: input.dwithin_lat, distance_m: input.dwithin_distance_m };
|
|
503
|
+
case "intersects_feature":
|
|
504
|
+
if (hasBboxParams || hasIntersectsPointParams || hasDwithinParams) {
|
|
505
|
+
throw new Error("Le filtre spatial `intersects_feature` n'accepte pas les paramètres d'un autre mode spatial.");
|
|
506
|
+
}
|
|
507
|
+
if (!input.intersects_feature_typename || !input.intersects_feature_id) {
|
|
508
|
+
throw new Error("Le filtre spatial `intersects_feature` exige `intersects_feature_typename` et `intersects_feature_id`.");
|
|
509
|
+
}
|
|
510
|
+
return { operator: "intersects_feature", typename: input.intersects_feature_typename, feature_id: input.intersects_feature_id };
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Build the list of property names to return in the WFS response according to the `select` and `result_type` input parameters.
|
|
515
|
+
*
|
|
516
|
+
* Note that :
|
|
517
|
+
* - When `select` is omitted and `result_type` is `results`, all non-geometric properties are returned.
|
|
518
|
+
* - When `select` is provided, the specified properties are validated according to the featureType from the Catalog.
|
|
519
|
+
* - When `result_type` is `request` and `select` is provided, the geometry column is automatically appended.
|
|
520
|
+
*
|
|
521
|
+
* @param featureType Feature type definition loaded from the embedded catalog.
|
|
522
|
+
* @param geometryProperty Geometry property already resolved for the feature type.
|
|
523
|
+
* @param input Normalized tool input.
|
|
524
|
+
* @returns The list of non-geometric property names to include in the WFS `propertyName` parameter, or an empty list to include all properties.
|
|
525
|
+
*
|
|
526
|
+
*/
|
|
527
|
+
function buildSelectList(featureType, geometryProperty, input) {
|
|
528
|
+
// if `select` is specified, we only return the requested properties (after validation)
|
|
529
|
+
if (input.select && input.select.length > 0) {
|
|
530
|
+
const selectedProperties = input.select.map((propertyName) => compileSelectProperty(featureType, geometryProperty, propertyName));
|
|
531
|
+
if (input.result_type === "request") {
|
|
532
|
+
return [...selectedProperties, geometryProperty.name];
|
|
533
|
+
}
|
|
534
|
+
return selectedProperties;
|
|
535
|
+
}
|
|
536
|
+
// if `select` is omitted and result_type is `results`,
|
|
537
|
+
// we return every non-geometric property
|
|
538
|
+
if (input.result_type === "results") {
|
|
539
|
+
return featureType.properties
|
|
540
|
+
.filter((property) => !property.defaultCrs)
|
|
541
|
+
.map((property) => property.name);
|
|
542
|
+
}
|
|
543
|
+
// if `select` is omitted and result_type is `hits` or `request`
|
|
544
|
+
// we don't specify any propertyName
|
|
545
|
+
return [];
|
|
546
|
+
}
|
|
547
|
+
// --- Query Compilation ---
|
|
548
|
+
/**
|
|
549
|
+
* Compiles normalized tool input into query fragments ready to be turned into a WFS request.
|
|
550
|
+
*
|
|
551
|
+
* @param input Normalized tool input.
|
|
552
|
+
* @param featureType Feature type definition loaded from the embedded catalog.
|
|
553
|
+
* @param resolvedGeometryRef Optional resolved reference geometry for `intersects_feature`.
|
|
554
|
+
* @returns Compiled query parts used by request builders.
|
|
555
|
+
*/
|
|
556
|
+
export function compileQueryParts(input, featureType, resolvedGeometryRef) {
|
|
557
|
+
const geometryProperty = getGeometryProperty(featureType);
|
|
558
|
+
const spatialFilter = getSpatialFilter(input);
|
|
559
|
+
const fragments = [];
|
|
560
|
+
// Keep the spatial predicate first: the GeoPlateforme GeoServer is sensitive
|
|
561
|
+
// to filter ordering and may reject equivalent filters when attributes come first.
|
|
562
|
+
if (spatialFilter) {
|
|
563
|
+
switch (spatialFilter.operator) {
|
|
564
|
+
case "bbox":
|
|
565
|
+
fragments.push(compileBboxSpatialFilter(geometryProperty, spatialFilter));
|
|
566
|
+
break;
|
|
567
|
+
case "intersects_point":
|
|
568
|
+
fragments.push(compileIntersectsPointSpatialFilter(geometryProperty, spatialFilter));
|
|
569
|
+
break;
|
|
570
|
+
case "dwithin_point":
|
|
571
|
+
fragments.push(compileDwithinSpatialFilter(geometryProperty, spatialFilter));
|
|
572
|
+
break;
|
|
573
|
+
case "intersects_feature":
|
|
574
|
+
if (!resolvedGeometryRef) {
|
|
575
|
+
throw new Error("Le filtre spatial `intersects_feature` exige la résolution préalable de la géométrie de référence.");
|
|
576
|
+
}
|
|
577
|
+
fragments.push(compileIntersectsFeatureSpatialFilter(geometryProperty, resolvedGeometryRef.geometry_ewkt));
|
|
578
|
+
break;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
for (const clause of input.where ?? []) {
|
|
582
|
+
fragments.push(compileWhereClause(featureType, geometryProperty, clause));
|
|
583
|
+
}
|
|
584
|
+
const sortBy = input.order_by && input.order_by.length > 0
|
|
585
|
+
? input.order_by.map((clause) => compileOrderByClause(featureType, geometryProperty, clause)).join(",")
|
|
586
|
+
: undefined;
|
|
587
|
+
const propertyNames = buildSelectList(featureType, geometryProperty, input);
|
|
588
|
+
return {
|
|
589
|
+
geometryProperty,
|
|
590
|
+
cqlFilter: fragments.length > 0 ? fragments.join(" AND ") : undefined,
|
|
591
|
+
propertyName: propertyNames.length > 0 ? propertyNames.join(",") : undefined,
|
|
592
|
+
sortBy,
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
//# sourceMappingURL=compile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../../src/helpers/wfs_internal/compile.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAoBlB,oBAAoB;AAEpB,MAAM,2BAA2B,GAAG;IAClC,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,IAAI;CACA,CAAC;AAEX,MAAM,4BAA4B,GAAG;IACnC,EAAE,EAAE,GAAG;IACP,GAAG,EAAE,IAAI;IACT,EAAE,EAAE,GAAG;IACP,GAAG,EAAE,IAAI;CACD,CAAC;AAEX,MAAM,sBAAsB,GAAG;IAC7B,GAAG,EAAE,GAAG;IACR,IAAI,EAAE,GAAG;CACD,CAAC;AAEX,MAAM,gBAAgB,GAAG,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,CAAU,CAAC;AACzF,MAAM,4BAA4B,GAAG,CAAC,gBAAgB,EAAE,gBAAgB,CAAU,CAAC;AACnF,MAAM,mBAAmB,GAAG,CAAC,aAAa,EAAE,aAAa,EAAE,oBAAoB,CAAU,CAAC;AAC1F,MAAM,8BAA8B,GAAG,CAAC,6BAA6B,EAAE,uBAAuB,CAAU,CAAC;AAezG,2BAA2B;AAE3B;;;;;GAKG;AACH,SAAS,eAAe,CAAC,WAAuB;IAC9C,OAAO,WAAW,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QAC5E,MAAM;KACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { GpfWfsGetFeaturesInput } from "./schema.js";
|
|
2
|
+
export type CompiledRequest = {
|
|
3
|
+
method: "POST";
|
|
4
|
+
url: string;
|
|
5
|
+
query: Record<string, string>;
|
|
6
|
+
body: string;
|
|
7
|
+
get_url?: string | null;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Builds a portable GET URL variant of the request when it stays below the configured limit.
|
|
11
|
+
*
|
|
12
|
+
* @param url Base WFS endpoint URL.
|
|
13
|
+
* @param query Query-string parameters sent with the request.
|
|
14
|
+
* @param cqlFilter Optional CQL filter to append to the GET variant.
|
|
15
|
+
* @returns A derived GET URL, or `null` when it would be too long to expose safely.
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildGetUrl(url: string, query: Record<string, string>, cqlFilter?: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Builds the main WFS GetFeature request from normalized tool input and compiled query parts.
|
|
20
|
+
*
|
|
21
|
+
* @param input Normalized tool input.
|
|
22
|
+
* @param compiled Compiled query fragments produced from the input and feature type.
|
|
23
|
+
* @returns A POST request split into base URL, query-string parameters, encoded body, and optional GET variant.
|
|
24
|
+
*/
|
|
25
|
+
export declare function buildMainRequest(input: GpfWfsGetFeaturesInput, compiled: {
|
|
26
|
+
cqlFilter?: string;
|
|
27
|
+
propertyName?: string;
|
|
28
|
+
sortBy?: string;
|
|
29
|
+
}): CompiledRequest;
|
|
30
|
+
/**
|
|
31
|
+
* Builds the auxiliary request used to fetch the geometry of a reference feature.
|
|
32
|
+
*
|
|
33
|
+
* @param typename Typename of the reference layer.
|
|
34
|
+
* @param featureId Identifier of the reference feature.
|
|
35
|
+
* @param geometryPropertyName Geometry property to request from the reference layer.
|
|
36
|
+
* @returns A POST request targeting the reference feature lookup.
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildReferenceGeometryRequest(typename: string, featureId: string, geometryPropertyName: string): CompiledRequest;
|