@vectoriahq/quac 0.1.0 → 0.2.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/README.md +1 -1
- package/dist/generate/externalStacCatalogue.d.ts +4 -4
- package/dist/generate/externalStacCatalogue.js +9 -11
- package/dist/generate/folderStacCatalogue.js +1 -1
- package/dist/generate/normalizedProject.d.ts +5 -4
- package/dist/generate/normalizedProject.js +44 -92
- package/dist/generate/ogcFeaturesStacCatalogue.js +1 -1
- package/dist/generate/stacCatalogue.js +7 -2
- package/dist/generate/wmsStacCatalogue.js +2 -1
- package/dist/model/QgsProject.d.ts +11 -9
- package/dist/model/Stac.d.ts +8 -6
- package/dist/model/Stac.js +1 -1
- package/dist/model/featureFilter.d.ts +1 -1
- package/dist/model/fieldIconAddress.d.ts +1 -1
- package/dist/model/fieldIconAddress.js +1 -1
- package/dist/model/ogcFeatures.d.ts +3 -3
- package/dist/model/ogcFeatures.js +2 -2
- package/dist/model/quacExtension.d.ts +1 -1
- package/dist/model/quacExtension.js +1 -1
- package/dist/model/stacAssetRoles.d.ts +1 -1
- package/dist/model/stacAssetRoles.js +1 -1
- package/dist/model/stacHref.d.ts +1 -1
- package/dist/model/stacHref.js +1 -1
- package/dist/model/stacPmtiles.d.ts +1 -1
- package/dist/model/stacWms.d.ts +1 -1
- package/dist/model/stacWms.js +1 -1
- package/dist/model/wfs.d.ts +1 -1
- package/dist/parse/geometrySiblings.d.ts +1 -1
- package/dist/parse/geometrySiblings.js +1 -1
- package/dist/parse/parseBrandColour.d.ts +3 -3
- package/dist/parse/parseBrandColour.js +3 -3
- package/dist/parse/parseDataDefinedEditable.js +2 -2
- package/dist/parse/parseLayers.js +88 -85
- package/dist/parse/parseMeasurement.d.ts +2 -3
- package/dist/parse/parseMeasurement.js +3 -4
- package/dist/parse/qgisExpression.d.ts +4 -4
- package/dist/parse/qgisExpression.js +8 -8
- package/dist/parse/qtDateFormat.d.ts +3 -3
- package/dist/parse/qtDateFormat.js +3 -3
- package/dist/parse/qtRegex.d.ts +2 -2
- package/dist/parse/qtRegex.js +2 -2
- package/dist/sources/stacItems.d.ts +1 -1
- package/dist/sources/stacItems.js +2 -2
- package/dist/util/devLog.d.ts +1 -2
- package/dist/util/devLog.js +1 -2
- package/dist/util/nonBlankText.d.ts +2 -0
- package/dist/util/nonBlankText.js +4 -0
- package/dist/util/wfsVersions.js +1 -1
- package/package.json +10 -2
- package/src/schema/quac.schema.json +5 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @vectoriahq/quac
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Writes and reads [QUAC](https://github.com/vectoriahq/quac), which adds map layer settings to STAC 1.1.0 catalogues: how each layer is shown, how its fields are filled in and checked, and how its layers relate.
|
|
4
4
|
|
|
5
5
|
The package writes QUAC catalogues from QGIS projects and other sources, and reads them back. It makes no network request: it builds a catalogue from what an application has already fetched, such as a QGIS project's text or a QGIS Server GetProjectSettings response.
|
|
6
6
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { StacCatalog, StacCollection } from '../model/Stac.ts';
|
|
2
2
|
/**
|
|
3
|
-
* Converts a STAC document fetched from somewhere else to the
|
|
4
|
-
* profile (`packages/quac/spec/README.md`), so
|
|
5
|
-
* whatever the source.
|
|
3
|
+
* Converts a STAC document fetched from somewhere else to the QUAC
|
|
4
|
+
* profile (`packages/quac/spec/README.md`), so everything downstream reads one
|
|
5
|
+
* shape whatever the source.
|
|
6
6
|
*
|
|
7
7
|
* Everything the source declared is kept — this fills gaps, it never
|
|
8
8
|
* overwrites. Three gaps get filled:
|
|
@@ -16,7 +16,7 @@ import type { StacCatalog, StacCollection } from '../model/Stac.ts';
|
|
|
16
16
|
*
|
|
17
17
|
* That last one is the fallback the profile allows: an external catalogue
|
|
18
18
|
* cannot be expected to have our vendor fields, so its `data` asset href is
|
|
19
|
-
* sniffed instead. Catalogues
|
|
19
|
+
* sniffed instead. Catalogues this package generates have the fields, and the
|
|
20
20
|
* sniff never runs on them.
|
|
21
21
|
*
|
|
22
22
|
* Children linked as separate documents (`rel: "child"`) are not followed
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { listQuacExtension } from "../model/quacExtension.js";
|
|
2
2
|
import { STAC_VERSION } from "../model/Stac.js";
|
|
3
3
|
import { readDataAsset } from "../model/stacAssetRoles.js";
|
|
4
|
+
import { readNonBlank } from "../util/nonBlankText.js";
|
|
4
5
|
/**
|
|
5
|
-
* Converts a STAC document fetched from somewhere else to the
|
|
6
|
-
* profile (`packages/quac/spec/README.md`), so
|
|
7
|
-
* whatever the source.
|
|
6
|
+
* Converts a STAC document fetched from somewhere else to the QUAC
|
|
7
|
+
* profile (`packages/quac/spec/README.md`), so everything downstream reads one
|
|
8
|
+
* shape whatever the source.
|
|
8
9
|
*
|
|
9
10
|
* Everything the source declared is kept — this fills gaps, it never
|
|
10
11
|
* overwrites. Three gaps get filled:
|
|
@@ -18,7 +19,7 @@ import { readDataAsset } from "../model/stacAssetRoles.js";
|
|
|
18
19
|
*
|
|
19
20
|
* That last one is the fallback the profile allows: an external catalogue
|
|
20
21
|
* cannot be expected to have our vendor fields, so its `data` asset href is
|
|
21
|
-
* sniffed instead. Catalogues
|
|
22
|
+
* sniffed instead. Catalogues this package generates have the fields, and the
|
|
22
23
|
* sniff never runs on them.
|
|
23
24
|
*
|
|
24
25
|
* Children linked as separate documents (`rel: "child"`) are not followed
|
|
@@ -55,8 +56,8 @@ function normalizeCollection(collection) {
|
|
|
55
56
|
extent: normalizeExtent(collection.extent),
|
|
56
57
|
links: collection.links ?? []
|
|
57
58
|
};
|
|
58
|
-
const declaresWfsFields =
|
|
59
|
-
&&
|
|
59
|
+
const declaresWfsFields = readNonBlank(collection['quac:wfs_endpoint'])
|
|
60
|
+
&& readNonBlank(collection['quac:wfs_type_name']);
|
|
60
61
|
if (!declaresWfsFields) {
|
|
61
62
|
const sniffed = parseWfsGetFeatureUrl(readDataAsset(collection)?.href ?? '');
|
|
62
63
|
if (sniffed) {
|
|
@@ -106,8 +107,8 @@ function wrapAsCatalog(root) {
|
|
|
106
107
|
* name".
|
|
107
108
|
*/
|
|
108
109
|
export function resolveWfsCollectionSource(collection) {
|
|
109
|
-
const endpoint =
|
|
110
|
-
const typeName =
|
|
110
|
+
const endpoint = readNonBlank(collection['quac:wfs_endpoint']);
|
|
111
|
+
const typeName = readNonBlank(collection['quac:wfs_type_name']);
|
|
111
112
|
if (endpoint && typeName)
|
|
112
113
|
return { endpoint, typeName };
|
|
113
114
|
return parseWfsGetFeatureUrl(readDataAsset(collection)?.href ?? '');
|
|
@@ -140,6 +141,3 @@ export function parseWfsGetFeatureUrl(href) {
|
|
|
140
141
|
return null;
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
|
-
function readNonEmptyString(value) {
|
|
144
|
-
return typeof value === 'string' && value.trim() ? value.trim() : null;
|
|
145
|
-
}
|
|
@@ -35,7 +35,7 @@ function fileToNormalized(file) {
|
|
|
35
35
|
const hasSize = Number.isSafeInteger(file.size) && file.size > 0;
|
|
36
36
|
if (hasSize)
|
|
37
37
|
assets.data[FILE_SIZE_FIELD] = file.size;
|
|
38
|
-
// A style is declared, never embedded —
|
|
38
|
+
// A style is declared, never embedded — a reader fetches it live on every load,
|
|
39
39
|
// the same as a style a project file refers to. Keyed by the style file's name so
|
|
40
40
|
// it reads as one entry in a style set, like every other source's styles.
|
|
41
41
|
if (file.styleRelPath) {
|
|
@@ -259,7 +259,7 @@ export interface NormalizedProject {
|
|
|
259
259
|
}
|
|
260
260
|
/**
|
|
261
261
|
* Records where a catalogue came from as the Catalog's `self` link, so the
|
|
262
|
-
* document says it rather than
|
|
262
|
+
* document says it rather than a reader holding it alongside. Sources with no
|
|
263
263
|
* address of their own leave it off.
|
|
264
264
|
*/
|
|
265
265
|
export declare function withSelfLink(catalogue: StacCatalog, selfHref: string | undefined): StacCatalog;
|
|
@@ -274,7 +274,7 @@ export declare function generateStacFromNormalized(project: NormalizedProject):
|
|
|
274
274
|
/**
|
|
275
275
|
* The column with `data_type` written beside its `type`, as the Table
|
|
276
276
|
* extension recommends. A `type` outside `TableColumnType`, such as a QGIS
|
|
277
|
-
* Server type name
|
|
277
|
+
* Server type name this package does not map, gets no `data_type`.
|
|
278
278
|
*/
|
|
279
279
|
export declare function withDataType(column: TableColumn): TableColumn;
|
|
280
280
|
/**
|
|
@@ -367,11 +367,12 @@ export declare function readCollectionFieldAttachments(collection: StacCollectio
|
|
|
367
367
|
/**
|
|
368
368
|
* What each column says about changing it, keyed by field name — the
|
|
369
369
|
* counterpart of the `quac:editable`, `quac:default`,
|
|
370
|
-
* `quac:constraints`, `quac:hidden` and
|
|
370
|
+
* `quac:constraints`, `quac:hidden`, `quac:searchable` and
|
|
371
371
|
* `quac:reuse_last_value` writes in `stacCatalogue.ts`. A column
|
|
372
372
|
* declaring none of them is absent from the result.
|
|
373
373
|
*
|
|
374
|
-
* Only `quac:editable: false` makes a field read-only,
|
|
374
|
+
* Only `quac:editable: false` makes a field read-only, only
|
|
375
|
+
* `quac:searchable: false` keeps it out of a search, and only
|
|
375
376
|
* `quac:hidden: true`, `quac:reuse_last_value: true` and `quac:color: true`
|
|
376
377
|
* set theirs. A `quac:icon` that is not an `https://` address is left out, as
|
|
377
378
|
* is a `quac:control` other than `buttons` or `dropdown`.
|
|
@@ -2,6 +2,7 @@ import { readHttpsAddress } from "../model/fieldIconAddress.js";
|
|
|
2
2
|
import { declareQuacExtension } from "../model/quacExtension.js";
|
|
3
3
|
import { STAC_VERSION } from "../model/Stac.js";
|
|
4
4
|
import { collectCatalogueCollections } from "../model/stacTreeWalk.js";
|
|
5
|
+
import { readNonBlank } from "../util/nonBlankText.js";
|
|
5
6
|
/**
|
|
6
7
|
* Source-agnostic intermediate model + the single STAC generator that
|
|
7
8
|
* consumes it.
|
|
@@ -84,7 +85,7 @@ const INITIAL_VIEW_FIELD = 'quac:initial_view';
|
|
|
84
85
|
export const QUAC_ACTIVE_COLLECTION_FIELD = 'quac:active_collection';
|
|
85
86
|
/**
|
|
86
87
|
* Records where a catalogue came from as the Catalog's `self` link, so the
|
|
87
|
-
* document says it rather than
|
|
88
|
+
* document says it rather than a reader holding it alongside. Sources with no
|
|
88
89
|
* address of their own leave it off.
|
|
89
90
|
*/
|
|
90
91
|
export function withSelfLink(catalogue, selfHref) {
|
|
@@ -309,7 +310,7 @@ const DATA_TYPE_BY_COLUMN_TYPE = {
|
|
|
309
310
|
/**
|
|
310
311
|
* The column with `data_type` written beside its `type`, as the Table
|
|
311
312
|
* extension recommends. A `type` outside `TableColumnType`, such as a QGIS
|
|
312
|
-
* Server type name
|
|
313
|
+
* Server type name this package does not map, gets no `data_type`.
|
|
313
314
|
*/
|
|
314
315
|
export function withDataType(column) {
|
|
315
316
|
const type = column.type;
|
|
@@ -357,24 +358,30 @@ export function readCatalogueInitialView(catalog) {
|
|
|
357
358
|
*/
|
|
358
359
|
/** The field the source nominates as the layer's title attribute. */
|
|
359
360
|
export function readCollectionDisplayField(collection) {
|
|
360
|
-
|
|
361
|
-
return typeof value === 'string' && value.trim() ? value.trim() : null;
|
|
361
|
+
return readNonBlank(collection['quac:display_field']);
|
|
362
362
|
}
|
|
363
|
-
/**
|
|
364
|
-
|
|
363
|
+
/**
|
|
364
|
+
* Each entry of a Collection's `table:columns` that is an object with a
|
|
365
|
+
* non-blank `name`, as `[trimmed name, column]`, in declared order. An entry
|
|
366
|
+
* of any other shape, or a `table:columns` that is not a list, yields nothing.
|
|
367
|
+
*/
|
|
368
|
+
function* declaredColumns(collection) {
|
|
365
369
|
const columns = collection['table:columns'];
|
|
366
370
|
if (!Array.isArray(columns))
|
|
367
|
-
return
|
|
368
|
-
const aliases = {};
|
|
371
|
+
return;
|
|
369
372
|
for (const column of columns) {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
373
|
+
const candidate = readObject(column);
|
|
374
|
+
const name = readNonBlank(candidate?.name);
|
|
375
|
+
if (candidate && name)
|
|
376
|
+
yield [name, candidate];
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
/** Field display labels from STAC Table column titles or descriptions. */
|
|
380
|
+
export function readCollectionFieldAliases(collection) {
|
|
381
|
+
const aliases = {};
|
|
382
|
+
for (const [name, column] of declaredColumns(collection)) {
|
|
383
|
+
const alias = readNonBlank(column.title) ?? readNonBlank(column.description);
|
|
384
|
+
if (alias)
|
|
378
385
|
aliases[name] = alias;
|
|
379
386
|
}
|
|
380
387
|
return aliases;
|
|
@@ -386,32 +393,14 @@ export function readCollectionFieldAliases(collection) {
|
|
|
386
393
|
* `collectFieldNames` does not.
|
|
387
394
|
*/
|
|
388
395
|
export function readCollectionFieldNames(collection) {
|
|
389
|
-
|
|
390
|
-
if (!Array.isArray(columns))
|
|
391
|
-
return [];
|
|
392
|
-
const names = [];
|
|
393
|
-
for (const column of columns) {
|
|
394
|
-
if (!column || typeof column !== 'object')
|
|
395
|
-
continue;
|
|
396
|
-
const name = column.name;
|
|
397
|
-
if (typeof name === 'string' && name.trim())
|
|
398
|
-
names.push(name.trim());
|
|
399
|
-
}
|
|
400
|
-
return names;
|
|
396
|
+
return Array.from(declaredColumns(collection), ([name]) => name);
|
|
401
397
|
}
|
|
402
398
|
/** Each declared column `type`, keyed by field name. A column with no `type` is absent. */
|
|
403
399
|
export function readCollectionFieldTypes(collection) {
|
|
404
|
-
const columns = collection['table:columns'];
|
|
405
|
-
if (!Array.isArray(columns))
|
|
406
|
-
return {};
|
|
407
400
|
const types = {};
|
|
408
|
-
for (const column of
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
const candidate = column;
|
|
412
|
-
const name = typeof candidate.name === 'string' ? candidate.name.trim() : '';
|
|
413
|
-
const type = typeof candidate.type === 'string' ? candidate.type.trim() : '';
|
|
414
|
-
if (name && type)
|
|
401
|
+
for (const [name, column] of declaredColumns(collection)) {
|
|
402
|
+
const type = readNonBlank(column.type);
|
|
403
|
+
if (type)
|
|
415
404
|
types[name] = type;
|
|
416
405
|
}
|
|
417
406
|
return types;
|
|
@@ -422,19 +411,12 @@ export function readCollectionFieldTypes(collection) {
|
|
|
422
411
|
* other kind, is dropped, and a column left with no entries is absent.
|
|
423
412
|
*/
|
|
424
413
|
export function readCollectionFieldValues(collection) {
|
|
425
|
-
const columns = collection['table:columns'];
|
|
426
|
-
if (!Array.isArray(columns))
|
|
427
|
-
return {};
|
|
428
414
|
const picklists = {};
|
|
429
|
-
for (const column of
|
|
430
|
-
if (!column
|
|
431
|
-
continue;
|
|
432
|
-
const candidate = column;
|
|
433
|
-
const name = typeof candidate.name === 'string' ? candidate.name.trim() : '';
|
|
434
|
-
if (!name || !Array.isArray(candidate.values))
|
|
415
|
+
for (const [name, column] of declaredColumns(collection)) {
|
|
416
|
+
if (!Array.isArray(column.values))
|
|
435
417
|
continue;
|
|
436
418
|
const entries = [];
|
|
437
|
-
for (const entry of
|
|
419
|
+
for (const entry of column.values) {
|
|
438
420
|
if (!entry || typeof entry !== 'object')
|
|
439
421
|
continue;
|
|
440
422
|
const { value, label, icon } = entry;
|
|
@@ -457,17 +439,10 @@ export function readCollectionFieldValues(collection) {
|
|
|
457
439
|
* `order_field`, reads as ordered by key.
|
|
458
440
|
*/
|
|
459
441
|
export function readCollectionFieldValueRelations(collection) {
|
|
460
|
-
const columns = collection['table:columns'];
|
|
461
|
-
if (!Array.isArray(columns))
|
|
462
|
-
return {};
|
|
463
442
|
const relations = {};
|
|
464
|
-
for (const column of
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
const candidate = column;
|
|
468
|
-
const name = readTrimmedString(candidate.name);
|
|
469
|
-
const declared = candidate['quac:value_relation'];
|
|
470
|
-
if (!name || !declared || typeof declared !== 'object')
|
|
443
|
+
for (const [name, column] of declaredColumns(collection)) {
|
|
444
|
+
const declared = column['quac:value_relation'];
|
|
445
|
+
if (!declared || typeof declared !== 'object')
|
|
471
446
|
continue;
|
|
472
447
|
const entry = declared;
|
|
473
448
|
const lookup = readTrimmedString(entry.collection);
|
|
@@ -571,17 +546,10 @@ export function readCollectionPrivate(collection) {
|
|
|
571
546
|
* omitted or unrecognised `relative_storage` as absolute.
|
|
572
547
|
*/
|
|
573
548
|
export function readCollectionFieldAttachments(collection) {
|
|
574
|
-
const columns = collection['table:columns'];
|
|
575
|
-
if (!Array.isArray(columns))
|
|
576
|
-
return {};
|
|
577
549
|
const attachments = {};
|
|
578
|
-
for (const column of
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
const candidate = column;
|
|
582
|
-
const name = typeof candidate.name === 'string' ? candidate.name.trim() : '';
|
|
583
|
-
const declared = candidate['quac:attachment'];
|
|
584
|
-
if (!name || !declared || typeof declared !== 'object' || Array.isArray(declared))
|
|
550
|
+
for (const [name, column] of declaredColumns(collection)) {
|
|
551
|
+
const declared = column['quac:attachment'];
|
|
552
|
+
if (!declared || typeof declared !== 'object' || Array.isArray(declared))
|
|
585
553
|
continue;
|
|
586
554
|
const fields = declared;
|
|
587
555
|
attachments[name] = {
|
|
@@ -598,11 +566,12 @@ export function readCollectionFieldAttachments(collection) {
|
|
|
598
566
|
/**
|
|
599
567
|
* What each column says about changing it, keyed by field name — the
|
|
600
568
|
* counterpart of the `quac:editable`, `quac:default`,
|
|
601
|
-
* `quac:constraints`, `quac:hidden` and
|
|
569
|
+
* `quac:constraints`, `quac:hidden`, `quac:searchable` and
|
|
602
570
|
* `quac:reuse_last_value` writes in `stacCatalogue.ts`. A column
|
|
603
571
|
* declaring none of them is absent from the result.
|
|
604
572
|
*
|
|
605
|
-
* Only `quac:editable: false` makes a field read-only,
|
|
573
|
+
* Only `quac:editable: false` makes a field read-only, only
|
|
574
|
+
* `quac:searchable: false` keeps it out of a search, and only
|
|
606
575
|
* `quac:hidden: true`, `quac:reuse_last_value: true` and `quac:color: true`
|
|
607
576
|
* set theirs. A `quac:icon` that is not an `https://` address is left out, as
|
|
608
577
|
* is a `quac:control` other than `buttons` or `dropdown`.
|
|
@@ -614,18 +583,9 @@ export function readCollectionFieldAttachments(collection) {
|
|
|
614
583
|
* with no expression text is left out.
|
|
615
584
|
*/
|
|
616
585
|
export function readCollectionFieldEditRules(collection) {
|
|
617
|
-
const columns = collection['table:columns'];
|
|
618
|
-
if (!Array.isArray(columns))
|
|
619
|
-
return {};
|
|
620
586
|
const relations = readCollectionFieldValueRelations(collection);
|
|
621
587
|
const rules = {};
|
|
622
|
-
for (const
|
|
623
|
-
if (!column || typeof column !== 'object')
|
|
624
|
-
continue;
|
|
625
|
-
const candidate = column;
|
|
626
|
-
const name = typeof candidate.name === 'string' ? candidate.name.trim() : '';
|
|
627
|
-
if (!name)
|
|
628
|
-
continue;
|
|
588
|
+
for (const [name, candidate] of declaredColumns(collection)) {
|
|
629
589
|
const readOnly = candidate['quac:editable'] === false;
|
|
630
590
|
const defaultValue = readColumnDefault(candidate['quac:default']);
|
|
631
591
|
const constraints = readObject(candidate['quac:constraints']);
|
|
@@ -641,13 +601,14 @@ export function readCollectionFieldEditRules(collection) {
|
|
|
641
601
|
const range = readColumnRange(candidate['quac:range']);
|
|
642
602
|
const dateFormat = readNonBlank(candidate['quac:date_format']);
|
|
643
603
|
const colour = candidate['quac:color'] === true;
|
|
604
|
+
const notSearchable = candidate['quac:searchable'] === false;
|
|
644
605
|
const icon = readHttpsAddress(candidate['quac:icon']);
|
|
645
606
|
const control = candidate['quac:control'] === 'buttons' || candidate['quac:control'] === 'dropdown' ? candidate['quac:control'] : null;
|
|
646
607
|
const defaultExpression = readDefaultExpression(candidate['quac:default']);
|
|
647
608
|
const relation = relations[name];
|
|
648
609
|
// A field storing several keys gets no list, so no rule about its blank choice.
|
|
649
610
|
const valueRelation = relation && relation.allow_multi !== true ? { allowNull: relation.allow_null === true, relation } : null;
|
|
650
|
-
if (valueRelation || readOnly || defaultValue || defaultExpression || notNull || unique || constraintExpression || hidden || reuseLastValue || duplicatePolicy || checkbox || range || dateFormat || colour || icon || control) {
|
|
611
|
+
if (valueRelation || readOnly || defaultValue || defaultExpression || notNull || unique || constraintExpression || hidden || reuseLastValue || duplicatePolicy || checkbox || range || dateFormat || colour || notSearchable || icon || control) {
|
|
651
612
|
rules[name] = {
|
|
652
613
|
readOnly, defaultValue, notNull, unique, hidden, reuseLastValue, duplicatePolicy,
|
|
653
614
|
...(constraintExpression ? { constraintExpression } : {}),
|
|
@@ -656,6 +617,7 @@ export function readCollectionFieldEditRules(collection) {
|
|
|
656
617
|
...(range ? { range } : {}),
|
|
657
618
|
...(dateFormat ? { dateFormat } : {}),
|
|
658
619
|
...(colour ? { colour } : {}),
|
|
620
|
+
...(notSearchable ? { notSearchable } : {}),
|
|
659
621
|
...(icon ? { icon } : {}),
|
|
660
622
|
...(control ? { control } : {}),
|
|
661
623
|
...(valueRelation ? { valueRelation } : {})
|
|
@@ -680,14 +642,7 @@ export function readCollectionFormLayout(collection) {
|
|
|
680
642
|
const order = collection[QUAC_FORM_ORDER_FIELD];
|
|
681
643
|
if (!Array.isArray(order))
|
|
682
644
|
return null;
|
|
683
|
-
const columns = new Map();
|
|
684
|
-
const declared = collection['table:columns'];
|
|
685
|
-
for (const column of Array.isArray(declared) ? declared : []) {
|
|
686
|
-
const candidate = readObject(column);
|
|
687
|
-
const name = readNonBlank(candidate?.name);
|
|
688
|
-
if (candidate && name)
|
|
689
|
-
columns.set(name, candidate);
|
|
690
|
-
}
|
|
645
|
+
const columns = new Map(declaredColumns(collection));
|
|
691
646
|
const fields = [];
|
|
692
647
|
const placed = new Set();
|
|
693
648
|
for (const entry of order) {
|
|
@@ -769,9 +724,6 @@ function readObject(value) {
|
|
|
769
724
|
}
|
|
770
725
|
const ATTACHMENT_VIEWERS = ['image', 'web', 'audio', 'video'];
|
|
771
726
|
const ATTACHMENT_RELATIVE_STORAGE = ['absolute', 'project', 'default-root'];
|
|
772
|
-
function readNonBlank(value) {
|
|
773
|
-
return typeof value === 'string' && value.trim() ? value.trim() : null;
|
|
774
|
-
}
|
|
775
727
|
/** Whether the source declares the layer editable. */
|
|
776
728
|
export function readCollectionEditable(collection) {
|
|
777
729
|
const value = collection['quac:editable'];
|
|
@@ -104,7 +104,7 @@ function buildAssets(itemsUrl, tilesUrl, title) {
|
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
106
|
* The collection's tile template, absolute, or null where it publishes none
|
|
107
|
-
* this
|
|
107
|
+
* this package reads.
|
|
108
108
|
*
|
|
109
109
|
* Only a `{z}`/`{x}`/`{y}` template counts. A `tiles` link is also how a
|
|
110
110
|
* service points at an OGC API - Tiles tileset document, which describes its
|
|
@@ -364,8 +364,8 @@ function qgsLayerToNormalized(layer, context, geometryFilter = geometryFilterOf(
|
|
|
364
364
|
displayField: layer.displayField,
|
|
365
365
|
visibilityChecked: layer.isVisible,
|
|
366
366
|
// An image layer has no features to edit. An ArcGIS layer keeps the
|
|
367
|
-
// project's own Read-only tick:
|
|
368
|
-
// service is
|
|
367
|
+
// project's own Read-only tick: whether edits are written back to the
|
|
368
|
+
// service is left to the application reading the catalogue.
|
|
369
369
|
editable: ds.kind === 'wms' || ds.kind === 'wmts' || ds.kind === 'xyz' ? false : layer.editable,
|
|
370
370
|
identifiable: layer.queryable,
|
|
371
371
|
scaleRange: layer.scaleRange,
|
|
@@ -694,6 +694,9 @@ function unionExtent(layers, layerWgs84Extents) {
|
|
|
694
694
|
* with, that it must not be blank, that the form never
|
|
695
695
|
* shows it, and that a new feature is offered its last
|
|
696
696
|
* value, from QGIS's Attributes Form
|
|
697
|
+
* - **quac:searchable**
|
|
698
|
+
* that a search of the layer's features skips the field,
|
|
699
|
+
* from QGIS's Not searchable in the Fields tab
|
|
697
700
|
* - **quac:color** that the field holds a colour, when QGIS's Color edit
|
|
698
701
|
* widget declares one
|
|
699
702
|
* - **quac:visible_when** / **quac:in_form** / **quac:editable_when**
|
|
@@ -778,6 +781,8 @@ function deriveTableColumns(geojson, fieldNames, fieldAliases, fieldValueMaps =
|
|
|
778
781
|
}
|
|
779
782
|
if (editRule?.hidden)
|
|
780
783
|
column['quac:hidden'] = true;
|
|
784
|
+
if (editRule?.notSearchable)
|
|
785
|
+
column['quac:searchable'] = false;
|
|
781
786
|
if (editRule?.reuseLastValue)
|
|
782
787
|
column['quac:reuse_last_value'] = true;
|
|
783
788
|
if (editRule?.duplicatePolicy)
|
|
@@ -87,7 +87,8 @@ function wmsLayerToNormalized(layer, wfsSource) {
|
|
|
87
87
|
/**
|
|
88
88
|
* A GetMap link for a layer QGIS Server publishes only over WMS. The style is
|
|
89
89
|
* left empty, which asks the server for the layer's default style. No version
|
|
90
|
-
* is stated, so the
|
|
90
|
+
* is stated, so an application reading the catalogue asks the server for one
|
|
91
|
+
* when the layer is first shown.
|
|
91
92
|
*/
|
|
92
93
|
function buildQgisServerWmsLink(endpoint, layer) {
|
|
93
94
|
return {
|
|
@@ -35,7 +35,7 @@ export interface QgsProject {
|
|
|
35
35
|
layerTree: LayerGroup;
|
|
36
36
|
/** Relations from <relations>, each joining a parent layer to a child layer. */
|
|
37
37
|
relations?: QgsRelation[];
|
|
38
|
-
/** Project-level <projectMetadata>, as far as
|
|
38
|
+
/** Project-level <projectMetadata>, as far as QUAC reads it. */
|
|
39
39
|
metadata: ProjectMetadata;
|
|
40
40
|
/** The area and distance units `$area`, `$length` and `$perimeter` are given in; null where the project saves none. */
|
|
41
41
|
measurement?: ProjectMeasurement | null;
|
|
@@ -64,7 +64,7 @@ export interface QgsProject {
|
|
|
64
64
|
rawXml: string | null;
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
|
-
* The parts of QGIS's project-level `<projectMetadata>`
|
|
67
|
+
* The parts of QGIS's project-level `<projectMetadata>` this package reads.
|
|
68
68
|
* QGIS's own dialog (Project Properties > Metadata) writes the element on
|
|
69
69
|
* every project, empty fields and all — `abstract` and `author` are null only
|
|
70
70
|
* when the author left them blank, checked against a saved QGIS project
|
|
@@ -197,7 +197,7 @@ export interface LayerEntry {
|
|
|
197
197
|
styles: LayerStyle[];
|
|
198
198
|
/** Index into styles[] of the active style; -1 if no styles were captured. */
|
|
199
199
|
activeStyleIndex: number;
|
|
200
|
-
/** The layer's `<resourceMetadata>`, as far as
|
|
200
|
+
/** The layer's `<resourceMetadata>`, as far as QUAC reads it. */
|
|
201
201
|
resourceMetadata: LayerResourceMetadata;
|
|
202
202
|
/** The layer's `<attribution>` element — a credit line, separate from resourceMetadata. */
|
|
203
203
|
attribution: LayerAttribution | null;
|
|
@@ -231,7 +231,7 @@ export interface LayerEntry {
|
|
|
231
231
|
fieldAttachments: Record<string, FieldAttachment>;
|
|
232
232
|
/**
|
|
233
233
|
* What the Attributes Form says about changing each field: whether its
|
|
234
|
-
* Editable box is unticked, and a default value
|
|
234
|
+
* Editable box is unticked, and a default value an application can fill in.
|
|
235
235
|
* Fields with neither are absent.
|
|
236
236
|
*/
|
|
237
237
|
fieldEditRules: Record<string, FieldEditRule>;
|
|
@@ -303,7 +303,7 @@ export interface WfsTransactionLayers {
|
|
|
303
303
|
delete: string[];
|
|
304
304
|
}
|
|
305
305
|
/**
|
|
306
|
-
* The parts of QGIS's per-layer `<resourceMetadata>`
|
|
306
|
+
* The parts of QGIS's per-layer `<resourceMetadata>` this package reads.
|
|
307
307
|
* `abstract`, `contacts` and `temporalInterval`'s `<period>` shape verified
|
|
308
308
|
* against a saved QGIS project, whose `<resourceMetadata>`
|
|
309
309
|
* has those fields written but empty on that fixture. `<license>` and
|
|
@@ -355,7 +355,7 @@ export interface FieldValueMapEntry {
|
|
|
355
355
|
label: string;
|
|
356
356
|
}
|
|
357
357
|
/**
|
|
358
|
-
* A field's Value Relation edit widget, as far as
|
|
358
|
+
* A field's Value Relation edit widget, as far as QUAC reads it: the
|
|
359
359
|
* lookup layer it names, the fields stored and shown, and how the list is
|
|
360
360
|
* filtered and ordered. The widget's group, description, column count and
|
|
361
361
|
* completer settings are not read.
|
|
@@ -383,7 +383,7 @@ export interface FieldValueRelation {
|
|
|
383
383
|
descending: boolean;
|
|
384
384
|
}
|
|
385
385
|
/**
|
|
386
|
-
* A field's Attachment edit widget, as far as
|
|
386
|
+
* A field's Attachment edit widget, as far as QUAC reads it. QGIS calls
|
|
387
387
|
* the widget `ExternalResource`; the field holds a file's path rather than
|
|
388
388
|
* text.
|
|
389
389
|
*/
|
|
@@ -397,7 +397,7 @@ export interface FieldAttachment {
|
|
|
397
397
|
/** What a stored path is relative to. */
|
|
398
398
|
relativeStorage: 'absolute' | 'project' | 'default-root';
|
|
399
399
|
}
|
|
400
|
-
/** A layer's Drag and Drop Designer form, as far as
|
|
400
|
+
/** A layer's Drag and Drop Designer form, as far as QUAC reads it: which fields it places, in its order. */
|
|
401
401
|
export interface LayerFormLayout {
|
|
402
402
|
fields: FormLayoutField[];
|
|
403
403
|
}
|
|
@@ -422,7 +422,7 @@ export interface FormLayoutField {
|
|
|
422
422
|
export interface FieldEditRule {
|
|
423
423
|
/** True where the source shows the field but does not let anyone change it. */
|
|
424
424
|
readOnly: boolean;
|
|
425
|
-
/** The value the field is filled with, or null where the source declares none
|
|
425
|
+
/** The value the field is filled with, or null where the source declares none an application can fill. */
|
|
426
426
|
defaultValue: FieldDefaultValue | null;
|
|
427
427
|
/**
|
|
428
428
|
* The field's Not null constraint: `enforced` refuses a blank, `warn` lets
|
|
@@ -478,6 +478,8 @@ export interface FieldEditRule {
|
|
|
478
478
|
dateFormat?: string | null;
|
|
479
479
|
/** True where the field holds a colour: a QGIS Color widget. */
|
|
480
480
|
colour?: boolean;
|
|
481
|
+
/** True where the source's search of a layer's features skips the field: QGIS's Not searchable. */
|
|
482
|
+
notSearchable?: boolean;
|
|
481
483
|
/** The `https://` address of the icon drawn beside the field's name. Null or absent where it has none. */
|
|
482
484
|
icon?: string | null;
|
|
483
485
|
/** The control the edit form draws the field's choices with. Null or absent where the source asks for none. */
|
package/dist/model/Stac.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Minimal STAC type definitions for the documents
|
|
2
|
+
* Minimal STAC type definitions for the documents this package generates.
|
|
3
3
|
*
|
|
4
4
|
* The shape these types describe — a Catalog of Collections, one Collection
|
|
5
5
|
* per layer, vendor fields under `quac:` —
|
|
@@ -53,8 +53,8 @@ export interface StacCollection {
|
|
|
53
53
|
/**
|
|
54
54
|
* An organisation that had a hand in the Collection's data. STAC's `roles` are
|
|
55
55
|
* `licensor`, `producer`, `processor` and `host`. This is where credit lines
|
|
56
|
-
* come from — the
|
|
57
|
-
*
|
|
56
|
+
* come from — an application reading the catalogue builds the on-screen
|
|
57
|
+
* attribution out of these names and URLs, and no pre-written string is stored.
|
|
58
58
|
*/
|
|
59
59
|
export interface StacProvider {
|
|
60
60
|
name: string;
|
|
@@ -68,7 +68,7 @@ export interface StacProvider {
|
|
|
68
68
|
* why `packages/quac/src/sources/stacItems.ts` exists: a Collection served by an API
|
|
69
69
|
* has no downloadable asset, and the Items inside it have them all.
|
|
70
70
|
*
|
|
71
|
-
* Only the fields
|
|
71
|
+
* Only the fields this package reads are named. `properties.datetime` is what
|
|
72
72
|
* orders an item list. An Item may have `start_datetime` / `end_datetime`
|
|
73
73
|
* instead; which of the three STAC requires was not established here — no
|
|
74
74
|
* specification document was reachable — so `readItemTimestamp` takes
|
|
@@ -137,7 +137,7 @@ export interface TableColumn {
|
|
|
137
137
|
* precedence when both are present.
|
|
138
138
|
*/
|
|
139
139
|
title?: string;
|
|
140
|
-
/** The column's type: the `TableColumnType` an adapter maps the source's type to, or, for a QGIS Server type
|
|
140
|
+
/** The column's type: the `TableColumnType` an adapter maps the source's type to, or, for a QGIS Server type this package does not map, its lowercased type name. */
|
|
141
141
|
type?: string;
|
|
142
142
|
/** The column's type as a STAC common metadata data type, written beside a `type` that maps to one. */
|
|
143
143
|
data_type?: TableColumnDataType;
|
|
@@ -156,6 +156,8 @@ export interface TableColumn {
|
|
|
156
156
|
'quac:constraints'?: TableColumnConstraints;
|
|
157
157
|
/** Written only as `true`: the source's form never shows the column. */
|
|
158
158
|
'quac:hidden'?: true;
|
|
159
|
+
/** Written only as `false`: a search of the layer's features skips the column. */
|
|
160
|
+
'quac:searchable'?: false;
|
|
159
161
|
/** Written only as `true`: a new feature is offered the value last entered in the column. */
|
|
160
162
|
'quac:reuse_last_value'?: true;
|
|
161
163
|
/**
|
|
@@ -285,7 +287,7 @@ export interface TableColumnConstraints {
|
|
|
285
287
|
strength: 'enforced' | 'warn';
|
|
286
288
|
};
|
|
287
289
|
}
|
|
288
|
-
/** The column types
|
|
290
|
+
/** The column types the adapters map a source's declared field types to. */
|
|
289
291
|
export type TableColumnType = 'string' | 'int' | 'long' | 'double' | 'boolean' | 'date' | 'time' | 'timestamp';
|
|
290
292
|
/**
|
|
291
293
|
* The STAC common metadata data types a `TableColumnType` maps to. STAC names
|
package/dist/model/Stac.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Minimal STAC type definitions for the documents
|
|
2
|
+
* Minimal STAC type definitions for the documents this package generates.
|
|
3
3
|
*
|
|
4
4
|
* The shape these types describe — a Catalog of Collections, one Collection
|
|
5
5
|
* per layer, vendor fields under `quac:` —
|
|
@@ -6,7 +6,7 @@ import type { StacCollection } from './Stac.ts';
|
|
|
6
6
|
*
|
|
7
7
|
* Its language is the one the layer's provider reads. OGR writes it as
|
|
8
8
|
* `|subset=` at the end of the data source and hands it to GDAL, whose SQL
|
|
9
|
-
* this is for every file
|
|
9
|
+
* this is for every file read through OGR (`QgsOgrProviderMetadata::decodeUri`,
|
|
10
10
|
* `src/core/providers/ogr/qgsogrprovidermetadata.cpp`, `qgis/QGIS@master`, read
|
|
11
11
|
* 2026-10-26). The Delimited Text provider writes it as the `subset` query
|
|
12
12
|
* item and reads it as a QGIS expression (`QgsDelimitedTextProvider`,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The icon libraries
|
|
2
|
+
* The icon libraries this package addresses on jsDelivr, each pinned to the major
|
|
3
3
|
* version of its package, so a release adds icons but never renames one. A
|
|
4
4
|
* field's icon is named from them, and a
|
|
5
5
|
* map symbol from one of them is painted in its style's colour. This
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The icon libraries
|
|
2
|
+
* The icon libraries this package addresses on jsDelivr, each pinned to the major
|
|
3
3
|
* version of its package, so a release adds icons but never renames one. A
|
|
4
4
|
* field's icon is named from them, and a
|
|
5
5
|
* map symbol from one of them is painted in its style's colour. This
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The parts of an OGC API - Features service's JSON this
|
|
3
|
-
* from
|
|
2
|
+
* The parts of an OGC API - Features service's JSON this package reads. Kept
|
|
3
|
+
* apart from any OGC API - Features client so the STAC generators can describe a
|
|
4
4
|
* collection without importing anything that fetches.
|
|
5
5
|
*/
|
|
6
6
|
export interface OgcLink {
|
|
@@ -10,7 +10,7 @@ export interface OgcLink {
|
|
|
10
10
|
title?: string;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* What a collection holds. `feature` is the only kind
|
|
13
|
+
* What a collection holds. `feature` is the only kind that holds features to load —
|
|
14
14
|
* `record` is a catalogue's index of itself (OGC API - Records) and `coverage`
|
|
15
15
|
* is raster, which has no `items` endpoint to read.
|
|
16
16
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The parts of an OGC API - Features service's JSON this
|
|
3
|
-
* from
|
|
2
|
+
* The parts of an OGC API - Features service's JSON this package reads. Kept
|
|
3
|
+
* apart from any OGC API - Features client so the STAC generators can describe a
|
|
4
4
|
* collection without importing anything that fetches.
|
|
5
5
|
*/
|
|
6
6
|
export {};
|