@vectoriahq/quac 0.1.0 → 0.3.0-next.1

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.
Files changed (61) hide show
  1. package/README.md +10 -3
  2. package/dist/generate/externalStacCatalogue.d.ts +4 -4
  3. package/dist/generate/externalStacCatalogue.js +9 -11
  4. package/dist/generate/fileLayerCollection.d.ts +2 -1
  5. package/dist/generate/fileLayerCollection.js +4 -2
  6. package/dist/generate/folderStacCatalogue.d.ts +6 -0
  7. package/dist/generate/folderStacCatalogue.js +10 -2
  8. package/dist/generate/normalizedProject.d.ts +5 -4
  9. package/dist/generate/normalizedProject.js +44 -92
  10. package/dist/generate/ogcFeaturesStacCatalogue.js +1 -1
  11. package/dist/generate/stacCatalogue.js +23 -21
  12. package/dist/generate/wmsStacCatalogue.js +5 -16
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.js +1 -1
  15. package/dist/model/QgsProject.d.ts +54 -9
  16. package/dist/model/Stac.d.ts +8 -6
  17. package/dist/model/Stac.js +1 -1
  18. package/dist/model/featureFilter.d.ts +1 -1
  19. package/dist/model/fieldIconAddress.d.ts +1 -1
  20. package/dist/model/fieldIconAddress.js +1 -1
  21. package/dist/model/ogcFeatures.d.ts +3 -3
  22. package/dist/model/ogcFeatures.js +2 -2
  23. package/dist/model/quacExtension.d.ts +1 -1
  24. package/dist/model/quacExtension.js +1 -1
  25. package/dist/model/stacAssetRoles.d.ts +1 -1
  26. package/dist/model/stacAssetRoles.js +1 -1
  27. package/dist/model/stacHref.d.ts +3 -3
  28. package/dist/model/stacHref.js +3 -3
  29. package/dist/model/stacPmtiles.d.ts +1 -1
  30. package/dist/model/stacWms.d.ts +1 -1
  31. package/dist/model/stacWms.js +1 -1
  32. package/dist/model/wfs.d.ts +1 -1
  33. package/dist/parse/geometrySiblings.d.ts +1 -1
  34. package/dist/parse/geometrySiblings.js +1 -1
  35. package/dist/parse/parseBrandColour.d.ts +3 -3
  36. package/dist/parse/parseBrandColour.js +3 -3
  37. package/dist/parse/parseDataDefinedEditable.js +2 -2
  38. package/dist/parse/parseLayers.d.ts +5 -2
  39. package/dist/parse/parseLayers.js +148 -97
  40. package/dist/parse/parseMeasurement.d.ts +2 -3
  41. package/dist/parse/parseMeasurement.js +3 -4
  42. package/dist/parse/parseMergin.d.ts +3 -3
  43. package/dist/parse/parseMergin.js +8 -5
  44. package/dist/parse/parseQgsXml.js +10 -3
  45. package/dist/parse/projectNotes.d.ts +26 -0
  46. package/dist/parse/projectNotes.js +52 -0
  47. package/dist/parse/qgisExpression.d.ts +19 -4
  48. package/dist/parse/qgisExpression.js +58 -13
  49. package/dist/parse/qtDateFormat.d.ts +3 -3
  50. package/dist/parse/qtDateFormat.js +3 -3
  51. package/dist/parse/qtRegex.d.ts +2 -2
  52. package/dist/parse/qtRegex.js +2 -2
  53. package/dist/sources/stacItems.d.ts +1 -1
  54. package/dist/sources/stacItems.js +2 -2
  55. package/dist/util/devLog.d.ts +1 -2
  56. package/dist/util/devLog.js +1 -2
  57. package/dist/util/nonBlankText.d.ts +2 -0
  58. package/dist/util/nonBlankText.js +4 -0
  59. package/dist/util/wfsVersions.js +1 -1
  60. package/package.json +10 -2
  61. package/src/schema/quac.schema.json +5 -1
@@ -0,0 +1,52 @@
1
+ /**
2
+ * The rules that decide whether a setting naming another layer reaches the
3
+ * catalogue, and the notes for those that do not. `generateStacCatalogue`
4
+ * applies the same rules through these functions, so a note and the catalogue
5
+ * cannot disagree.
6
+ */
7
+ /**
8
+ * The layer a Value Relation widget reads its choices from: the layer whose
9
+ * id the widget names, and where none has it the first layer with the name it
10
+ * names, as QGIS finds it (`QgsVectorLayerRef::resolveByIdOrNameOnly`,
11
+ * `src/core/qgsvectorlayerref.cpp`, `qgis/QGIS@master`). Undefined where the
12
+ * project holds neither.
13
+ */
14
+ export function findValueRelationLookup(widget, layers, layersById) {
15
+ return layersById.get(widget.layerId) ?? layers.find((candidate) => candidate.name === widget.layerName);
16
+ }
17
+ /** Whether the project holds both of a relation's layers. */
18
+ export function isRelationInProject(relation, layersById) {
19
+ return layersById.has(relation.parentLayerId) && layersById.has(relation.childLayerId);
20
+ }
21
+ /** Whether the project holds a filter's layer and that layer has its field. */
22
+ export function isFilterInProject(filter, layersById) {
23
+ return layersById.get(filter.layerId)?.fieldNames.includes(filter.field) ?? false;
24
+ }
25
+ /**
26
+ * The notes for the settings that name another layer and do not reach the
27
+ * catalogue: Value Relations, relations and filters, in that order, and each
28
+ * in the project's order. `textFilters` are the Mergin Maps `Text` filters
29
+ * `parseMerginFilters` passes over.
30
+ */
31
+ export function crossLayerNotes(layers, relations, filters, textFilters) {
32
+ const layersById = new Map(layers.map((layer) => [layer.id, layer]));
33
+ const noteFor = (layerId, field, reason, text) => ({ layerId, layerName: layersById.get(layerId)?.name ?? '', field, reason, text });
34
+ const notes = [];
35
+ for (const layer of layers) {
36
+ for (const [field, widget] of Object.entries(layer.fieldValueRelations)) {
37
+ if (!findValueRelationLookup(widget, layers, layersById))
38
+ notes.push(noteFor(layer.id, field, 'value-relation', widget.layerName || widget.layerId));
39
+ }
40
+ }
41
+ for (const relation of relations) {
42
+ if (!isRelationInProject(relation, layersById))
43
+ notes.push(noteFor(relation.childLayerId, null, 'relation', relation.name || relation.id));
44
+ }
45
+ for (const filter of filters) {
46
+ if (!isFilterInProject(filter, layersById))
47
+ notes.push(noteFor(filter.layerId, filter.field, 'filter', null));
48
+ }
49
+ for (const filter of textFilters)
50
+ notes.push(noteFor(filter.layerId, filter.field, 'filter', 'Text'));
51
+ return notes;
52
+ }
@@ -54,7 +54,15 @@ export type ExpressionNode = {
54
54
  }>;
55
55
  otherwise: ExpressionNode | null;
56
56
  };
57
- /** The `aggregate` kinds Groundwork works out (`QgsAggregateCalculator::aggregates`). */
57
+ /**
58
+ * The `fnName` of the GeoStyler `custom` function that stands for a variable,
59
+ * such as `@cloud_useremail`. Its first argument is the variable's name with
60
+ * no `@`; a second, `x`, `y` or `z`, is the coordinate of the point the
61
+ * variable holds, read from `x(@position_coordinate)` and the like. The
62
+ * evaluator is handed the values before it starts.
63
+ */
64
+ export declare const EXPRESSION_VARIABLE = "expression_variable";
65
+ /** The `aggregate` kinds this reader takes, which the caller works out (`QgsAggregateCalculator::aggregates`). */
58
66
  export declare const LOOKUP_AGGREGATES: readonly ["count", "min", "max", "concatenate"];
59
67
  /**
60
68
  * One read of another layer of the project: the features of `layer`, named by
@@ -78,7 +86,7 @@ export interface LayerLookup {
78
86
  */
79
87
  export declare const LAYER_LOOKUP = "layer_lookup";
80
88
  /**
81
- * The values QGIS gives a feature from its geometry that Groundwork reads, and
89
+ * The values QGIS gives a feature from its geometry that this reader takes, and
82
90
  * the unit each is in: an area or a distance. They are written with no
83
91
  * brackets (`$area`).
84
92
  */
@@ -139,17 +147,24 @@ export declare function isQgisConditionFilter(filter: unknown): filter is {
139
147
  * `now()`, or `$now`, is read only as the date of `format_date` or of a
140
148
  * function that takes a part of a date, such as `year`: anywhere else it would
141
149
  * be compared or added as a date, which the evaluator does not do.
150
+ *
151
+ * A variable other than `@parent`, such as `@cloud_useremail`, is read only
152
+ * where the caller says `variables`: the caller then supplies each one's value
153
+ * (`EXPRESSION_VARIABLE`) as a record is created or saved (a default value).
154
+ * `x`, `y` and `z` are read only with a variable as their point, as in
155
+ * `x(@position_coordinate)`. A read of another layer cannot use a variable.
142
156
  */
143
157
  export declare function readQgisExpression(expression: string, options?: {
144
158
  currentValue?: boolean;
145
159
  geometry?: true | MeasureFactors;
146
160
  aggregates?: boolean;
147
161
  lookups?: boolean;
162
+ variables?: boolean;
148
163
  }): ExpressionNode | null;
149
164
  /**
150
165
  * A QGIS rule's condition as a GeoStyler filter: the condition's GeoStyler
151
166
  * function inside a `custom` function named `QGIS_CONDITION`, which
152
- * `geostyler-openlayers-parser` hands to the evaluator Groundwork gives it.
167
+ * `geostyler-openlayers-parser` hands to the evaluator the application gives it.
153
168
  * Null for a condition `readQgisExpression` cannot read. `measure` is the
154
169
  * project's units, which `$area` and `$length` need.
155
170
  */
@@ -172,7 +187,7 @@ export declare function readLayerLookups(node: ExpressionNode): LayerLookup[];
172
187
  * no feature (`expressionFormAttributes`,
173
188
  * `src/core/fieldformatter/qgsvaluerelationfieldformatter.cpp`,
174
189
  * `qgis/QGIS@master`, read 2026-10-24), so an argument that reads a field
175
- * gives a blank name and the filter is not used. Groundwork takes a text
190
+ * gives a blank name and the filter is not used. This reader takes a text
176
191
  * literal as the one constant argument. An empty list is an expression that
177
192
  * reads no form value.
178
193
  */
@@ -62,8 +62,32 @@ const QGIS_ONLY_FUNCTIONS = {
62
62
  overlay_intersects: [1, 5],
63
63
  aggregate: [3, 6],
64
64
  geometry: [1, 1],
65
- intersects: [2, 2]
65
+ intersects: [2, 2],
66
+ x: [1, 1],
67
+ y: [1, 1],
68
+ z: [1, 1]
66
69
  };
70
+ /** The functions that take a coordinate of a point, read only with a variable as their point (`EXPRESSION_VARIABLE`). */
71
+ const POINT_PARTS = ['x', 'y', 'z'];
72
+ /**
73
+ * The `fnName` of the GeoStyler `custom` function that stands for a variable,
74
+ * such as `@cloud_useremail`. Its first argument is the variable's name with
75
+ * no `@`; a second, `x`, `y` or `z`, is the coordinate of the point the
76
+ * variable holds, read from `x(@position_coordinate)` and the like. The
77
+ * evaluator is handed the values before it starts.
78
+ */
79
+ export const EXPRESSION_VARIABLE = 'expression_variable';
80
+ /** The name of the variable a node is, with no `@`, or null for any other node and for `@parent`. */
81
+ function variableName(node) {
82
+ return node?.kind === 'call' && node.name.startsWith('@') && node.name !== '@parent' ? node.name.slice(1) : null;
83
+ }
84
+ function isVariable(node) {
85
+ return variableName(node) !== null;
86
+ }
87
+ /** The variables at or under a node, other than `@parent`. */
88
+ function findVariables(node) {
89
+ return [...(isVariable(node) ? [node] : []), ...childNodes(node).flatMap(findVariables)];
90
+ }
67
91
  /** The functions whose second argument is a regular expression, which QGIS compiles with Unicode properties. */
68
92
  const REGEXP_FUNCTIONS = ['regexp_match', 'regexp_replace', 'regexp_substr'];
69
93
  /**
@@ -88,7 +112,7 @@ const LOOKUPS = ['overlay_within', 'overlay_intersects', 'aggregate'];
88
112
  * through, which stand nowhere else.
89
113
  */
90
114
  const PARENT_GEOMETRY_CALLS = ['intersects', 'geometry', '$geometry', '@parent'];
91
- /** The `aggregate` kinds Groundwork works out (`QgsAggregateCalculator::aggregates`). */
115
+ /** The `aggregate` kinds this reader takes, which the caller works out (`QgsAggregateCalculator::aggregates`). */
92
116
  export const LOOKUP_AGGREGATES = ['count', 'min', 'max', 'concatenate'];
93
117
  /**
94
118
  * The `fnName` of the GeoStyler `custom` function that stands for a
@@ -98,10 +122,10 @@ export const LOOKUP_AGGREGATES = ['count', 'min', 'max', 'concatenate'];
98
122
  export const LAYER_LOOKUP = 'layer_lookup';
99
123
  /** The functions that take a date as their first argument, where `now()` may stand. */
100
124
  const DATE_TAKERS = ['format_date', 'year', 'month', 'day', 'week', 'day_of_week', 'hour', 'minute', 'second'];
101
- /** The aggregates Groundwork reads, which scan the records of a layer. */
125
+ /** The aggregates this reader reads, which scan the records of a layer. */
102
126
  const AGGREGATES = ['maximum', 'minimum'];
103
127
  /**
104
- * The values QGIS gives a feature from its geometry that Groundwork reads, and
128
+ * The values QGIS gives a feature from its geometry that this reader takes, and
105
129
  * the unit each is in: an area or a distance. They are written with no
106
130
  * brackets (`$area`).
107
131
  */
@@ -185,6 +209,12 @@ export function isQgisConditionFilter(filter) {
185
209
  * `now()`, or `$now`, is read only as the date of `format_date` or of a
186
210
  * function that takes a part of a date, such as `year`: anywhere else it would
187
211
  * be compared or added as a date, which the evaluator does not do.
212
+ *
213
+ * A variable other than `@parent`, such as `@cloud_useremail`, is read only
214
+ * where the caller says `variables`: the caller then supplies each one's value
215
+ * (`EXPRESSION_VARIABLE`) as a record is created or saved (a default value).
216
+ * `x`, `y` and `z` are read only with a variable as their point, as in
217
+ * `x(@position_coordinate)`. A read of another layer cannot use a variable.
188
218
  */
189
219
  export function readQgisExpression(expression, options = {}) {
190
220
  const tokens = tokenizeExpression(expression);
@@ -195,6 +225,10 @@ export function readQgisExpression(expression, options = {}) {
195
225
  return null;
196
226
  if (!options.currentValue && findCalls(parsed.node, 'current_value').length > 0)
197
227
  return null;
228
+ if (!options.variables && findVariables(parsed.node).length > 0)
229
+ return null;
230
+ if (!findCalls(parsed.node, ...POINT_PARTS).every((call) => isVariable(call.args[0])))
231
+ return null;
198
232
  const aggregateCalls = findCalls(parsed.node, ...AGGREGATES);
199
233
  if (aggregateCalls.length > 0 && !options.aggregates)
200
234
  return null;
@@ -239,7 +273,7 @@ function findRegexpPredicates(node) {
239
273
  const own = node.kind === 'predicate' && node.op === 'regexp' ? [node] : [];
240
274
  return [...own, ...childNodes(node).flatMap(findRegexpPredicates)];
241
275
  }
242
- /** A `format_date` call whose pattern and language are written-in text, and whose pattern Groundwork formats. */
276
+ /** A `format_date` call whose pattern and language are written-in text, and whose pattern this package formats. */
243
277
  function isReadableFormatDate(call) {
244
278
  const [, pattern, language] = call.args;
245
279
  return pattern?.kind === 'text' && isFormattableQtDatePattern(pattern.value) && (language === undefined || language.kind === 'text');
@@ -247,7 +281,7 @@ function isReadableFormatDate(call) {
247
281
  /**
248
282
  * A QGIS rule's condition as a GeoStyler filter: the condition's GeoStyler
249
283
  * function inside a `custom` function named `QGIS_CONDITION`, which
250
- * `geostyler-openlayers-parser` hands to the evaluator Groundwork gives it.
284
+ * `geostyler-openlayers-parser` hands to the evaluator the application gives it.
251
285
  * Null for a condition `readQgisExpression` cannot read. `measure` is the
252
286
  * project's units, which `$area` and `$length` need.
253
287
  */
@@ -509,9 +543,13 @@ function readTerm(tokens, index) {
509
543
  return { node: { kind: 'call', name: 'now', args: [] }, next: index + 1 };
510
544
  return Object.hasOwn(GEOMETRY_VALUES, word) || word === '$geometry' ? { node: { kind: 'call', name: word, args: [] }, next: index + 1 } : null;
511
545
  }
512
- // A variable: `@parent` alone is read, inside an `aggregate` filter.
546
+ // `@parent` is read inside an `aggregate` filter, and any other variable
547
+ // where the caller says `variables`. A variable keeps its spelling, since
548
+ // QGIS looks one up by its exact name.
549
+ if (word === '@parent')
550
+ return { node: { kind: 'call', name: word, args: [] }, next: index + 1 };
513
551
  if (word.startsWith('@'))
514
- return word === '@parent' ? { node: { kind: 'call', name: word, args: [] }, next: index + 1 } : null;
552
+ return { node: { kind: 'call', name: token.value, args: [] }, next: index + 1 };
515
553
  if (word === 'true' || word === 'false')
516
554
  return { node: { kind: 'boolean', value: word === 'true' }, next: index + 1 };
517
555
  if (word === 'null')
@@ -604,7 +642,7 @@ function readCase(tokens, index) {
604
642
  }
605
643
  return isWord(tokens[next], 'end') ? { node: { kind: 'case', whens, otherwise }, next: next + 1 } : null;
606
644
  }
607
- /** The fewest and most arguments a label function takes, or null for a function Groundwork does not read. */
645
+ /** The fewest and most arguments a label function takes, or null for a function this reader does not read. */
608
646
  function argumentRangeOf(name) {
609
647
  if (name === 'concat')
610
648
  return [1, Infinity];
@@ -639,7 +677,7 @@ function findAddedIntervals(node) {
639
677
  return [...own, ...childNodes(node).flatMap(findAddedIntervals)];
640
678
  }
641
679
  /**
642
- * Whether an expression's reads of other layers are ones Groundwork answers.
680
+ * Whether an expression's reads of other layers are ones the caller can answer.
643
681
  * With `allowed` false, it holds none. Otherwise each `overlay_within` or
644
682
  * `overlay_intersects` gives an expression and is the array that
645
683
  * `array_first` or a whole-number `[index]` reads; each `aggregate` is a
@@ -675,9 +713,10 @@ function lookupArguments(call) {
675
713
  const names = NAMED_PARAMETERS[call.name].names;
676
714
  return Object.fromEntries(names.map((name, position) => [name, call.args[position] ?? { kind: 'null' }]));
677
715
  }
678
- /** An expression over the target's own fields: no read of another layer, form or shape. */
716
+ /** An expression over the target's own fields: no read of another layer, form, shape or variable. */
679
717
  function readsTargetFieldsOnly(node) {
680
- return findCalls(node, ...LOOKUPS, ...PARENT_GEOMETRY_CALLS, 'array_first', 'array_get', 'current_value', ...AGGREGATES, ...Object.keys(GEOMETRY_VALUES)).length === 0;
718
+ return findCalls(node, ...LOOKUPS, ...PARENT_GEOMETRY_CALLS, 'array_first', 'array_get', 'current_value', ...AGGREGATES, ...Object.keys(GEOMETRY_VALUES)).length === 0
719
+ && findVariables(node).length === 0;
681
720
  }
682
721
  function isParentIntersectsFilter(node) {
683
722
  if (node.kind !== 'call' || node.name !== 'intersects')
@@ -746,7 +785,7 @@ function findCalls(node, ...names) {
746
785
  * no feature (`expressionFormAttributes`,
747
786
  * `src/core/fieldformatter/qgsvaluerelationfieldformatter.cpp`,
748
787
  * `qgis/QGIS@master`, read 2026-10-24), so an argument that reads a field
749
- * gives a blank name and the filter is not used. Groundwork takes a text
788
+ * gives a blank name and the filter is not used. This reader takes a text
750
789
  * literal as the one constant argument. An empty list is an expression that
751
790
  * reads no form value.
752
791
  */
@@ -830,6 +869,12 @@ export function expressionToGeoStylerFunction(node) {
830
869
  ]
831
870
  };
832
871
  case 'call': {
872
+ const variable = variableName(node);
873
+ if (variable !== null)
874
+ return { name: 'custom', fnName: EXPRESSION_VARIABLE, args: [variable] };
875
+ const point = variableName(node.args[0]);
876
+ if (POINT_PARTS.includes(node.name) && point !== null)
877
+ return { name: 'custom', fnName: EXPRESSION_VARIABLE, args: [point, node.name] };
833
878
  const args = node.args.map(expressionToGeoStylerFunction);
834
879
  if (node.name === 'concat')
835
880
  return { name: 'strConcat', args };
@@ -54,12 +54,12 @@ export declare function readQtDateTime(value: unknown): QtDateTime | null;
54
54
  * `fcnDayOfWeek` and `fcnWeek`, `src/core/expression/qgsexpressionfunction.cpp`,
55
55
  * `qgis/QGIS@16eddb2`, read 2026-10-26). The value is read as `format_date`
56
56
  * reads one (`readQtDateTime`) and the part is taken in its zone. A field QGIS
57
- * holds as a date-time reaches Groundwork as ISO text, so such text counts as a
57
+ * holds as a date-time reaches this function as ISO text, so such text counts as a
58
58
  * date-time. QGIS takes no time from a date alone and no weekday from a time
59
59
  * alone, so `hour`, `minute` and `second` of `2026-10-06`, and `day_of_week` of
60
60
  * `14:05`, are null, where QGIS reports an error. A time alone is read on
61
61
  * 0001-01-01, so its `year`, `month`, `day` and `week` are 1. `day_of_week`
62
- * counts from 0 for Sunday. QGIS also takes a span of time, which Groundwork never makes.
62
+ * counts from 0 for Sunday. QGIS also takes a span of time, which this function does not read.
63
63
  */
64
64
  export declare function qtDatePart(part: string, value: unknown): number | null;
65
65
  /**
@@ -68,7 +68,7 @@ export declare function qtDatePart(part: string, value: unknown): number | null;
68
68
  * `qgis/QGIS@16eddb2`, read 2026-10-26). A `Z` anywhere after the pattern's
69
69
  * first character shows the moment in UTC. Month and day names, am and pm and
70
70
  * the digits are in `language`; QGIS uses the computer's own language when
71
- * none is given, and Groundwork uses `en-AU`, as `format_number` does. Null
71
+ * none is given, and this function uses `en-AU`, as `format_number` does. Null
72
72
  * for a pattern holding `t` and for a language the browser cannot read.
73
73
  */
74
74
  export declare function formatQtDateTime(value: QtDateTime, pattern: string, language?: string | null): string | null;
@@ -184,12 +184,12 @@ const DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
184
184
  * `fcnDayOfWeek` and `fcnWeek`, `src/core/expression/qgsexpressionfunction.cpp`,
185
185
  * `qgis/QGIS@16eddb2`, read 2026-10-26). The value is read as `format_date`
186
186
  * reads one (`readQtDateTime`) and the part is taken in its zone. A field QGIS
187
- * holds as a date-time reaches Groundwork as ISO text, so such text counts as a
187
+ * holds as a date-time reaches this function as ISO text, so such text counts as a
188
188
  * date-time. QGIS takes no time from a date alone and no weekday from a time
189
189
  * alone, so `hour`, `minute` and `second` of `2026-10-06`, and `day_of_week` of
190
190
  * `14:05`, are null, where QGIS reports an error. A time alone is read on
191
191
  * 0001-01-01, so its `year`, `month`, `day` and `week` are 1. `day_of_week`
192
- * counts from 0 for Sunday. QGIS also takes a span of time, which Groundwork never makes.
192
+ * counts from 0 for Sunday. QGIS also takes a span of time, which this function does not read.
193
193
  */
194
194
  export function qtDatePart(part, value) {
195
195
  const moment = readQtDateTime(value);
@@ -220,7 +220,7 @@ function namePart(locale, options, epoch, type) {
220
220
  * `qgis/QGIS@16eddb2`, read 2026-10-26). A `Z` anywhere after the pattern's
221
221
  * first character shows the moment in UTC. Month and day names, am and pm and
222
222
  * the digits are in `language`; QGIS uses the computer's own language when
223
- * none is given, and Groundwork uses `en-AU`, as `format_number` does. Null
223
+ * none is given, and this function uses `en-AU`, as `format_number` does. Null
224
224
  * for a pattern holding `t` and for a language the browser cannot read.
225
225
  */
226
226
  export function formatQtDateTime(value, pattern, language) {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * QGIS hands a regular expression to Qt's `QRegularExpression`, which is PCRE2;
3
- * Groundwork runs it as a JavaScript `RegExp`. The two engines differ in many
3
+ * this package runs it as a JavaScript `RegExp`. The two engines differ in many
4
4
  * corners (`pcre2pattern`, PCRE2 10.4x, read 2026-10-27), so this file reads
5
5
  * only the forms listed here, written so that both give the same answer, and
6
6
  * gives null for any other pattern, so the expression is not read rather than
@@ -50,7 +50,7 @@
50
50
  */
51
51
  /**
52
52
  * A PCRE2 pattern as a JavaScript `RegExp` that matches what QGIS matches, or
53
- * null where Groundwork cannot translate it, or where the result does not
53
+ * null where this package cannot translate it, or where the result does not
54
54
  * compile. `unicode` is QGIS's `UseUnicodePropertiesOption`: on for the
55
55
  * `regexp_` functions, off for `~`. The `RegExp` is shared, so a caller that
56
56
  * matches globally makes its own from its `source` and `flags`.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * QGIS hands a regular expression to Qt's `QRegularExpression`, which is PCRE2;
3
- * Groundwork runs it as a JavaScript `RegExp`. The two engines differ in many
3
+ * this package runs it as a JavaScript `RegExp`. The two engines differ in many
4
4
  * corners (`pcre2pattern`, PCRE2 10.4x, read 2026-10-27), so this file reads
5
5
  * only the forms listed here, written so that both give the same answer, and
6
6
  * gives null for any other pattern, so the expression is not read rather than
@@ -296,7 +296,7 @@ function translate(pattern, unicode) {
296
296
  const COMPILED = new Map();
297
297
  /**
298
298
  * A PCRE2 pattern as a JavaScript `RegExp` that matches what QGIS matches, or
299
- * null where Groundwork cannot translate it, or where the result does not
299
+ * null where this package cannot translate it, or where the result does not
300
300
  * compile. `unicode` is QGIS's `UseUnicodePropertiesOption`: on for the
301
301
  * `regexp_` functions, off for `~`. The `RegExp` is shared, so a caller that
302
302
  * matches globally makes its own from its `source` and `flags`.
@@ -3,7 +3,7 @@ import type { StacCollection, StacItem } from '../model/Stac.ts';
3
3
  * Reading the Items inside a STAC API's Collection.
4
4
  *
5
5
  * A static catalogue puts its data on the Collection — one downloadable asset,
6
- * which `classifyStacCollectionFormat` reads and the rest of the app loads. A
6
+ * which `classifyStacCollectionFormat` reads and a reading application loads. A
7
7
  * STAC API does not: its Collections have no such asset, and every file sits on
8
8
  * an Item inside, reached through the Collection's `rel: "items"` link. Without
9
9
  * this module every Collection a STAC API lists classifies as unsupported.
@@ -3,7 +3,7 @@ import { STAC_VERSION } from "../model/Stac.js";
3
3
  * Reading the Items inside a STAC API's Collection.
4
4
  *
5
5
  * A static catalogue puts its data on the Collection — one downloadable asset,
6
- * which `classifyStacCollectionFormat` reads and the rest of the app loads. A
6
+ * which `classifyStacCollectionFormat` reads and a reading application loads. A
7
7
  * STAC API does not: its Collections have no such asset, and every file sits on
8
8
  * an Item inside, reached through the Collection's `rel: "items"` link. Without
9
9
  * this module every Collection a STAC API lists classifies as unsupported.
@@ -217,7 +217,7 @@ function itemBaseUrl(item, itemAddress) {
217
217
  *
218
218
  * An Item's asset href may be relative to the item document — `./scene.tif`
219
219
  * beside it. By the time a loader reads that href the document it was relative
220
- * to is gone, so without this the app resolves it against its own address and
220
+ * to is gone, so without this the loader resolves it against its own address and
221
221
  * fetches nothing. An href already absolute passes through
222
222
  * unchanged, and one that cannot be resolved is left as it stands.
223
223
  */
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * Turns the package's logging on or off. It is off until an application turns
3
- * it on; Groundwork turns it on in its development builds
4
- * (`src/startDevLogging.ts`, which `src/main.tsx` imports first).
3
+ * it on.
5
4
  */
6
5
  export declare function setDevLogging(on: boolean): void;
7
6
  /**
@@ -1,8 +1,7 @@
1
1
  let enabled = false;
2
2
  /**
3
3
  * Turns the package's logging on or off. It is off until an application turns
4
- * it on; Groundwork turns it on in its development builds
5
- * (`src/startDevLogging.ts`, which `src/main.tsx` imports first).
4
+ * it on.
6
5
  */
7
6
  export function setDevLogging(on) {
8
7
  enabled = on;
@@ -0,0 +1,2 @@
1
+ /** The text trimmed, or null where the value is not text or is blank. */
2
+ export declare function readNonBlank(value: unknown): string | null;
@@ -0,0 +1,4 @@
1
+ /** The text trimmed, or null where the value is not text or is blank. */
2
+ export function readNonBlank(value) {
3
+ return typeof value === 'string' && value.trim() ? value.trim() : null;
4
+ }
@@ -1,4 +1,4 @@
1
- // The WFS versions Groundwork speaks. Kept free of imports so a catalogue
1
+ // The WFS versions this package speaks. Kept free of imports so a catalogue
2
2
  // generator can read them without loading the WFS client, which loads OpenLayers.
3
3
  export const DEFAULT_WFS_VERSION = '1.1.0';
4
4
  // WFS 2.0.0 is used as a fallback for Esri servers, which require it for GeoJSON output and
package/package.json CHANGED
@@ -1,9 +1,17 @@
1
1
  {
2
2
  "name": "@vectoriahq/quac",
3
- "version": "0.1.0",
3
+ "version": "0.3.0-next.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
- "description": "QUAC, a STAC profile for describing the layers of a map, and the code that writes and reads it.",
6
+ "description": "Writes and reads QUAC, which adds map layer settings to STAC catalogues.",
7
+ "keywords": [
8
+ "stac",
9
+ "qgis",
10
+ "gis",
11
+ "geospatial",
12
+ "catalog",
13
+ "map"
14
+ ],
7
15
  "homepage": "https://github.com/vectoriahq/quac#readme",
8
16
  "bugs": {
9
17
  "url": "https://github.com/vectoriahq/quac/issues"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "https://vectoriahq.github.io/quac/v0.1.0/schema.json",
3
+ "$id": "https://vectoriahq.github.io/quac/v0.2.0/schema.json",
4
4
  "title": "QUAC: Quite Useful Additions for Catalogs",
5
5
  "description": "The fields of QUAC (Quite Useful Additions for Catalogs): the fields a STAC catalogue carries under the quac: prefix to say how a layer is drawn, edited and set up, as a source such as a QGIS project declares it. Validates a Catalog with its inlined collections and catalogs, or a single Collection. Only quac: fields are checked: any other field passes, and a quac: field this schema does not define fails. A field is written only when the source declares it, so an absent field means the source said nothing.",
6
6
  "type": "object",
@@ -518,6 +518,10 @@
518
518
  "description": "The form never shows the field. Written from a QGIS Hidden widget.",
519
519
  "const": true
520
520
  },
521
+ "quac:searchable": {
522
+ "description": "A search of the layer's features skips the field. Written from QGIS's Not searchable.",
523
+ "const": false
524
+ },
521
525
  "quac:reuse_last_value": {
522
526
  "description": "A new feature or record is offered the value last entered in the field. Written from QGIS's Reuse last entered value.",
523
527
  "const": true