@versatiles/versatiles-rs 4.8.0 → 4.9.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/index.d.ts CHANGED
@@ -499,6 +499,8 @@ export declare class TileSource {
499
499
  * # Arguments
500
500
  *
501
501
  * * `path` - File path or URL to the tile container
502
+ * * `options` - Optional source options; `sshIdentity` names a private key
503
+ * file for an `sftp://` path
502
504
  *
503
505
  * # Returns
504
506
  *
@@ -519,9 +521,14 @@ export declare class TileSource {
519
521
  *
520
522
  * // Open remote file
521
523
  * const reader = await ContainerReader.from_path('https://example.com/tiles.pmtiles');
524
+ *
525
+ * // Open an SFTP file with a specific key
526
+ * const reader = await TileSource.fromPath('sftp://host/tiles.pmtiles', {
527
+ * sshIdentity: '/home/deploy/.ssh/id_ed25519',
528
+ * });
522
529
  * ```
523
530
  */
524
- static fromPath(path: string): Promise<TileSource>
531
+ static fromPath(path: string, options?: SourceOptions | undefined | null): Promise<TileSource>
525
532
  /**
526
533
  * Create a TileSource from a VPL (VersaTiles Pipeline Language) string
527
534
  *
@@ -586,7 +593,7 @@ export declare class TileSource {
586
593
  * VPL sources can be converted using `convertTo()` just like any other tile source.
587
594
  * The conversion will process the pipeline and write the output tiles to the target format.
588
595
  */
589
- static fromVpl(vpl: string, dir?: string | undefined | null): Promise<TileSource>
596
+ static fromVpl(vpl: string, dir?: string | undefined | null, options?: SourceOptions | undefined | null): Promise<TileSource>
590
597
  /**
591
598
  * Create a TileSource from a pipeline definition (JSON)
592
599
  *
@@ -598,8 +605,10 @@ export declare class TileSource {
598
605
  * * `steps_json` - JSON string describing the pipeline steps
599
606
  * * `dir` - Optional base directory for resolving relative file paths.
600
607
  * Defaults to the current working directory if not specified.
608
+ * * `options` - Optional source options; `sshIdentity` names a private key
609
+ * file for `sftp://` sources inside the pipeline
601
610
  */
602
- static fromPipeline(stepsJson: string, dir?: string | undefined | null): Promise<TileSource>
611
+ static fromPipeline(stepsJson: string, dir?: string | undefined | null, options?: SourceOptions | undefined | null): Promise<TileSource>
603
612
  /**
604
613
  * Convert this tile source to another format
605
614
  *
@@ -609,7 +618,7 @@ export declare class TileSource {
609
618
  *
610
619
  * # Arguments
611
620
  *
612
- * * `output` - Path to the output tile container
621
+ * * `output` - Path to the output tile container, or an `sftp://` URL
613
622
  * * `options` - Optional conversion options (zoom range, bbox, compression, etc.)
614
623
  * * `on_progress` - Optional callback for progress updates
615
624
  * * `on_message` - Optional callback for step/warning/error messages
@@ -621,7 +630,11 @@ export declare class TileSource {
621
630
  * - `bboxBorder`: Add border tiles around bbox (in tile units)
622
631
  * - `compress`: Output compression ("gzip", "brotli", "uncompressed")
623
632
  * - `flipY`: Flip tiles vertically (TMS ↔ XYZ coordinate systems)
624
- * - `swapXY`: Swap X and Y tile coordinates
633
+ * - `swapXy`: Swap X and Y tile coordinates
634
+ * - `writerOptions`: Format-specific settings for the output writer, keyed by the
635
+ * writer's own `snake_case` names, e.g. `{ allow_unclustered: 'true' }` for PMTiles
636
+ * - `sshIdentity`: Private key file for an `sftp://` input, defaulting to
637
+ * `VERSATILES_SSH_IDENTITY`
625
638
  *
626
639
  * # Progress Callbacks
627
640
  *
@@ -780,6 +793,33 @@ export declare class TileSource {
780
793
  sourceType(): SourceType
781
794
  }
782
795
 
796
+ /**
797
+ * Checks VPL text against the known operations, without building the pipeline.
798
+ *
799
+ * Building opens files and fetches URLs, so it cannot run on a keystroke — and it conflates two
800
+ * failures. `from_container filename=missing.mbtiles` is the *world* being wrong; `from_debug
801
+ * format=png nonsense=1` is the *pipeline* being wrong. This reports only the second kind, and
802
+ * performs no I/O.
803
+ *
804
+ * Returns a JSON string, with the same result shape as [`parse_vpl`]:
805
+ *
806
+ * - on success, `{"ok": true, "problems": [{"message": "...", "path": [0], "property": "nonsense"}]}`
807
+ * — an empty `problems` array means nothing is wrong with the pipeline
808
+ * - on failure, `{"ok": false, "error": {...}}` — the text did not parse at all
809
+ *
810
+ * `path` addresses the offending node by index: `[2]` is the third node of the pipeline, and
811
+ * descending into a node's bracketed sources appends the source index and then the node index.
812
+ * The same walk applies to the tree from `parseVplCst`, which is how this becomes a span.
813
+ *
814
+ * Two things are deliberately *not* reported, because doing so would reject VPL that runs:
815
+ * parameter values are never validated (`color=red` passes here and fails at build time), and
816
+ * neither are enum values, since the accepted set includes aliases the metadata does not list.
817
+ *
818
+ * @param vpl - the VPL text to check
819
+ * @returns a JSON string describing either the problems found or a parse error
820
+ */
821
+ export declare function checkVpl(vpl: string): string
822
+
783
823
  /**
784
824
  * Convert tiles from one container format to another
785
825
  *
@@ -790,7 +830,7 @@ export declare class TileSource {
790
830
  * # Arguments
791
831
  *
792
832
  * * `input` - Path or URL to the input tile container
793
- * * `output` - Path to the output tile container
833
+ * * `output` - Path to the output tile container, or an `sftp://` URL
794
834
  * * `options` - Optional conversion options (zoom range, bbox, compression, etc.)
795
835
  * * `on_progress` - Optional callback for progress updates
796
836
  * * `on_message` - Optional callback for step/warning/error messages
@@ -802,7 +842,11 @@ export declare class TileSource {
802
842
  * - `bboxBorder`: Add border tiles around bbox (in tile units)
803
843
  * - `compress`: Output compression ("gzip", "brotli", "uncompressed")
804
844
  * - `flipY`: Flip tiles vertically (TMS ↔ XYZ coordinate systems)
805
- * - `swapXY`: Swap X and Y tile coordinates
845
+ * - `swapXy`: Swap X and Y tile coordinates
846
+ * - `writerOptions`: Format-specific settings for the output writer, keyed by the
847
+ * writer's own `snake_case` names, e.g. `{ allow_unclustered: 'true' }` for PMTiles
848
+ * - `sshIdentity`: Private key file for an `sftp://` input, defaulting to
849
+ * `VERSATILES_SSH_IDENTITY`
806
850
  *
807
851
  * # Progress Callbacks
808
852
  *
@@ -951,6 +995,51 @@ export interface ConvertOptions {
951
995
  * **Default:** `false` (no swapping)
952
996
  */
953
997
  swapXy?: boolean
998
+ /**
999
+ * Format-specific options for the output writer
1000
+ *
1001
+ * Which options exist depends on the output format. An option the chosen
1002
+ * writer does not accept is an error, not a no-op, and the message lists
1003
+ * what that format does accept.
1004
+ *
1005
+ * Keys reach the writer verbatim, so they keep the writer's own spelling —
1006
+ * `snake_case`, unlike the camelCase fields around them here.
1007
+ *
1008
+ * PMTiles accepts three; every other format accepts none:
1009
+ * - `allow_unclustered` — write an archive that is not physically clustered,
1010
+ * in a single pass, at the cost of more range requests when serving it
1011
+ * - `reorder` — stay clustered by writing the tile data twice, at the cost of
1012
+ * a second pass and temporary disk the size of the output
1013
+ * - `temp_dir` — where `reorder` puts that temporary file (default: the
1014
+ * output file's own directory)
1015
+ *
1016
+ * They matter only for a source that cannot supply Hilbert order, such as a
1017
+ * pipeline containing `raster_overview`; writing one to `.pmtiles` without
1018
+ * either opt-in is an error. Asking for both is also an error, since they buy
1019
+ * different things. Booleans are strings — `'true'`, `'1'` or `'yes'`,
1020
+ * case-insensitively, and likewise for false.
1021
+ *
1022
+ * **Example:** `{ allow_unclustered: 'true' }` when writing PMTiles
1023
+ *
1024
+ * **Default:** No writer options
1025
+ */
1026
+ writerOptions?: Record<string, string>
1027
+ /**
1028
+ * SSH identity (private key) file used for `sftp://` sources
1029
+ *
1030
+ * A path to a private key file on disk — the same thing the CLI's
1031
+ * `--ssh-identity` names. It is read when the input is an `sftp://` URL, and
1032
+ * ignored otherwise.
1033
+ *
1034
+ * Without it, the `VERSATILES_SSH_IDENTITY` environment variable is used;
1035
+ * without that, a password in the URL, the SSH agent and the usual `~/.ssh`
1036
+ * defaults still apply.
1037
+ *
1038
+ * **Example:** `'/home/deploy/.ssh/id_ed25519'`
1039
+ *
1040
+ * **Default:** `VERSATILES_SSH_IDENTITY`, if set
1041
+ */
1042
+ sshIdentity?: string
954
1043
  }
955
1044
 
956
1045
  /**
@@ -961,6 +1050,77 @@ export interface ConvertOptions {
961
1050
  */
962
1051
  export declare function generateVplTypescript(): string
963
1052
 
1053
+ /**
1054
+ * Compute the per-layer byte breakdown of an uncompressed vector tile.
1055
+ *
1056
+ * # Arguments
1057
+ *
1058
+ * * `tile` - Uncompressed MVT bytes, as returned by `TileSource.getTile()`.
1059
+ *
1060
+ * # Returns
1061
+ *
1062
+ * One entry per layer, in the order the layers appear in the tile. A tile with
1063
+ * no layers — including a zero-byte buffer, which is what an empty tile encodes
1064
+ * to — yields an empty array. `getTile()` signals a missing tile with `null`,
1065
+ * so an empty buffer means an empty tile rather than a mistake.
1066
+ *
1067
+ * # Errors
1068
+ *
1069
+ * Returns an error if the buffer is not an uncompressed vector tile. Compressed
1070
+ * input and raster input are named as such rather than surfacing as a protobuf
1071
+ * parse failure.
1072
+ *
1073
+ * # Examples
1074
+ *
1075
+ * ```javascript
1076
+ * const { TileSource, layerStats } = require('@versatiles/versatiles-rs');
1077
+ *
1078
+ * const source = await TileSource.fromPath('berlin.mbtiles');
1079
+ * const tile = await source.getTile(14, 8802, 5373);
1080
+ * if (tile) {
1081
+ * for (const layer of layerStats(tile)) {
1082
+ * console.log(layer.name, layer.geometryBytes, layer.propertyBytes, layer.encodedBytes);
1083
+ * }
1084
+ * }
1085
+ * ```
1086
+ */
1087
+ export declare function layerStats(tile: Buffer): Array<LayerStats>
1088
+
1089
+ /**
1090
+ * Byte breakdown of a single layer within a vector tile.
1091
+ *
1092
+ * All figures are uncompressed MVT content — what can actually be shrunk.
1093
+ * The named categories plus `otherBytes` sum exactly to `encodedBytes`, so a
1094
+ * stacked bar built from them adds up without a fudge factor.
1095
+ */
1096
+ export interface LayerStats {
1097
+ /** Layer name. */
1098
+ name: string
1099
+ /** Number of features in the layer. */
1100
+ featureCount: number
1101
+ /** Total number of geometry vertices across all features. */
1102
+ vertexCount: number
1103
+ /** Geometry command streams. */
1104
+ geometryBytes: number
1105
+ /** Per-feature property references (the packed `tag_ids` varints). */
1106
+ tagBytes: number
1107
+ /** Key strings in the property table. */
1108
+ keyBytes: number
1109
+ /** Encoded value messages in the property table. */
1110
+ valueBytes: number
1111
+ /** `keyBytes + valueBytes` — the whole property table. */
1112
+ propertyBytes: number
1113
+ /** Feature ids. Zero for sources that carry none. */
1114
+ idBytes: number
1115
+ /**
1116
+ * Framing, geometry-type fields and the layer name: whatever the named
1117
+ * categories do not account for.
1118
+ */
1119
+ otherBytes: number
1120
+ /** Exact serialized size of the layer. */
1121
+ encodedBytes: number
1122
+ }
1123
+
964
1124
  /**
965
1125
  * Status or diagnostic message from an operation
966
1126
  *
@@ -1022,18 +1182,6 @@ export declare function parseVpl(vpl: string): string
1022
1182
  */
1023
1183
  export declare function parseVplCst(vpl: string): string
1024
1184
 
1025
- /** Probe result with container information */
1026
- export interface ProbeResult {
1027
- /** Source name or path */
1028
- sourceName: string
1029
- /** Container type (e.g., "mbtiles", "versatiles") */
1030
- containerName: string
1031
- /** TileJSON metadata as JSON string */
1032
- tileJsonRaw: string
1033
- /** Reader parameters */
1034
- parameters: SourceMetadata
1035
- }
1036
-
1037
1185
  /**
1038
1186
  * Progress information for long-running operations
1039
1187
  *
@@ -1195,6 +1343,20 @@ export interface ServerOptions {
1195
1343
  * **Default:** `false` (optimal recompression)
1196
1344
  */
1197
1345
  minimalRecompression?: boolean
1346
+ /**
1347
+ * `Cache-Control` header sent with every tile
1348
+ *
1349
+ * Tile URLs are stable — built from a mount name and a coordinate — so
1350
+ * when the tiles behind a mount change, the URL does not, and the browser
1351
+ * answers from its own cache. A dev server or an interactive preview that
1352
+ * re-mounts under the same name will otherwise keep showing the previous
1353
+ * edit.
1354
+ *
1355
+ * Example: `"no-cache"`.
1356
+ *
1357
+ * **Default:** `"public, max-age=2419200, no-transform"` (four weeks)
1358
+ */
1359
+ cacheControl?: string
1198
1360
  }
1199
1361
 
1200
1362
  /** Tile source metadata describing output characteristics */
@@ -1209,6 +1371,31 @@ export interface SourceMetadata {
1209
1371
  maxZoom: number
1210
1372
  }
1211
1373
 
1374
+ /**
1375
+ * Options for opening a tile source
1376
+ *
1377
+ * Everything here is optional; an omitted field keeps the default behaviour.
1378
+ */
1379
+ export interface SourceOptions {
1380
+ /**
1381
+ * SSH identity (private key) file used for `sftp://` sources
1382
+ *
1383
+ * A path to a private key file on disk — the same thing the CLI's
1384
+ * `--ssh-identity` names. It is read when the source is an `sftp://` URL,
1385
+ * including one reached through a pipeline, and ignored otherwise.
1386
+ *
1387
+ * Without it, the `VERSATILES_SSH_IDENTITY` environment variable is used;
1388
+ * without that, a password in the URL, the SSH agent and the usual `~/.ssh`
1389
+ * defaults still apply. Set this to give one source a different key than the
1390
+ * rest of the process.
1391
+ *
1392
+ * **Example:** `'/home/deploy/.ssh/id_ed25519'`
1393
+ *
1394
+ * **Default:** `VERSATILES_SSH_IDENTITY`, if set
1395
+ */
1396
+ sshIdentity?: string
1397
+ }
1398
+
1212
1399
  /**
1213
1400
  * Writes a pipeline as VPL text.
1214
1401
  *
package/index.js CHANGED
@@ -81,8 +81,8 @@ function requireNative() {
81
81
  try {
82
82
  const binding = require('@versatiles/versatiles-rs-android-arm64')
83
83
  const bindingPackageVersion = require('@versatiles/versatiles-rs-android-arm64/package.json').version
84
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
85
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
84
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
85
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
86
86
  }
87
87
  return binding
88
88
  } catch (e) {
@@ -97,8 +97,8 @@ function requireNative() {
97
97
  try {
98
98
  const binding = require('@versatiles/versatiles-rs-android-arm-eabi')
99
99
  const bindingPackageVersion = require('@versatiles/versatiles-rs-android-arm-eabi/package.json').version
100
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
101
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
100
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
101
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
102
102
  }
103
103
  return binding
104
104
  } catch (e) {
@@ -118,8 +118,8 @@ function requireNative() {
118
118
  try {
119
119
  const binding = require('@versatiles/versatiles-rs-win32-x64-gnu')
120
120
  const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-gnu/package.json').version
121
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
122
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
121
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
122
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
123
123
  }
124
124
  return binding
125
125
  } catch (e) {
@@ -134,8 +134,8 @@ function requireNative() {
134
134
  try {
135
135
  const binding = require('@versatiles/versatiles-rs-win32-x64-msvc')
136
136
  const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-msvc/package.json').version
137
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
138
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
137
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
138
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
139
139
  }
140
140
  return binding
141
141
  } catch (e) {
@@ -151,8 +151,8 @@ function requireNative() {
151
151
  try {
152
152
  const binding = require('@versatiles/versatiles-rs-win32-ia32-msvc')
153
153
  const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-ia32-msvc/package.json').version
154
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
155
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
154
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
155
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
156
156
  }
157
157
  return binding
158
158
  } catch (e) {
@@ -167,8 +167,8 @@ function requireNative() {
167
167
  try {
168
168
  const binding = require('@versatiles/versatiles-rs-win32-arm64-msvc')
169
169
  const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-arm64-msvc/package.json').version
170
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
171
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
170
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
171
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
172
172
  }
173
173
  return binding
174
174
  } catch (e) {
@@ -186,8 +186,8 @@ function requireNative() {
186
186
  try {
187
187
  const binding = require('@versatiles/versatiles-rs-darwin-universal')
188
188
  const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-universal/package.json').version
189
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
190
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
189
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
190
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
191
191
  }
192
192
  return binding
193
193
  } catch (e) {
@@ -202,8 +202,8 @@ function requireNative() {
202
202
  try {
203
203
  const binding = require('@versatiles/versatiles-rs-darwin-x64')
204
204
  const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-x64/package.json').version
205
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
206
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
205
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
206
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
207
207
  }
208
208
  return binding
209
209
  } catch (e) {
@@ -218,8 +218,8 @@ function requireNative() {
218
218
  try {
219
219
  const binding = require('@versatiles/versatiles-rs-darwin-arm64')
220
220
  const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-arm64/package.json').version
221
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
222
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
221
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
222
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
223
223
  }
224
224
  return binding
225
225
  } catch (e) {
@@ -238,8 +238,8 @@ function requireNative() {
238
238
  try {
239
239
  const binding = require('@versatiles/versatiles-rs-freebsd-x64')
240
240
  const bindingPackageVersion = require('@versatiles/versatiles-rs-freebsd-x64/package.json').version
241
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
242
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
241
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
242
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
243
243
  }
244
244
  return binding
245
245
  } catch (e) {
@@ -254,8 +254,8 @@ function requireNative() {
254
254
  try {
255
255
  const binding = require('@versatiles/versatiles-rs-freebsd-arm64')
256
256
  const bindingPackageVersion = require('@versatiles/versatiles-rs-freebsd-arm64/package.json').version
257
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
258
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
257
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
258
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
259
259
  }
260
260
  return binding
261
261
  } catch (e) {
@@ -275,8 +275,8 @@ function requireNative() {
275
275
  try {
276
276
  const binding = require('@versatiles/versatiles-rs-linux-x64-musl')
277
277
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-x64-musl/package.json').version
278
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
279
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
278
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
279
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
280
280
  }
281
281
  return binding
282
282
  } catch (e) {
@@ -291,8 +291,8 @@ function requireNative() {
291
291
  try {
292
292
  const binding = require('@versatiles/versatiles-rs-linux-x64-gnu')
293
293
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-x64-gnu/package.json').version
294
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
295
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
294
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
295
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
296
296
  }
297
297
  return binding
298
298
  } catch (e) {
@@ -309,8 +309,8 @@ function requireNative() {
309
309
  try {
310
310
  const binding = require('@versatiles/versatiles-rs-linux-arm64-musl')
311
311
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm64-musl/package.json').version
312
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
313
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
312
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
313
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
314
314
  }
315
315
  return binding
316
316
  } catch (e) {
@@ -325,8 +325,8 @@ function requireNative() {
325
325
  try {
326
326
  const binding = require('@versatiles/versatiles-rs-linux-arm64-gnu')
327
327
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm64-gnu/package.json').version
328
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
329
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
328
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
329
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
330
330
  }
331
331
  return binding
332
332
  } catch (e) {
@@ -343,8 +343,8 @@ function requireNative() {
343
343
  try {
344
344
  const binding = require('@versatiles/versatiles-rs-linux-arm-musleabihf')
345
345
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm-musleabihf/package.json').version
346
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
347
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
346
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
347
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
348
348
  }
349
349
  return binding
350
350
  } catch (e) {
@@ -359,8 +359,8 @@ function requireNative() {
359
359
  try {
360
360
  const binding = require('@versatiles/versatiles-rs-linux-arm-gnueabihf')
361
361
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm-gnueabihf/package.json').version
362
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
363
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
362
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
363
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
364
364
  }
365
365
  return binding
366
366
  } catch (e) {
@@ -377,8 +377,8 @@ function requireNative() {
377
377
  try {
378
378
  const binding = require('@versatiles/versatiles-rs-linux-loong64-musl')
379
379
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-loong64-musl/package.json').version
380
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
381
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
380
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
381
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
382
382
  }
383
383
  return binding
384
384
  } catch (e) {
@@ -393,8 +393,8 @@ function requireNative() {
393
393
  try {
394
394
  const binding = require('@versatiles/versatiles-rs-linux-loong64-gnu')
395
395
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-loong64-gnu/package.json').version
396
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
397
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
396
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
397
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
398
398
  }
399
399
  return binding
400
400
  } catch (e) {
@@ -411,8 +411,8 @@ function requireNative() {
411
411
  try {
412
412
  const binding = require('@versatiles/versatiles-rs-linux-riscv64-musl')
413
413
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-riscv64-musl/package.json').version
414
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
415
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
414
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
415
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
416
416
  }
417
417
  return binding
418
418
  } catch (e) {
@@ -427,8 +427,8 @@ function requireNative() {
427
427
  try {
428
428
  const binding = require('@versatiles/versatiles-rs-linux-riscv64-gnu')
429
429
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-riscv64-gnu/package.json').version
430
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
431
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
430
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
431
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
432
432
  }
433
433
  return binding
434
434
  } catch (e) {
@@ -444,8 +444,8 @@ function requireNative() {
444
444
  try {
445
445
  const binding = require('@versatiles/versatiles-rs-linux-ppc64-gnu')
446
446
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-ppc64-gnu/package.json').version
447
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
448
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
447
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
448
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
449
449
  }
450
450
  return binding
451
451
  } catch (e) {
@@ -460,8 +460,8 @@ function requireNative() {
460
460
  try {
461
461
  const binding = require('@versatiles/versatiles-rs-linux-s390x-gnu')
462
462
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-s390x-gnu/package.json').version
463
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
464
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
463
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
464
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
465
465
  }
466
466
  return binding
467
467
  } catch (e) {
@@ -480,8 +480,8 @@ function requireNative() {
480
480
  try {
481
481
  const binding = require('@versatiles/versatiles-rs-openharmony-arm64')
482
482
  const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-arm64/package.json').version
483
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
484
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
483
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
484
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
485
485
  }
486
486
  return binding
487
487
  } catch (e) {
@@ -496,8 +496,8 @@ function requireNative() {
496
496
  try {
497
497
  const binding = require('@versatiles/versatiles-rs-openharmony-x64')
498
498
  const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-x64/package.json').version
499
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
500
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
499
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
500
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
501
501
  }
502
502
  return binding
503
503
  } catch (e) {
@@ -512,8 +512,8 @@ function requireNative() {
512
512
  try {
513
513
  const binding = require('@versatiles/versatiles-rs-openharmony-arm')
514
514
  const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-arm/package.json').version
515
- if (bindingPackageVersion !== '4.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
516
- throw new Error(`Native binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
515
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
516
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
517
517
  }
518
518
  return binding
519
519
  } catch (e) {
@@ -652,8 +652,8 @@ if (!nativeBinding || forceWasi) {
652
652
  if (!candidateFailed) {
653
653
  if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
654
654
  const bindingPackageVersion = require('@versatiles/versatiles-rs-wasm32-wasi/package.json').version
655
- if (bindingPackageVersion !== '4.8.0') {
656
- throw new Error(`WASI binding package version mismatch, expected 4.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
655
+ if (bindingPackageVersion !== '4.9.0') {
656
+ throw new Error(`WASI binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
657
657
  }
658
658
  }
659
659
  wasiBinding = require('@versatiles/versatiles-rs-wasm32-wasi')
@@ -703,14 +703,16 @@ if (!nativeBinding) {
703
703
  throw new Error(`Failed to load native binding`)
704
704
  }
705
705
 
706
- const { Progress, SourceType, TileCoord, TileServer, TileSource, convert, generateVplTypescript, parseVpl, parseVplCst, stringifyVpl, stringifyVplCst } = nativeBinding
706
+ const { Progress, SourceType, TileCoord, TileServer, TileSource, checkVpl, convert, generateVplTypescript, layerStats, parseVpl, parseVplCst, stringifyVpl, stringifyVplCst } = nativeBinding
707
707
  export { Progress }
708
708
  export { SourceType }
709
709
  export { TileCoord }
710
710
  export { TileServer }
711
711
  export { TileSource }
712
+ export { checkVpl }
712
713
  export { convert }
713
714
  export { generateVplTypescript }
715
+ export { layerStats }
714
716
  export { parseVpl }
715
717
  export { parseVplCst }
716
718
  export { stringifyVpl }