@vectoriahq/quac 0.20.0-next.1 → 0.21.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.
|
@@ -44,6 +44,8 @@ export interface StacStyle {
|
|
|
44
44
|
* Either holds the values to merge over the style document it is listed on.
|
|
45
45
|
*/
|
|
46
46
|
export type StyleOverrideReference = string | Record<string, unknown>;
|
|
47
|
+
/** The key a style asset stores its style overrides under. */
|
|
48
|
+
export declare const QUAC_STYLE_OVERRIDES = "quac:style_overrides";
|
|
47
49
|
/**
|
|
48
50
|
* The role marking the asset a Collection nominates as its default style.
|
|
49
51
|
*
|
package/dist/model/stacStyles.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** The key a style asset stores its categorised field under. */
|
|
2
2
|
const QUAC_CATEGORISED_FIELD = 'quac:categorised_field';
|
|
3
3
|
/** The key a style asset stores its style overrides under. */
|
|
4
|
-
const QUAC_STYLE_OVERRIDES = 'quac:style_overrides';
|
|
4
|
+
export const QUAC_STYLE_OVERRIDES = 'quac:style_overrides';
|
|
5
5
|
function readStyleOverrides(value) {
|
|
6
6
|
if (!Array.isArray(value))
|
|
7
7
|
return [];
|
|
@@ -12,7 +12,10 @@ import type { StacCatalog, StacCollection } from '../model/Stac.ts';
|
|
|
12
12
|
export declare function collectAllCollections(root: StacCatalog): StacCollection[];
|
|
13
13
|
/**
|
|
14
14
|
* Rewrites a fetched document's asset and link hrefs to absolute addresses,
|
|
15
|
-
* against the URL the document itself came from
|
|
15
|
+
* against the URL the document itself came from, and with them each address a
|
|
16
|
+
* style asset's `quac:style_overrides` lists: an override written by address
|
|
17
|
+
* is a file beside the catalogue as much as an asset is. An override written in
|
|
18
|
+
* place, as an object, is kept as it is.
|
|
16
19
|
*
|
|
17
20
|
* A published catalogue gives each Collection its own document and addresses
|
|
18
21
|
* that Collection's files relative to it — `./roads.parquet` beside
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { QUAC_STYLE_OVERRIDES } from "../model/stacStyles.js";
|
|
1
2
|
/**
|
|
2
3
|
* Pure helpers over a fetched STAC document, used by `StacEndpointAdapter` as
|
|
3
4
|
* it reads and inlines a catalogue. None of them makes a request.
|
|
@@ -18,7 +19,10 @@ export function collectAllCollections(root) {
|
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Rewrites a fetched document's asset and link hrefs to absolute addresses,
|
|
21
|
-
* against the URL the document itself came from
|
|
22
|
+
* against the URL the document itself came from, and with them each address a
|
|
23
|
+
* style asset's `quac:style_overrides` lists: an override written by address
|
|
24
|
+
* is a file beside the catalogue as much as an asset is. An override written in
|
|
25
|
+
* place, as an object, is kept as it is.
|
|
22
26
|
*
|
|
23
27
|
* A published catalogue gives each Collection its own document and addresses
|
|
24
28
|
* that Collection's files relative to it — `./roads.parquet` beside
|
|
@@ -56,7 +60,16 @@ export function resolveDocumentHrefs(document, url) {
|
|
|
56
60
|
...(document.links ? { links: document.links.map((link) => ({ ...link, href: absolute(link.href) })) } : {}),
|
|
57
61
|
...(assets
|
|
58
62
|
? {
|
|
59
|
-
assets: Object.fromEntries(Object.entries(assets).map(([key, asset]) =>
|
|
63
|
+
assets: Object.fromEntries(Object.entries(assets).map(([key, asset]) => {
|
|
64
|
+
const overrides = asset[QUAC_STYLE_OVERRIDES];
|
|
65
|
+
return [key, {
|
|
66
|
+
...asset,
|
|
67
|
+
href: absolute(asset.href),
|
|
68
|
+
...(Array.isArray(overrides)
|
|
69
|
+
? { [QUAC_STYLE_OVERRIDES]: overrides.map((entry) => (typeof entry === 'string' ? absolute(entry) : entry)) }
|
|
70
|
+
: {})
|
|
71
|
+
}];
|
|
72
|
+
}))
|
|
60
73
|
}
|
|
61
74
|
: {}),
|
|
62
75
|
// A document that inlines its children addresses their files relative to
|