@vectoriahq/quac 0.10.0 → 0.11.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FieldRange } from '../model/QgsProject.ts';
|
|
1
|
+
import type { FieldRange, FieldUuidFormat } from '../model/QgsProject.ts';
|
|
2
2
|
import type { StacCollection } from '../model/Stac.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Why a new feature's field is refused:
|
|
@@ -78,4 +78,11 @@ export declare function isBlankFieldValue(value: unknown): boolean;
|
|
|
78
78
|
* type deal with those. Text holding a number is read as that number.
|
|
79
79
|
*/
|
|
80
80
|
export declare function isOutsideFieldRange(value: unknown, range: Pick<FieldRange, 'min' | 'max'>): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* A new identifier written as QGIS's `uuid()` writes it, for a field whose
|
|
83
|
+
* default is one: `{…}` with hyphens (`with_braces`), hyphens alone
|
|
84
|
+
* (`without_braces`), or 32 hex digits (`id128`), as QGIS's `fcnUuid`
|
|
85
|
+
* (`QgsExpressionFunction`) writes them.
|
|
86
|
+
*/
|
|
87
|
+
export declare function newQgisUuid(format: FieldUuidFormat): string;
|
|
81
88
|
export {};
|
|
@@ -89,6 +89,20 @@ export function isOutsideFieldRange(value, range) {
|
|
|
89
89
|
return false;
|
|
90
90
|
return (range.min !== undefined && number < range.min) || (range.max !== undefined && number > range.max);
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* A new identifier written as QGIS's `uuid()` writes it, for a field whose
|
|
94
|
+
* default is one: `{…}` with hyphens (`with_braces`), hyphens alone
|
|
95
|
+
* (`without_braces`), or 32 hex digits (`id128`), as QGIS's `fcnUuid`
|
|
96
|
+
* (`QgsExpressionFunction`) writes them.
|
|
97
|
+
*/
|
|
98
|
+
export function newQgisUuid(format) {
|
|
99
|
+
const uuid = crypto.randomUUID();
|
|
100
|
+
if (format === 'without_braces')
|
|
101
|
+
return uuid;
|
|
102
|
+
if (format === 'id128')
|
|
103
|
+
return uuid.replaceAll('-', '');
|
|
104
|
+
return `{${uuid}}`;
|
|
105
|
+
}
|
|
92
106
|
const KNOWN_TYPES = new Set(['string', 'int', 'long', 'double', 'boolean', 'date', 'time', 'timestamp']);
|
|
93
107
|
const DATE_TYPES = new Set(['date', 'time', 'timestamp']);
|
|
94
108
|
function uncheckedRules(column, type, unique, dateFormat) {
|
package/dist/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export { readSqlFeatureTest } from './parse/sqlFeatureFilter.ts';
|
|
|
23
23
|
export type { FeatureTest } from './parse/sqlFeatureFilter.ts';
|
|
24
24
|
export { publishLayerFeatures } from './generate/publishLayer.ts';
|
|
25
25
|
export type { PublishedLayer, PublishRefusal } from './generate/publishLayer.ts';
|
|
26
|
-
export { validateNewFeature, readNewFeatureFields, isBlankFieldValue, isOutsideFieldRange } from './generate/validateNewFeature.ts';
|
|
26
|
+
export { validateNewFeature, readNewFeatureFields, isBlankFieldValue, isOutsideFieldRange, newQgisUuid } from './generate/validateNewFeature.ts';
|
|
27
27
|
export type { NewFeatureCheck, NewFeatureProblem, UncheckedFieldRule } from './generate/validateNewFeature.ts';
|
|
28
28
|
export type { FeatureFilter, FeatureFilterDialect } from './model/featureFilter.ts';
|
|
29
29
|
export type { DelimitedTextOptions } from './model/delimitedText.ts';
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ export { DEFAULT_DELIMITED_TEXT_OPTIONS, QUAC_DELIMITED_TEXT, readCollectionDeli
|
|
|
17
17
|
export { QUAC_FEATURE_FILTER, readCollectionFeatureFilter } from "./model/featureFilter.js";
|
|
18
18
|
export { readSqlFeatureTest } from "./parse/sqlFeatureFilter.js";
|
|
19
19
|
export { publishLayerFeatures } from "./generate/publishLayer.js";
|
|
20
|
-
export { validateNewFeature, readNewFeatureFields, isBlankFieldValue, isOutsideFieldRange } from "./generate/validateNewFeature.js";
|
|
20
|
+
export { validateNewFeature, readNewFeatureFields, isBlankFieldValue, isOutsideFieldRange, newQgisUuid } from "./generate/validateNewFeature.js";
|
|
21
21
|
export { decodeAssetPath, encodeAssetPath, isRelativeHref, readCollectionDataPath, readCollectionOnlineFile } from "./model/stacHref.js";
|
|
22
22
|
export { DATA_ROLE, findAssetByRole, readDataAsset } from "./model/stacAssetRoles.js";
|
|
23
23
|
export { THUMBNAIL_ROLE, readCollectionAttribution, readCollectionDeprecation, readCollectionSelfHref, readCollectionThumbnail } from "./model/stacCollectionNotes.js";
|